Changeset 1478
- Timestamp:
- 04/12/18 18:51:08 (6 years ago)
- Location:
- XIOS
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/XIOS_DEV_CMIP6/src/attribute_template.hpp
r1219 r1478 52 52 void set(const CAttributeTemplate& attr) ; 53 53 void reset(void) ; 54 void checkEmpty(void) const; 55 54 56 55 57 void setInheritedValue(const CAttributeTemplate& attr ); -
XIOS/dev/XIOS_DEV_CMIP6/src/attribute_template_impl.hpp
r1477 r1478 67 67 } 68 68 69 70 template <class T> 71 T CAttributeTemplate<T>::getValue(void) const 72 { 73 try { 74 return CType<T>::get() ; 75 } 76 catch (xios::CException & exc) 69 template <class T> 70 void CAttributeTemplate<T>::checkEmpty(void) const 71 { 72 if (CType<T>::empty) 77 73 { 78 74 StdString msg("On checking attribute with id="); … … 82 78 ERROR("template <typename T> void CType<T>::checkEmpty(void) const", << msg); 83 79 } 80 } 81 82 83 template <class T> 84 T CAttributeTemplate<T>::getValue(void) const 85 { 86 return CType<T>::get() ; 84 87 85 88 /* -
XIOS/dev/XIOS_DEV_CMIP6/src/type/type.hpp
r1158 r1478 47 47 48 48 void allocate(void) ; 49 v oid checkEmpty(void) const;49 virtual void checkEmpty(void) const {return _checkEmpty();}; 50 50 51 51 T* ptrValue ; … … 63 63 void _reset(void) ; 64 64 bool _isEmpty() const ; 65 void _checkEmpty(void) const; 65 66 size_t _size(void) const ; 66 67 -
XIOS/dev/XIOS_DEV_CMIP6/src/type/type_impl.hpp
r1477 r1478 87 87 T& CType<T>::get(void) 88 88 { 89 checkEmpty();89 this->checkEmpty(); 90 90 return *ptrValue ; 91 91 } … … 94 94 const T& CType<T>::get(void) const 95 95 { 96 checkEmpty();96 this->checkEmpty(); 97 97 return *ptrValue ; 98 98 } … … 122 122 CType<T>::operator T&() 123 123 { 124 try 125 { 126 checkEmpty(); 127 } 128 catch (xios::CException & exc) 129 { 130 StdString msg("Data is not initialized\n"); 131 ERROR("template <typename T> void CType<T>::checkEmpty(void) const", << msg); 132 } 133 134 return *ptrValue ; 124 this->checkEmpty(); 125 return *ptrValue ; 135 126 } 136 127 … … 138 129 CType<T>::operator const T&() const 139 130 { 140 checkEmpty();131 this->checkEmpty(); 141 132 return *ptrValue ; 142 133 } … … 145 136 CType<T>* CType<T>::_clone(void) const 146 137 { 147 checkEmpty();138 this->checkEmpty(); 148 139 return new CType(*this) ; 149 140 } … … 174 165 { 175 166 ostringstream oss; 176 checkEmpty();167 this->checkEmpty(); 177 168 oss<<*ptrValue ; 178 169 return oss.str() ; … … 182 173 bool CType<T>::_toBuffer(CBufferOut& buffer) const 183 174 { 184 checkEmpty();175 this->checkEmpty(); 185 176 return buffer.put(*ptrValue) ; 186 177 } … … 215 206 216 207 template <typename T> 217 void CType<T>::checkEmpty(void) const 218 { 219 // if (empty) ERROR("template <typename T> void CType<T>::checkEmpty(void) const", << "Data is not initialized") ; 220 if (empty) throw CException(); 208 void CType<T>::_checkEmpty(void) const 209 { 210 if (empty) ERROR("template <typename T> void CType<T>::checkEmpty(void) const", << "Data is not initialized") ; 221 211 } 222 212 -
XIOS/trunk/src/attribute_template.hpp
r1117 r1478 52 52 void set(const CAttributeTemplate& attr) ; 53 53 void reset(void) ; 54 void checkEmpty(void) const; 55 54 56 55 57 void setInheritedValue(const CAttributeTemplate& attr ); … … 57 59 T getInheritedValue(void) const ; 58 60 bool hasInheritedValue(void) const; 59 60 bool isEqual_(const CAttributeTemplate& attr ); 61 61 62 bool isEqual(const CAttribute& attr ); 62 63 … … 95 96 // CAttributeTemplate(void); // Not implemented. 96 97 private : 98 bool isEqual_(const CAttributeTemplate& attr); 97 99 StdString _toString(void) const; 98 100 void _fromString(const StdString & str); -
XIOS/trunk/src/attribute_template_impl.hpp
r1477 r1478 67 67 } 68 68 69 70 template <class T> 71 T CAttributeTemplate<T>::getValue(void) const 72 { 73 try { 74 return CType<T>::get() ; 75 } 76 catch (xios::CException & exc) 69 template <class T> 70 void CAttributeTemplate<T>::checkEmpty(void) const 71 { 72 if (CType<T>::empty) 77 73 { 78 74 StdString msg("On checking attribute with id="); … … 82 78 ERROR("template <typename T> void CType<T>::checkEmpty(void) const", << msg); 83 79 } 80 } 81 82 83 template <class T> 84 T CAttributeTemplate<T>::getValue(void) const 85 { 86 return CType<T>::get() ; 84 87 85 88 /* -
XIOS/trunk/src/type/type.hpp
r1107 r1478 47 47 48 48 void allocate(void) ; 49 v oid checkEmpty(void) const;49 virtual void checkEmpty(void) const {return _checkEmpty();}; 50 50 51 51 T* ptrValue ; … … 63 63 void _reset(void) ; 64 64 bool _isEmpty() const ; 65 void _checkEmpty(void) const; 65 66 size_t _size(void) const ; 66 67 -
XIOS/trunk/src/type/type_impl.hpp
r1477 r1478 87 87 T& CType<T>::get(void) 88 88 { 89 checkEmpty();89 this->checkEmpty(); 90 90 return *ptrValue ; 91 91 } … … 94 94 const T& CType<T>::get(void) const 95 95 { 96 checkEmpty();96 this->checkEmpty(); 97 97 return *ptrValue ; 98 98 } … … 122 122 CType<T>::operator T&() 123 123 { 124 try 125 { 126 checkEmpty(); 127 } 128 catch (xios::CException & exc) 129 { 130 StdString msg("Data is not initialized\n"); 131 ERROR("template <typename T> void CType<T>::checkEmpty(void) const", << msg); 132 } 133 134 return *ptrValue ; 124 this->checkEmpty(); 125 return *ptrValue ; 135 126 } 136 127 … … 138 129 CType<T>::operator const T&() const 139 130 { 140 checkEmpty();131 this->checkEmpty(); 141 132 return *ptrValue ; 142 133 } … … 145 136 CType<T>* CType<T>::_clone(void) const 146 137 { 147 checkEmpty();138 this->checkEmpty(); 148 139 return new CType(*this) ; 149 140 } … … 174 165 { 175 166 ostringstream oss; 176 checkEmpty();167 this->checkEmpty(); 177 168 oss<<*ptrValue ; 178 169 return oss.str() ; … … 182 173 bool CType<T>::_toBuffer(CBufferOut& buffer) const 183 174 { 184 checkEmpty();175 this->checkEmpty(); 185 176 return buffer.put(*ptrValue) ; 186 177 } … … 215 206 216 207 template <typename T> 217 void CType<T>::checkEmpty(void) const 218 { 219 // if (empty) ERROR("template <typename T> void CType<T>::checkEmpty(void) const", << "Data is not initialized") ; 220 if (empty) throw CException(); 208 void CType<T>::_checkEmpty(void) const 209 { 210 if (empty) ERROR("template <typename T> void CType<T>::checkEmpty(void) const", << "Data is not initialized") ; 221 211 } 222 212
Note: See TracChangeset
for help on using the changeset viewer.