Changeset 206
- Timestamp:
- 05/30/11 15:17:48 (13 years ago)
- Location:
- XMLIO_V2/dev/dev_rv/src/xmlio
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/dev_rv/src/xmlio/attribute_map.cpp
r173 r206 16 16 17 17 ///-------------------------------------------------------------- 18 18 19 void CAttributeMap::clearAllAttributes(void) 20 { 21 typedef std::pair<StdString, CAttribute*> StdStrAttPair; 22 SuperClassMap::const_iterator it = SuperClassMap::begin(), end = SuperClassMap::end(); 23 for (; it != end; it++) 24 { 25 const StdStrAttPair & att = *it; 26 if (!att.second->isEmpty()) 27 att.second->clear(); 28 } 29 } 30 31 //--------------------------------------------------------------- 32 19 33 bool CAttributeMap::hasAttribute(const StdString & key) const 20 34 { -
XMLIO_V2/dev/dev_rv/src/xmlio/attribute_map.hpp
r180 r206 33 33 void setAttributes(const CAttributeMap * const _parent); 34 34 35 void clearAllAttributes(void); 36 35 37 /// Destructeur /// 36 38 virtual ~CAttributeMap(void); -
XMLIO_V2/dev/dev_rv/src/xmlio/data_treatment.cpp
r188 r206 59 59 this->solveAllOperation(); 60 60 61 // Nettoyage de l'arborescence 62 CContext::CleanTree(); 63 61 64 //std::cout << "(Message temporaire) fin traitement sorties ..." << std::endl; 62 65 } -
XMLIO_V2/dev/dev_rv/src/xmlio/node/context.cpp
r202 r206 277 277 } 278 278 279 //---------------------------------------------------------------- 280 281 void CContext::CleanTree(void) 282 { 283 #define DECLARE_NODE(Name_, name_) C##Name_##Group::ClearAllAttributes(); 284 #define DECLARE_NODE_PAR(Name_, name_) 285 #include "node_type.conf" 286 } 279 287 ///--------------------------------------------------------------- 280 288 -
XMLIO_V2/dev/dev_rv/src/xmlio/node/context.hpp
r202 r206 86 86 /// Autres méthodes statiques /// 87 87 static void ShowTree(StdOStream & out = std::clog); 88 static void CleanTree(void); 88 89 89 90 /// Test /// -
XMLIO_V2/dev/dev_rv/src/xmlio/node/field.cpp
r205 r206 6 6 7 7 #include "node_type.hpp" 8 8 #include "calendar_util.hpp" 9 9 #include "xios_manager.hpp" 10 10 … … 19 19 , grid(), file() 20 20 , freq_operation(), freq_write() 21 , last_Write(), last_operation() 21 22 , foperation() 22 23 , data() … … 28 29 , grid(), file() 29 30 , freq_operation(), freq_write() 31 , last_Write(), last_operation() 30 32 , foperation() 31 33 , data() … … 42 44 //---------------------------------------------------------------- 43 45 46 bool CField::updateDataServer 47 (const date::CDate & currDate, const std::deque<ARRAY(double, 1)> storedClient) 48 { 49 if ((*last_operation + freq_operation) >= currDate) 50 { 51 ARRAY_CREATE(input, double, 1, [0]); 52 this->grid->inputFieldServer(storedClient, input); 53 (*this->foperation)(input); 54 *last_operation = currDate; 55 } 56 57 if ((*last_Write + freq_write) >= currDate) 58 { 59 *last_Write = currDate; 60 return (true); 61 } 62 return (false); 63 } 64 65 //---------------------------------------------------------------- 66 44 67 void CField::setRelFile(const boost::shared_ptr<CFile> _file) 45 68 { … … 132 155 //---------------------------------------------------------------- 133 156 134 ARRAY(double, 1) 157 ARRAY(double, 1) CField::getData(void) const 135 158 { 136 159 return(this->data); 160 } 161 162 //---------------------------------------------------------------- 163 164 boost::shared_ptr<date::CDate> CField::getLastWriteDate(void) const 165 { 166 return(this->last_Write); 167 } 168 169 //---------------------------------------------------------------- 170 171 boost::shared_ptr<date::CDate> CField::getLastOperationDate(void) const 172 { 173 return(this->last_operation); 137 174 } 138 175 … … 173 210 using namespace date; 174 211 175 StdString id = this->getBaseFieldReference()->getId(); 212 StdString id = this->getBaseFieldReference()->getId(); 213 boost::shared_ptr<CContext> _context = 214 CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()); 215 176 216 if (operation.isEmpty() || freq_op.isEmpty() || this->file->output_freq.isEmpty()) 177 217 { … … 187 227 this->freq_write = 188 228 CDuration::FromString(this->file->output_freq.getValue()); 229 this->last_Write = boost::shared_ptr<xmlioserver::date::CDate> 230 (new date::CDate(_context->getCalendar()->getInitDate())); 231 this->last_operation = boost::shared_ptr<xmlioserver::date::CDate> 232 (new date::CDate(_context->getCalendar()->getInitDate())); 189 233 this->foperation = 190 234 boost::shared_ptr<func::CFunctor>(new CInstant(this->data)); … … 194 238 this->freq_operation = CDuration::FromString(freq_op.getValue()); 195 239 this->freq_write = CDuration::FromString(this->file->output_freq.getValue()); 240 this->last_Write = boost::shared_ptr<xmlioserver::date::CDate> 241 (new date::CDate(_context->getCalendar()->getInitDate())); 242 this->last_operation = boost::shared_ptr<xmlioserver::date::CDate> 243 (new date::CDate(_context->getCalendar()->getInitDate())); 196 244 197 245 #define DECLARE_FUNCTOR(MType, mtype) \ -
XMLIO_V2/dev/dev_rv/src/xmlio/node/field.hpp
r188 r206 8 8 #include "functor_type.hpp" 9 9 #include "duration.hpp" 10 #include "date.hpp" 10 11 #include "declare_group.hpp" 11 12 … … 62 63 const date::CDuration & getFreqOperation(void) const; 63 64 const date::CDuration & getFreqWrite(void) const; 64 65 66 boost::shared_ptr<date::CDate> getLastWriteDate(void) const; 67 boost::shared_ptr<date::CDate> getLastOperationDate(void) const; 68 65 69 boost::shared_ptr<func::CFunctor> getFieldOperation(void) const; 66 70 … … 71 75 /// Mutateur /// 72 76 void setRelFile(const boost::shared_ptr<CFile> _file); 77 78 template <StdSize N> 79 inline bool updateData 80 (const date::CDate & currDate, const ARRAY(double, N) data); 81 82 bool updateDataServer 83 (const date::CDate & currDate, const std::deque<ARRAY(double, 1)> storedClient); 73 84 74 85 public : … … 103 114 104 115 date::CDuration freq_operation, freq_write; 116 117 boost::shared_ptr<date::CDate> last_Write, last_operation; 105 118 boost::shared_ptr<func::CFunctor> foperation; 106 119 … … 121 134 void CGroupTemplate<CField, CFieldGroup, CFieldAttributes>::solveRefInheritance(void); 122 135 136 ///----------------------------------------------------------------- 137 } // namespace xmlioserver 138 139 #include "grid.hpp" 140 141 namespace xmlioserver { 142 namespace tree { 143 144 template <StdSize N> 145 bool CField::updateData(const date::CDate & currDate, const ARRAY(double, N) data) 146 { 147 if ((*last_operation + freq_operation) >= currDate) 148 { 149 ARRAY_CREATE(input, double, 1, [0]); 150 input->resize(boost::extents[data->size()]); 151 this->grid->inputField(data, input); 152 (*this->foperation)(input); 153 *last_operation = currDate; 154 } 155 156 if ((*last_Write + freq_write) >= currDate) 157 { 158 *last_Write = currDate; 159 return (true); 160 } 161 return (false); 162 }; 163 164 } // namespace tree 123 165 } // namespace xmlioserver 124 166 -
XMLIO_V2/dev/dev_rv/src/xmlio/object_template.hpp
r172 r206 44 44 virtual void solveDescInheritance(const CAttributeMap * const parent = 0); 45 45 46 /// Traitement statique /// 47 static void ClearAllAttributes(void); 48 46 49 /// Accesseur statique /// 47 50 static std::vector<boost::shared_ptr<DerivedType> > & -
XMLIO_V2/dev/dev_rv/src/xmlio/object_template_impl.hpp
r173 r206 117 117 } 118 118 119 //--------------------------------------------------------------- 120 121 template <class T> 122 void CObjectTemplate<T>::ClearAllAttributes(void) 123 { 124 std::vector<boost::shared_ptr<T> > & avect = 125 CObjectTemplate<T>::GetAllVectobject(CObjectFactory::GetCurrentContextId()); 126 typename std::vector<boost::shared_ptr<T> >::iterator 127 it = avect.begin(), end = avect.end(); 128 129 for (;it != end; it++) 130 { 131 CAttributeMap & amap = **it; 132 amap.clearAllAttributes(); 133 } 134 } 135 119 136 ///-------------------------------------------------------------- 120 137
Note: See TracChangeset
for help on using the changeset viewer.