Version 3 (modified by 15 years ago) (diff) | ,
---|
La Structure de Données Lofig
La structure de données {{Lofig}} est conçue pour représenter les netlists en mémoire. Les attributs des différents objets constituants cette structure ont été présentés en cours. Nous allons maintenant compléter avec les déclarations des fonctions membres.
Fonctions membres de la class Locon
Les constructeurs :
- Un
Locon
peut appartenir, soit à un modèle (Lofig
), soit à une instance (Loins
). Il y aura donc deux constructeurs correspondants à chacune de ces possibilités. On fournit en outre son nom et sa direction. Le type sera déduit à partir du constructeur appelé.Locon ( Lofig*, const std::string& name, unsigned int dir );
Locon ( Loins*, const std::string& name, unsigned int dir );
Les accesseurs :
std::string getName ();
Losig* getSignal ();
Lofig* getModel ();
Loins* getInstance ();
unsigned int getDirection();
Les modificateurs (mutators, en VO) :
- Un
Locon
peut (doit) être associé à un signal. On pourra le faire de deux façons différentes, soit en donnant explicitement un pointeur sur leLosig
, soit en indiquant simplement le nom du signal.void setSignal ( Losig* );
void setSignal ( const std::string& );
- Positionnement de la direction :
void setDirection ( unsigned int );
De plus, le code de trois fonctions membres vous sont fournies pour pouvoir
afficher l'objet dans un flux. Dans Locon.h
:
class Locon { public: static std::string typeToString ( unsigned int ); static std::string dirToString ( unsigned int ); public: void xmlDrive ( std::ostream& ); };
Dans Locon.cpp
:
#include "Indentation.h" /// ... std::string Locon::typeToString ( unsigned int type ) { switch ( type ) { case Internal: return "Internal"; case External: return "External"; } return "Unknown"; } std::string Locon::dirToString ( unsigned int direction ) { switch ( direction ) { case In: return "In"; case Out: return "Out"; case Inout: return "Inout"; case Tristate: return "Tristate"; case Transcv: return "Transcv"; } return "Unknown"; } void Locon::xmlDrive ( std::ostream& o ) { o << indent << "<Locon name=\"" << _name << "\""; o << " signal=\"" << ((_signal != NULL) ? _signal->getName() : "NULL") << "\""; if ( _type == External ) o << " model=\"" << getModel ()->getName() << "\""; else o << " instance=\"" << getInstance()->getName() << "\""; o << " dir=\"" << dirToString(_direction) << "\""; o << " type=\"" << typeToString(_type) << "\"/>\n"; }
Attachments (12)
- fulladder-1.png (14.4 KB) - added by 15 years ago.
- fulladder-2.png (25.9 KB) - added by 15 years ago.
- Library-1.png (5.0 KB) - added by 15 years ago.
-
Locon-Skeleton.cpp (963 bytes) - added by 15 years ago.
Skeleton of Locon.cpp
-
Losig-Skeleton.cpp (256 bytes) - added by 15 years ago.
Skeleton of Losig.cpp
-
Loins-Skeleton.cpp (475 bytes) - added by 15 years ago.
Skeleton of Loins.cpp
-
Lofig-Skeleton.cpp (1.3 KB) - added by 15 years ago.
Skeleton of Lofig.cpp
-
Indentation.h (520 bytes) - added by 15 years ago.
Indentation Header
-
Indentation.cpp (974 bytes) - added by 15 years ago.
Indentation C++ Module
-
Library.h (586 bytes) - added by 15 years ago.
Mini cell (Lofig) library C++ header
-
Library.cpp (2.2 KB) - added by 15 years ago.
Mini cell (Lofig) library C++ module
-
Main-Skeleton.cpp (1.5 KB) - added by 15 years ago.
Main C++module
Download all attachments as: .zip