47 | | Dans {{{Locon.cpp}}} : |
48 | | {{{ |
49 | | #include "Indentation.h" |
50 | | |
51 | | /// ... |
52 | | |
53 | | std::string Locon::typeToString ( unsigned int type ) |
54 | | { |
55 | | switch ( type ) { |
56 | | case Internal: return "Internal"; |
57 | | case External: return "External"; |
58 | | } |
59 | | return "Unknown"; |
60 | | } |
61 | | |
62 | | |
63 | | std::string Locon::dirToString ( unsigned int direction ) |
64 | | { |
65 | | switch ( direction ) { |
66 | | case In: return "In"; |
67 | | case Out: return "Out"; |
68 | | case Inout: return "Inout"; |
69 | | case Tristate: return "Tristate"; |
70 | | case Transcv: return "Transcv"; |
71 | | } |
72 | | return "Unknown"; |
73 | | } |
74 | | |
75 | | |
76 | | void Locon::xmlDrive ( std::ostream& o ) |
77 | | { |
78 | | o << indent << "<Locon name=\"" << _name << "\""; |
79 | | o << " signal=\"" << ((_signal != NULL) ? _signal->getName() : "NULL") << "\""; |
80 | | if ( _type == External ) o << " model=\"" << getModel ()->getName() << "\""; |
81 | | else o << " instance=\"" << getInstance()->getName() << "\""; |
82 | | o << " dir=\"" << dirToString(_direction) << "\""; |
83 | | o << " type=\"" << typeToString(_type) << "\"/>\n"; |
84 | | } |
85 | | }}} |
86 | | |
| 47 | Code de [attachment:Locon-Skeleton.cpp Locon.cpp] |