Changeset 748 for XIOS/trunk/src/type/type_impl.hpp
- Timestamp:
- 10/21/15 13:40:57 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/trunk/src/type/type_impl.hpp
r680 r748 13 13 namespace xios 14 14 { 15 15 16 16 using namespace std; 17 17 18 18 template <typename T> 19 19 CType<T>::CType(void) … … 21 21 empty=true ; 22 22 } 23 23 24 24 template <typename T> 25 25 CType<T>::CType(const T& val) … … 28 28 set(val) ; 29 29 } 30 30 31 31 template <typename T> 32 32 CType<T>::CType(const CType<T>& type) … … 41 41 empty=true ; 42 42 set(type) ; 43 } 44 43 } 44 45 45 template <typename T> 46 46 void CType<T>::set(const T& val) 47 47 { 48 if (empty) 49 { 48 if (empty) 49 { 50 50 ptrValue = new T(val) ; 51 51 empty=false ; … … 61 61 { 62 62 if (empty) 63 { 63 { 64 64 ptrValue = new T(*type.ptrValue) ; 65 65 empty=false ; … … 76 76 { 77 77 if (empty) 78 { 78 { 79 79 ptrValue = new T(*type.ptrValue) ; 80 80 empty=false ; … … 97 97 return *ptrValue ; 98 98 } 99 99 100 100 template <typename T> 101 101 CType<T>& CType<T>::operator = (const T& val) … … 104 104 return *this ; 105 105 } 106 106 107 107 template <typename T> 108 108 CType<T>& CType<T>::operator = (const CType<T>& type) … … 111 111 return *this ; 112 112 } 113 113 114 114 template <typename T> 115 115 CType<T>& CType<T>::operator = (const CType_ref<T>& type) … … 118 118 return *this ; 119 119 } 120 120 121 121 template <typename T> 122 122 CType<T>::operator T&() 123 { 124 checkEmpty(); 125 return *ptrValue ; 126 } 127 128 template <typename T> 129 CType<T>::operator const T&() const 123 130 { 124 131 checkEmpty(); … … 133 140 } 134 141 135 142 136 143 template <typename T> 137 144 void CType<T>::_fromString(const string& str) … … 147 154 return sizeof(T) ; 148 155 } 149 156 150 157 template <typename T> 151 158 bool CType<T>::_isEmpty(void) const … … 153 160 return empty ; 154 161 } 155 162 156 163 template <typename T> 157 164 string CType<T>::_toString(void) const … … 162 169 return oss.str() ; 163 170 } 164 171 165 172 template <typename T> 166 173 bool CType<T>::_toBuffer(CBufferOut& buffer) const … … 169 176 return buffer.put(*ptrValue) ; 170 177 } 171 178 172 179 template <typename T> 173 180 bool CType<T>::_fromBuffer(CBufferIn& buffer) … … 176 183 return buffer.get(*ptrValue) ; 177 184 } 178 185 179 186 180 187 template <typename T> 181 188 void CType<T>::allocate(void) 182 189 { 183 if (empty) 190 if (empty) 184 191 { 185 192 ptrValue = new T ; … … 187 194 } 188 195 } 189 196 190 197 template <typename T> 191 198 void CType<T>::_reset(void) 192 199 { 193 if (!empty) 200 if (!empty) 194 201 { 195 202 delete ptrValue ; … … 197 204 } 198 205 } 199 206 200 207 template <typename T> 201 208 void CType<T>::checkEmpty(void) const 202 209 { 203 210 if (empty) ERROR("template <typename T> void CType<T>::checkEmpty(void) const", << "Data is not initialized") ; 204 } 205 206 211 } 212 213 207 214 template <typename T> 208 215 CBufferOut& operator<<(CBufferOut& buffer, const CType<T>& type)
Note: See TracChangeset
for help on using the changeset viewer.