2011CaoTme45: Locon-Skeleton.cpp

File Locon-Skeleton.cpp, 963 bytes (added by jpc, 15 years ago)

C++ Source: Squelette de Locon.cpp

Line 
1
2#include "Indentation.h"
3
4/// ...
5
6std::string Locon::typeToString ( unsigned int type )
7{
8 switch ( type ) {
9 case Internal: return "Internal";
10 case External: return "External";
11 }
12 return "Unknown";
13}
14
15
16std::string Locon::dirToString ( unsigned int direction )
17{
18 switch ( direction ) {
19 case In: return "In";
20 case Out: return "Out";
21 case Inout: return "Inout";
22 case Tristate: return "Tristate";
23 case Transcv: return "Transcv";
24 }
25 return "Unknown";
26}
27
28
29void Locon::xmlDrive ( std::ostream& o )
30{
31 o << indent << "<Locon name=\"" << _name << "\"";
32 o << " signal=\"" << ((_signal != NULL) ? _signal->getName() : "NULL") << "\"";
33 if ( _type == External ) o << " model=\"" << getModel ()->getName() << "\"";
34 else o << " instance=\"" << getInstance()->getName() << "\"";
35 o << " dir=\"" << dirToString(_direction) << "\"";
36 o << " type=\"" << typeToString(_type) << "\"/>\n";
37}