[591] | 1 | #ifndef __XIOS_CAttributeMap__ |
---|
| 2 | #define __XIOS_CAttributeMap__ |
---|
[219] | 3 | |
---|
[591] | 4 | /// XIOS headers /// |
---|
| 5 | #include "xios_spl.hpp" |
---|
[219] | 6 | #include "attribute.hpp" |
---|
| 7 | #include "attribute_template.hpp" |
---|
| 8 | #include "exception.hpp" |
---|
| 9 | #include "xml_node.hpp" |
---|
| 10 | |
---|
[335] | 11 | namespace xios |
---|
[219] | 12 | { |
---|
| 13 | /// ////////////////////// Déclarations ////////////////////// /// |
---|
[1158] | 14 | /*! |
---|
| 15 | \class CAttributeMap |
---|
| 16 | This class represents the set of attributes which an object can have. |
---|
| 17 | Each attribute in the set is represented by an unique id. |
---|
| 18 | */ |
---|
| 19 | |
---|
[219] | 20 | class CAttributeMap |
---|
| 21 | : public xios_map<StdString, CAttribute*> |
---|
| 22 | { |
---|
| 23 | typedef xios_map<StdString, CAttribute*> SuperClassMap; |
---|
| 24 | |
---|
| 25 | public : |
---|
| 26 | |
---|
| 27 | /// Tests /// |
---|
[1009] | 28 | bool hasAttribute(const StdString & key) const; |
---|
[219] | 29 | |
---|
| 30 | /// Accesseurs /// |
---|
| 31 | CAttribute * operator[](const StdString & key); |
---|
| 32 | |
---|
| 33 | /// Mutateurs /// |
---|
| 34 | void setAttribute(const StdString & key, CAttribute * const attr); |
---|
| 35 | |
---|
| 36 | void setAttributes(const xml::THashAttributes & attributes); |
---|
[445] | 37 | void setAttributes(const CAttributeMap * const _parent, bool apply=true); |
---|
[623] | 38 | void duplicateAttributes(const CAttributeMap* const _parent); |
---|
[219] | 39 | void clearAllAttributes(void); |
---|
[1622] | 40 | StdString dumpXiosAttributes(void) const; |
---|
[1704] | 41 | StdString record4graphXiosAttributes(void) const; |
---|
[219] | 42 | |
---|
[509] | 43 | void clearAttribute(const StdString& key); |
---|
[1158] | 44 | bool isEqual(const CAttributeMap& another, const vector<StdString>& excludedAttrs); |
---|
[509] | 45 | |
---|
[219] | 46 | /// Destructeur /// |
---|
| 47 | virtual ~CAttributeMap(void); |
---|
| 48 | |
---|
| 49 | /// Flux /// |
---|
| 50 | // Debug only // |
---|
| 51 | // friend StdOStream & operator << (StdOStream & os, const CAttributeMap & attributmap); |
---|
| 52 | |
---|
| 53 | /// Autre /// |
---|
| 54 | virtual StdString toString(void) const; |
---|
| 55 | virtual void fromString(const StdString & str); |
---|
[509] | 56 | |
---|
[369] | 57 | // virtual void toBinary (StdOStream & os) const; |
---|
| 58 | // virtual void fromBinary(StdIStream & is); |
---|
[313] | 59 | virtual void generateCInterface(ostream& oss, const string& className) ; |
---|
| 60 | virtual void generateFortran2003Interface(ostream& oss, const string& className) ; |
---|
| 61 | virtual void generateFortranInterface_hdl_(ostream& oss, const string& className) ; |
---|
| 62 | virtual void generateFortranInterface_hdl(ostream& oss, const string& className) ; |
---|
| 63 | virtual void generateFortranInterface_id(ostream& oss, const string& className) ; |
---|
| 64 | virtual void generateFortranInterfaceGet_hdl_(ostream& oss, const string& className) ; |
---|
| 65 | virtual void generateFortranInterfaceGet_hdl(ostream& oss, const string& className) ; |
---|
| 66 | virtual void generateFortranInterfaceGet_id(ostream& oss, const string& className) ; |
---|
[432] | 67 | virtual void generateFortranInterfaceIsDefined_hdl_(ostream& oss, const string& className) ; |
---|
| 68 | virtual void generateFortranInterfaceIsDefined_hdl(ostream& oss, const string& className) ; |
---|
| 69 | virtual void generateFortranInterfaceIsDefined_id(ostream& oss, const string& className) ; |
---|
[219] | 70 | |
---|
| 71 | protected : |
---|
| 72 | |
---|
| 73 | /// Constructeurs /// |
---|
| 74 | CAttributeMap(void); |
---|
| 75 | CAttributeMap(const xios_map<StdString, CAttribute*> & umap); // Never implemented. |
---|
| 76 | CAttributeMap(const xios_map<StdString, CAttribute*> * const umap); // Not implemented. |
---|
| 77 | |
---|
| 78 | /// Propriété statique /// |
---|
| 79 | static CAttributeMap * Current; |
---|
| 80 | |
---|
| 81 | }; // class CAttributeMap |
---|
| 82 | |
---|
[1009] | 83 | inline bool CAttributeMap::hasAttribute(const StdString& key) const |
---|
| 84 | { |
---|
[1158] | 85 | return (this->find(key) != this->end()); |
---|
[1009] | 86 | } |
---|
| 87 | |
---|
[335] | 88 | } // namespace xios |
---|
[219] | 89 | |
---|
[591] | 90 | #endif // __XIOS_CAttributeMap__ |
---|