[369] | 1 | #ifndef __XIOS_ATTRIBUTE_ARRAY_IMPL_HPP__ |
---|
| 2 | #define __XIOS_ATTRIBUTE_ARRAY_IMPL_HPP__ |
---|
| 3 | |
---|
| 4 | #include "buffer_in.hpp" |
---|
| 5 | #include "buffer_out.hpp" |
---|
| 6 | #include "generate_interface.hpp" |
---|
| 7 | #include "attribute_array.hpp" |
---|
| 8 | |
---|
| 9 | |
---|
| 10 | namespace xios |
---|
| 11 | { |
---|
| 12 | /// ////////////////////// Définitions ////////////////////// /// |
---|
| 13 | template <typename T_numtype, int N_rank> |
---|
| 14 | CAttributeArray<T_numtype, N_rank>::CAttributeArray(const StdString & id) |
---|
| 15 | : CAttribute(id) |
---|
| 16 | { /* Ne rien faire de plus */ } |
---|
| 17 | |
---|
| 18 | template <typename T_numtype, int N_rank> |
---|
| 19 | CAttributeArray<T_numtype,N_rank>::CAttributeArray(const StdString & id, const CArray<T_numtype,N_rank>& value) |
---|
| 20 | : CAttribute(id) |
---|
| 21 | { |
---|
| 22 | this->setValue(value); |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | template <typename T_numtype, int N_rank> |
---|
| 26 | CAttributeArray<T_numtype, N_rank>::CAttributeArray(const StdString & id, xios_map<StdString, CAttribute*> & umap) |
---|
| 27 | : CAttribute(id) |
---|
| 28 | { |
---|
| 29 | umap.insert(umap.end(), std::make_pair(id, this)); |
---|
| 30 | } |
---|
| 31 | |
---|
| 32 | template <typename T_numtype, int N_rank> |
---|
| 33 | CAttributeArray<T_numtype, N_rank>::CAttributeArray (const StdString & id, const CArray<T_numtype,N_rank>& value, |
---|
| 34 | xios_map<StdString, CAttribute*> & umap) |
---|
| 35 | : CAttribute(id) |
---|
| 36 | { |
---|
| 37 | this->setValue(value); |
---|
| 38 | umap.insert(umap.end(), std::make_pair(id, this)); |
---|
| 39 | } |
---|
| 40 | |
---|
| 41 | ///-------------------------------------------------------------- |
---|
| 42 | |
---|
| 43 | template <typename T_numtype, int N_rank> |
---|
| 44 | CArray<T_numtype,N_rank> CAttributeArray<T_numtype, N_rank>::getValue(void) const |
---|
| 45 | { |
---|
| 46 | return this->copy() ; |
---|
| 47 | } |
---|
| 48 | |
---|
| 49 | template <typename T_numtype, int N_rank> |
---|
| 50 | void CAttributeArray<T_numtype,N_rank>::setValue(const CArray<T_numtype,N_rank>& value) |
---|
| 51 | { |
---|
| 52 | this->resize(value.shape()) ; |
---|
| 53 | *this=value ; |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | template <typename T_numtype, int N_rank> |
---|
| 57 | void CAttributeArray<T_numtype,N_rank>::set(const CAttribute& attr) |
---|
| 58 | { |
---|
| 59 | this->set(dynamic_cast<const CAttributeArray<T_numtype,N_rank>& >(attr)) ; |
---|
| 60 | } |
---|
| 61 | |
---|
| 62 | template <typename T_numtype, int N_rank> |
---|
| 63 | void CAttributeArray<T_numtype,N_rank>::set(const CAttributeArray& attr) |
---|
| 64 | { |
---|
| 65 | this->setValue(attr) ; |
---|
| 66 | } |
---|
| 67 | |
---|
| 68 | template <typename T_numtype, int N_rank> |
---|
| 69 | StdString CAttributeArray<T_numtype,N_rank>::_toString(void) const |
---|
| 70 | { |
---|
| 71 | StdOStringStream oss; |
---|
| 72 | if (! isEmpty() && this->hasId()) oss << this->getName() << "=\"" << CArray<T_numtype, N_rank>::toString() << "\""; |
---|
| 73 | return (oss.str()); |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | template <typename T_numtype, int N_rank> |
---|
| 77 | void CAttributeArray<T_numtype, N_rank>::_fromString(const StdString & str) |
---|
| 78 | { |
---|
| 79 | CArray<T_numtype, N_rank>::fromString(str) ; |
---|
| 80 | } |
---|
| 81 | |
---|
| 82 | template <typename T_numtype, int N_rank> |
---|
| 83 | bool CAttributeArray<T_numtype, N_rank>::_toBuffer (CBufferOut& buffer) const |
---|
| 84 | { |
---|
| 85 | return CArray<T_numtype, N_rank>::toBuffer(buffer) ; |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | template <typename T_numtype, int N_rank> |
---|
| 89 | bool CAttributeArray<T_numtype, N_rank>::_fromBuffer(CBufferIn& buffer) |
---|
| 90 | { |
---|
| 91 | return CArray<T_numtype, N_rank>::fromBuffer(buffer) ; |
---|
| 92 | } |
---|
| 93 | |
---|
| 94 | template <typename T_numtype, int N_rank> |
---|
| 95 | void CAttributeArray<T_numtype, N_rank>::generateCInterface(ostream& oss,const string& className) |
---|
| 96 | { |
---|
| 97 | CInterface::AttributeCInterface<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ; |
---|
| 98 | } |
---|
| 99 | |
---|
| 100 | template <typename T_numtype, int N_rank> |
---|
| 101 | void CAttributeArray<T_numtype, N_rank>::generateFortran2003Interface(ostream& oss,const string& className) |
---|
| 102 | { |
---|
| 103 | CInterface::AttributeFortran2003Interface<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ; |
---|
| 104 | } |
---|
| 105 | |
---|
| 106 | template <typename T_numtype, int N_rank> |
---|
| 107 | void CAttributeArray<T_numtype, N_rank>::generateFortranInterfaceDeclaration_(ostream& oss,const string& className) |
---|
| 108 | { |
---|
| 109 | CInterface::AttributeFortranInterfaceDeclaration<CArray<T_numtype, N_rank> >(oss, className, this->getName()+"_") ; |
---|
| 110 | } |
---|
| 111 | |
---|
| 112 | template <typename T_numtype, int N_rank> |
---|
| 113 | void CAttributeArray<T_numtype, N_rank>::generateFortranInterfaceBody_(ostream& oss,const string& className) |
---|
| 114 | { |
---|
| 115 | CInterface::AttributeFortranInterfaceBody<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ; |
---|
| 116 | } |
---|
| 117 | |
---|
| 118 | template <typename T_numtype, int N_rank> |
---|
| 119 | void CAttributeArray<T_numtype, N_rank>::generateFortranInterfaceDeclaration(ostream& oss,const string& className) |
---|
| 120 | { |
---|
| 121 | CInterface::AttributeFortranInterfaceDeclaration<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ; |
---|
| 122 | } |
---|
| 123 | |
---|
| 124 | template <typename T_numtype, int N_rank> |
---|
| 125 | void CAttributeArray<T_numtype, N_rank>::generateFortranInterfaceGetDeclaration_(ostream& oss,const string& className) |
---|
| 126 | { |
---|
| 127 | CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T_numtype, N_rank> >(oss, className, this->getName()+"_") ; |
---|
| 128 | } |
---|
| 129 | |
---|
| 130 | template <typename T_numtype, int N_rank> |
---|
| 131 | void CAttributeArray<T_numtype, N_rank>::generateFortranInterfaceGetBody_(ostream& oss,const string& className) |
---|
| 132 | { |
---|
| 133 | CInterface::AttributeFortranInterfaceGetBody<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ; |
---|
| 134 | } |
---|
| 135 | |
---|
| 136 | template <typename T_numtype, int N_rank> |
---|
| 137 | void CAttributeArray<T_numtype, N_rank>::generateFortranInterfaceGetDeclaration(ostream& oss,const string& className) |
---|
| 138 | { |
---|
| 139 | CInterface::AttributeFortranInterfaceGetDeclaration<CArray<T_numtype, N_rank> >(oss, className, this->getName()) ; |
---|
| 140 | } |
---|
| 141 | } // namespace xios |
---|
| 142 | |
---|
| 143 | #endif // __XIOS_ATTRIBUTE_ENUM_IMPL_HPP__ |
---|