| 1 | |
|---|
| 2 | #ifndef __EBMVAR_H__ |
|---|
| 3 | #define __EBMVAR_H__ |
|---|
| 4 | |
|---|
| 5 | #include <string> |
|---|
| 6 | #include <map> |
|---|
| 7 | #include "Ebm.h" |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | class EbmVar: public Ebm { |
|---|
| 11 | private: |
|---|
| 12 | static unsigned int _maxIndex; |
|---|
| 13 | static std::map<std::string ,EbmVar*> _byName; // All variables storage. |
|---|
| 14 | static std::map<unsigned int,EbmVar*> _byIndex; |
|---|
| 15 | private : |
|---|
| 16 | std::string _name; // Variable name. |
|---|
| 17 | LogicValue _value; // Logical value. |
|---|
| 18 | unsigned int _index; // Unique index (for ROBDD) |
|---|
| 19 | private: |
|---|
| 20 | EbmVar ( std::string name, LogicValue value=LogicValue::Zero ); |
|---|
| 21 | virtual ~EbmVar (); |
|---|
| 22 | public: |
|---|
| 23 | static EbmVar* create ( std::string name, LogicValue value=LogicValue::Zero ); |
|---|
| 24 | public: |
|---|
| 25 | virtual Ebm::Type getType (); |
|---|
| 26 | inline std::string getName (); |
|---|
| 27 | inline LogicValue getValue (); |
|---|
| 28 | inline unsigned int getIndex (); |
|---|
| 29 | inline void setValue ( LogicValue value ); |
|---|
| 30 | // Operations sur le dictionnaire |
|---|
| 31 | static EbmVar* get ( unsigned int index ); |
|---|
| 32 | static EbmVar* get ( std::string name ); |
|---|
| 33 | }; |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | inline std::string EbmVar::getName () { return _name; } |
|---|
| 37 | inline LogicValue EbmVar::getValue () { return _value; } |
|---|
| 38 | inline unsigned int EbmVar::getIndex () { return _index; } |
|---|
| 39 | inline void EbmVar::setValue ( LogicValue value ) { _value=value; } |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | #endif // __EBMVAR_H__ |
|---|