[219] | 1 | #include "attribute.hpp" |
---|
[300] | 2 | #include "base_type.hpp" |
---|
[432] | 3 | #include "generate_interface.hpp" |
---|
[219] | 4 | |
---|
[432] | 5 | |
---|
[335] | 6 | namespace xios |
---|
[219] | 7 | { |
---|
| 8 | /// ////////////////////// Définitions ////////////////////// /// |
---|
| 9 | CAttribute::CAttribute(const StdString & id) |
---|
[300] | 10 | : CObject(id), CBaseType() |
---|
[369] | 11 | // , value() |
---|
[219] | 12 | { /* Ne rien faire de plus */ } |
---|
[369] | 13 | /* |
---|
[219] | 14 | CAttribute::CAttribute(const CAttribute & attribut) |
---|
[300] | 15 | : CObject(attribut.getId()),CBaseType() |
---|
[219] | 16 | { |
---|
[369] | 17 | // this->value = attribut.getAnyValue(); |
---|
[219] | 18 | } |
---|
[369] | 19 | */ |
---|
[219] | 20 | CAttribute::~CAttribute(void) |
---|
| 21 | { /* Ne rien faire de plus */ } |
---|
| 22 | |
---|
| 23 | ///-------------------------------------------------------------- |
---|
[369] | 24 | /* |
---|
[219] | 25 | const boost::any & CAttribute::getAnyValue(void) const |
---|
| 26 | { |
---|
| 27 | return (this->value); |
---|
| 28 | } |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | void CAttribute::setAnyValue(const boost::any & value) |
---|
| 32 | { |
---|
| 33 | this->value = value; |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | void CAttribute::clear(void) |
---|
| 37 | { |
---|
| 38 | this->value = boost::any(); |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | //--------------------------------------------------------------- |
---|
| 42 | |
---|
| 43 | bool CAttribute::isEmpty(void) const |
---|
| 44 | { |
---|
| 45 | return (this->value.empty()); |
---|
| 46 | } |
---|
[369] | 47 | */ |
---|
[219] | 48 | const StdString & CAttribute::getName(void) const |
---|
| 49 | { |
---|
| 50 | return (this->getId()); |
---|
| 51 | } |
---|
[432] | 52 | |
---|
| 53 | void CAttribute::generateCInterfaceIsDefined(ostream& oss, const string& className) |
---|
| 54 | { |
---|
| 55 | CInterface::AttributeIsDefinedCInterface(oss, className, this->getName()) ; |
---|
| 56 | } |
---|
[219] | 57 | |
---|
[432] | 58 | void CAttribute::generateFortran2003InterfaceIsDefined(ostream& oss, const string& className) |
---|
| 59 | { |
---|
| 60 | CInterface::AttributeIsDefinedFortran2003Interface(oss, className, this->getName()) ; |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | |
---|
| 64 | void CAttribute::generateFortranInterfaceIsDefinedDeclaration_(ostream& oss,const string& className) |
---|
| 65 | { |
---|
| 66 | CInterface::AttributeFortranInterfaceIsDefinedDeclaration(oss, className, this->getName()+"_") ; |
---|
| 67 | } |
---|
[300] | 68 | |
---|
[432] | 69 | void CAttribute::generateFortranInterfaceIsDefinedDeclaration(ostream& oss,const string& className) |
---|
| 70 | { |
---|
| 71 | CInterface::AttributeFortranInterfaceIsDefinedDeclaration(oss, className, this->getName()) ; |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | void CAttribute::generateFortranInterfaceIsDefinedBody_(ostream& oss,const string& className) |
---|
| 75 | { |
---|
| 76 | CInterface::AttributeFortranInterfaceIsDefinedBody(oss, className, this->getName()) ; |
---|
| 77 | } |
---|
| 78 | |
---|
[219] | 79 | ///-------------------------------------------------------------- |
---|
| 80 | |
---|
[369] | 81 | |
---|
[345] | 82 | CMessage& operator<<(CMessage& msg,CAttribute& type) |
---|
[300] | 83 | { |
---|
| 84 | msg.push(type) ; |
---|
| 85 | return msg ; |
---|
| 86 | } |
---|
| 87 | |
---|
[680] | 88 | CMessage& operator<<(CMessage& msg, const CAttribute& type) |
---|
[300] | 89 | { |
---|
[369] | 90 | // msg.push(*type.clone()) ; |
---|
[300] | 91 | return msg ; |
---|
| 92 | } |
---|
| 93 | |
---|
[680] | 94 | CBufferOut& operator<<(CBufferOut& buffer, CAttribute& type) |
---|
[300] | 95 | { |
---|
| 96 | |
---|
[680] | 97 | if (!type.toBuffer(buffer)) ERROR("CBufferOut& operator<<(CBufferOut& buffer, CAttribute& type)", |
---|
| 98 | << "Not enough free space in buffer to queue the attribute."); |
---|
[300] | 99 | return buffer ; |
---|
| 100 | } |
---|
| 101 | |
---|
[680] | 102 | CBufferIn& operator>>(CBufferIn& buffer, CAttribute& type) |
---|
[300] | 103 | { |
---|
| 104 | |
---|
[680] | 105 | if (!type.fromBuffer(buffer)) ERROR("CBufferInt& operator>>(CBufferIn& buffer, CAttribute& type)", |
---|
| 106 | << "Not enough data in buffer to unqueue the attribute."); |
---|
[300] | 107 | return buffer ; |
---|
| 108 | } |
---|
| 109 | |
---|
[432] | 110 | |
---|
[335] | 111 | } // namespace xios |
---|