[112] | 1 | #ifndef morpheo_behavioural_Model_h |
---|
| 2 | #define morpheo_behavioural_Model_h |
---|
| 3 | |
---|
| 4 | /* |
---|
| 5 | * $Id: Model.h 131 2009-07-08 18:40:08Z rosiere $ |
---|
| 6 | * |
---|
| 7 | * [ Description ] |
---|
| 8 | * |
---|
| 9 | */ |
---|
| 10 | |
---|
[118] | 11 | #include "Common/include/ToString.h" |
---|
| 12 | #include "Common/include/FromString.h" |
---|
[112] | 13 | #include "Common/include/ErrorMorpheo.h" |
---|
| 14 | #include <map> |
---|
| 15 | |
---|
| 16 | namespace morpheo { |
---|
| 17 | namespace behavioural { |
---|
| 18 | |
---|
| 19 | typedef enum |
---|
| 20 | { |
---|
| 21 | MODEL_SYSTEMC, |
---|
| 22 | MODEL_VHDL |
---|
| 23 | } model_type_t; |
---|
| 24 | |
---|
| 25 | typedef struct |
---|
| 26 | { |
---|
[118] | 27 | model_type_t type ; |
---|
| 28 | bool debug; |
---|
[112] | 29 | } model_t; |
---|
| 30 | |
---|
| 31 | class Model |
---|
| 32 | { |
---|
[131] | 33 | private : model_type_t default_type ; |
---|
| 34 | private : bool default_debug; |
---|
[112] | 35 | |
---|
| 36 | private : std::map<std::string,model_t> models; |
---|
| 37 | |
---|
[118] | 38 | public : Model (void); |
---|
| 39 | public : ~Model (void); |
---|
[131] | 40 | public : void set_model ( model_type_t type, bool debug); |
---|
[118] | 41 | public : void set_model (std::string component, model_type_t type, bool debug); |
---|
| 42 | public : model_type_t get_type (std::string component); |
---|
| 43 | public : bool get_debug (std::string component); |
---|
| 44 | public : void print (void); |
---|
[112] | 45 | }; |
---|
| 46 | |
---|
| 47 | }; // end namespace behavioural |
---|
| 48 | |
---|
[113] | 49 | template<> inline std::string toString<morpheo::behavioural::model_type_t>(const morpheo::behavioural::model_type_t& x) |
---|
| 50 | { |
---|
| 51 | switch (x) |
---|
| 52 | { |
---|
| 53 | case morpheo::behavioural::MODEL_SYSTEMC : return "systemc" ; break; |
---|
| 54 | case morpheo::behavioural::MODEL_VHDL : return "vhdl" ; break; |
---|
| 55 | default : return ""; break; |
---|
| 56 | } |
---|
| 57 | }; |
---|
| 58 | |
---|
[112] | 59 | template<> inline morpheo::behavioural::model_type_t fromString<morpheo::behavioural::model_type_t>(const std::string& x) |
---|
| 60 | { |
---|
| 61 | if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::MODEL_SYSTEMC))) == 0) or |
---|
| 62 | (x.compare("model_systemc") == 0) or |
---|
| 63 | (x.compare("systemc") == 0) |
---|
| 64 | ) |
---|
| 65 | return morpheo::behavioural::MODEL_SYSTEMC; |
---|
| 66 | if ( (x.compare(toString(static_cast<uint32_t>(morpheo::behavioural::MODEL_VHDL))) == 0) or |
---|
| 67 | (x.compare("model_vhdl") == 0) or |
---|
| 68 | (x.compare("vhdl") == 0)) |
---|
| 69 | return morpheo::behavioural::MODEL_VHDL; |
---|
| 70 | throw (ERRORMORPHEO ("fromString","Unknow string : \""+x+"\"\n")); |
---|
| 71 | }; |
---|
| 72 | |
---|
| 73 | }; // end namespace morpheo |
---|
| 74 | |
---|
| 75 | #endif |
---|
| 76 | |
---|