Changeset 188
- Timestamp:
- 05/03/11 15:50:52 (14 years ago)
- Location:
- XMLIO_V2/dev/dev_rv/src/xmlio
- Files:
-
- 3 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
XMLIO_V2/dev/dev_rv/src/xmlio/calendar.hpp
r152 r188 58 58 /// Accesseurs /// 59 59 60 const CDuration & getTimeStep(void) const;60 const CDuration & getTimeStep(void) const; 61 61 62 62 const CDate & getInitDate(void) const; 63 63 CDate & getCurrentDate(void); 64 64 65 public : 66 65 67 //------------------------------------------------------------ 66 68 virtual int getMonthLength(const CDate & date) const; -
XMLIO_V2/dev/dev_rv/src/xmlio/data_treatment.cpp
r152 r188 35 35 36 36 void CDataTreatment::doTreatment(void) 37 { 37 { 38 // Résolution du calendrier 39 this->currentContext->solveCalendar(); 40 38 41 // Résolution des héritages pour le context actuel. 39 42 //std::cout << "(Message temporaire) Résolution des héritages ..." << std::endl; -
XMLIO_V2/dev/dev_rv/src/xmlio/date.cpp
r152 r188 143 143 //---------------------------------------------------------------- 144 144 145 CDate FromString(const StdString & str, const CCalendar & calendar)145 CDate CDate::FromString(const StdString & str, const CCalendar & calendar) 146 146 { 147 147 CDate dt(calendar); … … 150 150 return dt; 151 151 } 152 153 //---------------------------------------------------------------- 154 155 StdString CDate::toString(void) const 156 { 157 StdOStringStream oss; 158 oss << (*this); 159 return (oss.str()); 160 } 152 161 153 162 ///--------------------------------------------------------------- -
XMLIO_V2/dev/dev_rv/src/xmlio/date/d360.hpp
r152 r188 22 22 CD360Calendar(const StdString & dateStr); 23 23 CD360Calendar(int yr = 0, int mth = 1, int d = 1, 24 24 int hr = 0, int min = 0, int sec = 0); 25 25 CD360Calendar(const CD360Calendar & calendar); // Not implemented yet. 26 26 CD360Calendar(const CD360Calendar * calendar); // Not implemented yet. -
XMLIO_V2/dev/dev_rv/src/xmlio/iface/interface.cpp.in
r179 r188 6 6 INCLUDE "object_template_impl.hpp" 7 7 INCLUDE "group_template_impl.hpp" 8 9 INCLUDE "calendar_type.hpp" 8 10 9 11 #ifdef __cplusplus … … 163 165 boost::shared_ptr<CContext> context = CTreeManager::CreateContext(__ctxt_id); 164 166 *_ctxt = context.get(); 167 switch(_calType) 168 { 169 case (D360) : 170 context->setCalendar(boost::shared_ptr<date::CCalendar> 171 (new date::CD360Calendar(yr, mth, dd, hr, min, sec))); 172 break; 173 case (ALLLEAP) : 174 context->setCalendar(boost::shared_ptr<date::CCalendar> 175 (new date::CAllLeapCalendar(yr, mth, dd, hr, min, sec))); 176 break; 177 case (NOLEAP) : 178 context->setCalendar(boost::shared_ptr<date::CCalendar> 179 (new date::CNoLeapCalendar(yr, mth, dd, hr, min, sec))); 180 break; 181 case (JULIAN) : 182 context->setCalendar(boost::shared_ptr<date::CCalendar> 183 (new date::CJulianCalendar(yr, mth, dd, hr, min, sec))); 184 break; 185 case (GREGORIAN): 186 context->setCalendar(boost::shared_ptr<date::CCalendar> 187 (new date::CGregorianCalendar(yr, mth, dd, hr, min, sec))); 188 break; 189 default: 190 std::cerr << "Le calendrier n'est pas identifié" << std::endl; 191 exit (EXIT_FAILURE); 192 } 165 193 } 166 194 catch (CException & exc) -
XMLIO_V2/dev/dev_rv/src/xmlio/node/context.cpp
r173 r188 7 7 #include "group_template_impl.hpp" 8 8 9 #include "calendar_type.hpp" 10 9 11 namespace xmlioserver { 10 12 namespace tree { … … 14 16 CContext::CContext(void) 15 17 : CObjectTemplate<CContext>(), CContextAttributes() 18 , calendar() 16 19 { /* Ne rien faire de plus */ } 17 20 18 21 CContext::CContext(const StdString & id) 19 22 : CObjectTemplate<CContext>(id), CContextAttributes() 23 , calendar() 20 24 { /* Ne rien faire de plus */ } 21 25 … … 37 41 return (group_context); 38 42 } 39 43 44 //---------------------------------------------------------------- 45 46 boost::shared_ptr<date::CCalendar> CContext::getCalendar(void) const 47 { 48 return (this->calendar); 49 } 50 51 //---------------------------------------------------------------- 52 53 void CContext::setCalendar(boost::shared_ptr<date::CCalendar> newCalendar) 54 { 55 this->calendar = newCalendar; 56 calendar_type.setValue(this->calendar->getId()); 57 start_date.setValue(this->calendar->getInitDate().toString()); 58 } 59 60 //---------------------------------------------------------------- 61 62 void CContext::solveCalendar(void) 63 { 64 if (this->calendar.get() != NULL) return; 65 if (calendar_type.isEmpty() || start_date.isEmpty()) 66 ERROR(" CContext::solveCalendar(void)", 67 << "[ context id = " << this->getId() << " ] " 68 << "Impossible de définir un calendrier (un attribut est manquant)."); 69 70 #define DECLARE_CALENDAR(MType , mtype) \ 71 if (calendar_type.getValue().compare(#mtype) == 0) \ 72 { \ 73 this->calendar = boost::shared_ptr<date::CCalendar> \ 74 (new date::C##MType##Calendar(start_date.getValue())); \ 75 return; \ 76 } 77 #include "calendar_type.conf" 78 79 ERROR("CContext::solveCalendar(void)", 80 << "[ calendar_type = " << calendar_type.getValue() << " ] " 81 << "Le calendrier n'est pas définie dans le code !"); 82 } 83 40 84 //---------------------------------------------------------------- 41 85 -
XMLIO_V2/dev/dev_rv/src/xmlio/node/context.hpp
r173 r188 5 5 #include "xmlioserver_spl.hpp" 6 6 #include "node_type.hpp" 7 #include "calendar.hpp" 7 8 8 9 #include "declare_group.hpp" … … 40 41 //--------------------------------------------------------- 41 42 43 public : 44 42 45 /// Constructeurs /// 43 46 CContext(void); … … 51 54 //--------------------------------------------------------- 52 55 56 public : 57 58 /// Mutateurs /// 59 void setCalendar(boost::shared_ptr<date::CCalendar> newCalendar); 60 61 /// Accesseurs /// 62 boost::shared_ptr<date::CCalendar> getCalendar(void) const; 63 53 64 /// Accesseurs statiques /// 54 65 static StdString GetName(void); 55 static StdString GetDefName(void); 56 57 static ENodeType GetType(void); 66 static StdString GetDefName(void); 67 static ENodeType GetType(void); 58 68 59 69 static boost::shared_ptr<CContextGroup> GetContextGroup(void); 70 71 public : 60 72 61 73 /// Traitements /// 62 74 virtual void solveDescInheritance(const CAttributeMap * const parent = 0); 63 75 void solveFieldRefInheritance(void); 76 void solveCalendar(void); 64 77 65 78 /// Autres méthodes statiques /// … … 68 81 /// Test /// 69 82 virtual bool hasChild(void) const; 70 83 84 public : 85 71 86 /// Autres /// 72 87 virtual void parse(xml::CXMLNode & node); … … 75 90 virtual void toBinary (StdOStream & os) const; 76 91 virtual void fromBinary(StdIStream & is); 92 93 private : 94 95 boost::shared_ptr<date::CCalendar> calendar; 77 96 78 97 }; // class CContext -
XMLIO_V2/dev/dev_rv/src/xmlio/node/field.cpp
r187 r188 102 102 return (this->getBaseFieldReference()->getId()); 103 103 } 104 105 //---------------------------------------------------------------- 106 107 const date::CDuration & CField::getFreqOperation(void) const 108 { 109 return (this->freq_operation); 110 } 111 112 //---------------------------------------------------------------- 113 const date::CDuration & CField::getFreqWrite(void) const 114 { 115 return (this->freq_write); 116 } 117 118 //---------------------------------------------------------------- 119 120 boost::shared_ptr<func::CFunctor> CField::getFieldOperation(void) const 121 { 122 return (this->foperation); 123 } 104 124 105 125 //---------------------------------------------------------------- … … 166 186 167 187 #define DECLARE_FUNCTOR(MType, mtype) \ 168 if (operation.getValue().compare(#mtype) == 0){} 188 if (operation.getValue().compare(#mtype) == 0) \ 189 { return; } 169 190 //this->foperation = boost::shared_ptr<func::CFunctor>(new C##MType()); 170 191 171 192 #include "functor_type.conf" 193 194 ERROR("CField::solveOperation(void)", 195 << "[ operation = " << operation.getValue() << "]" 196 << "L'opération n'est pas définie dans le code !"); 172 197 } 173 198 } -
XMLIO_V2/dev/dev_rv/src/xmlio/node/field.hpp
r187 r188 59 59 boost::shared_ptr<CGrid> getRelGrid(void) const ; 60 60 boost::shared_ptr<CFile> getRelFile(void) const ; 61 62 const date::CDuration & getFreqOperation(void) const; 63 const date::CDuration & getFreqWrite(void) const; 64 65 boost::shared_ptr<func::CFunctor> getFieldOperation(void) const; 66 67 ARRAY(double, 1) getData(void) const; 61 68 62 69 const StdString & getBaseFieldId(void) const; -
XMLIO_V2/dev/dev_rv/src/xmlio/node/file.cpp
r174 r188 94 94 { this->vFieldGroup = newVFieldGroup; } 95 95 96 //---------------------------------------------------------------- 97 96 98 void CFile::setVirtualFieldGroup(const StdString & newVFieldGroupId) 97 99 { … … 99 101 (CObjectFactory::CreateObject<CFieldGroup>(newVFieldGroupId)); 100 102 } 103 104 //---------------------------------------------------------------- 101 105 102 106 void CFile::initializeDataOutput(boost::shared_ptr<io::CDataOutput> dout) … … 121 125 this->data_out->definition_end(); 122 126 } 127 128 //---------------------------------------------------------------- 123 129 124 130 void CFile::parse(xml::CXMLNode & node) … … 148 154 } 149 155 150 156 //---------------------------------------------------------------- 157 151 158 void CFile::solveDescInheritance(const CAttributeMap * const parent) 152 159 { … … 154 161 this->getVirtualFieldGroup()->solveDescInheritance(NULL); 155 162 } 163 164 //---------------------------------------------------------------- 156 165 157 166 void CFile::solveFieldRefInheritance(void) … … 163 172 } 164 173 174 //---------------------------------------------------------------- 175 165 176 void CFile::solveEFGridRef(void) 166 177 { … … 168 179 this->enabledFields[i]->solveGridReference(); 169 180 } 181 182 //---------------------------------------------------------------- 170 183 171 184 void CFile::solveEFOperation(void) … … 190 203 } 191 204 205 //---------------------------------------------------------------- 206 192 207 void CFile::fromBinary(StdIStream & is) 193 208 { -
XMLIO_V2/dev/dev_rv/src/xmlio/output/nc4_data_output.hpp
r180 r188 48 48 virtual void writeFile_ (const boost::shared_ptr<tree::CFile> file); 49 49 50 51 protected : 52 50 53 void writeLocalAttributes(int ibegin, int iend, int jbegin, int jend, StdString domid); 51 54
Note: See TracChangeset
for help on using the changeset viewer.