Ignore:
Timestamp:
10/15/10 11:16:12 (14 years ago)
Author:
hozdoba
Message:

Pour sauvegarde

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XMLIO_V2/dev/dev_rv/src/XMLIO/context.hpp

    r132 r134  
    55namespace XMLIOSERVER 
    66{ 
     7   class DataTreatment; 
     8 
    79   class Context : public ObjectTemplate<Context> 
    810   { 
     
    1012 
    1113         Context(void) 
    12             : ObjectTemplate<Context>(), ccalendar(NULL), 
     14            : ObjectTemplate<Context>(), 
     15              dtreatment(NULL), ccalendar(NULL), 
    1316              fieldDef(NULL), fileDef(NULL), axisDef(NULL), gridDef(NULL), domainDef(NULL) 
    14          {/* Ne rien faire de plus */} 
     17         { /* Ne rien faire de plus */ } 
    1518 
    1619         Context(const string& _id) 
    17             : ObjectTemplate<Context>(_id), ccalendar(NULL), 
     20            : ObjectTemplate<Context>(_id), 
     21              dtreatment(NULL), ccalendar(NULL), 
    1822              fieldDef(NULL), fileDef(NULL), axisDef(NULL), gridDef(NULL), domainDef(NULL) 
    19          {/* Ne rien faire de plus */} 
    20  
    21          FieldDefinition * getFieldDefinition (void) const { return (this->fieldDef ); } 
    22          FileDefinition  * getFileDefinition  (void) const { return (this->fileDef  ); } 
    23          AxisDefinition  * getAxisDefinition  (void) const { return (this->axisDef  ); } 
    24          GridDefinition  * getGridDefinition  (void) const { return (this->gridDef  ); } 
     23         { /* Ne rien faire de plus */ } 
     24 
     25          FieldDefinition * getFieldDefinition (void) const { return (this->fieldDef ); } 
     26           FileDefinition * getFileDefinition  (void) const { return (this->fileDef  ); } 
     27           AxisDefinition * getAxisDefinition  (void) const { return (this->axisDef  ); } 
     28           GridDefinition * getGridDefinition  (void) const { return (this->gridDef  ); } 
    2529         DomainDefinition * getDomainDefinition(void) const { return (this->domainDef); } 
    2630 
    27          AbstractCalendar * getCalendar(void) const { return (this->ccalendar ); } 
     31         AbstractCalendar * getCalendar     (void) const { return (ccalendar ); } 
     32         DataTreatment    * getDataTreatment(void) const { return (dtreatment); } 
    2833 
    2934         AbstractCalendar * setCalendar(const string& _calName, const string& _dateStr) 
    3035         { 
     36            if(ccalendar  !=  NULL) delete ccalendar; 
     37 
    3138            if (_calName.compare("D360")      == 0) 
    3239               return (ccalendar = new D360Calendar(_dateStr)); 
     
    4552         } 
    4653 
    47          ~Context(void) 
     54         template <class T> 
     55            DataTreatment * setDataTreatment(void) 
     56         { return (dtreatment = (ccalendar == NULL)? NULL : new T(this)); } 
     57 
     58      public : /* virtual */ 
     59 
     60         virtual ~Context(void) 
    4861         { 
    4962            // Désallocation dynamique de mémoire pour chacun des groupes de définition si nécessaire. 
    50             if(fieldDef  != NULL) delete fieldDef ; if(fileDef  != NULL) delete fileDef ; 
    51             if(axisDef   != NULL) delete axisDef  ; if(gridDef  != NULL) delete gridDef ; 
     63            if( fieldDef != NULL) delete  fieldDef ; if(fileDef  != NULL) delete fileDef ; 
     64            if(  axisDef != NULL) delete   axisDef ; if(gridDef  != NULL) delete gridDef ; 
    5265            if(domainDef != NULL) delete domainDef ; 
    5366 
    5467            // Désallocation dynamique de mémoire pour le calendrier associé au contexte courant si nécessaire. 
    55             if(ccalendar !=  NULL) delete ccalendar; 
    56          } 
    57  
    58       public : /* virtual */ 
     68            if(ccalendar  !=  NULL) delete ccalendar; 
     69            // INFO La mémoire dédiée à dtreatment est désallouée ailleurs. 
     70         } 
    5971 
    6072         virtual void parse (XMLNode& _node) 
     
    117129         virtual void printChild(ostream& out) const 
    118130         { 
    119             if(fieldDef  != NULL) out << *(FieldGroup*)       fieldDef << std::endl; 
    120             if(fileDef   != NULL) out << *(FileGroup*)        fileDef  << std::endl; 
    121             if(axisDef   != NULL) out << *(AxisDefinition*)   axisDef  << std::endl; 
    122             if(gridDef   != NULL) out << *(GridDefinition*)   gridDef  << std::endl; 
     131            if( fieldDef != NULL) out << *( FieldDefinition*)  fieldDef << std::endl; 
     132            if(  fileDef != NULL) out << *(  FileDefinition*)   fileDef << std::endl; 
     133            if(  axisDef != NULL) out << *(  AxisDefinition*)   axisDef << std::endl; 
     134            if(  gridDef != NULL) out << *(  GridDefinition*)   gridDef << std::endl; 
    123135            if(domainDef != NULL) out << *(DomainDefinition*) domainDef << std::endl; 
    124136         } 
     
    128140            if (_parent != 0) return; 
    129141            // Résolution des héritages descendants pour chacun des groupes de définitions. 
    130             if(fieldDef  != NULL) fieldDef ->solveDescInheritance(); 
    131             if(fileDef   != NULL) fileDef  ->solveDescInheritance(); 
    132             if(axisDef   != NULL) axisDef  ->solveDescInheritance(); 
    133             if(gridDef   != NULL) gridDef  ->solveDescInheritance(); 
     142            if( fieldDef != NULL)  fieldDef->solveDescInheritance(); 
     143            if(  fileDef != NULL)   fileDef->solveDescInheritance(); 
     144            if(  axisDef != NULL)   axisDef->solveDescInheritance(); 
     145            if(  gridDef != NULL)   gridDef->solveDescInheritance(); 
    134146            if(domainDef != NULL) domainDef->solveDescInheritance(); 
    135147         } 
     
    176188            Poco::HashMap<string, StrHashMap<Context> >::Iterator it; 
    177189 
    178             for ( it = AllListContext.begin(); it != AllListContext.end(); it++) 
     190            for ( it  = AllListContext.begin(); 
     191                  it != AllListContext.end(); it++) 
    179192            { 
    180193               // Résolution des héritages descendants (càd des héritages de groupes) pour chacun des contextes. 
     
    192205 
    193206         static bool HasContext(const string& id) 
    194          { 
    195             Poco::HashMap<string, StrHashMap<Context> > &AllListContext = Context::GetAllListObject(); 
    196             return (AllListContext.find(id) != AllListContext.end()); 
    197          } 
     207         { return (Context::GetAllListObject().find(id) != Context::GetAllListObject().end()); } 
    198208 
    199209         static Context* GetContext(const string& id) 
    200210         { return (Context::GetAllListObject()[id][id]); } 
    201211 
     212         static const std::stack<string>& GetStackContextId(void) 
     213         { return (Context::Stid); } 
     214 
     215         static Context* GetCurrentContext(void) 
     216         { return (Context::GetObject(Context::GetCurrentContextId())); } 
     217 
    202218         static Context* SwapContext(void) 
    203219         { 
     
    210226            return (Context::GetObject(lastId)); 
    211227         } 
    212  
    213          static const std::stack<string>& GetStackContextId(void) 
    214          { return (Context::Stid); } 
    215  
    216          static Context* GetCurrentContext(void) 
    217          { return (Context::GetObject(Context::GetCurrentContextId())); } 
    218228 
    219229         static void SetCurrentContext(const string& id, bool withSwap = false, bool withcheck = true) 
     
    248258         static std::stack<string> Stid; 
    249259 
     260         DataTreatment    * dtreatment; 
    250261         AbstractCalendar * ccalendar; 
    251262 
    252          FieldDefinition * fieldDef; 
    253          FileDefinition  * fileDef; 
    254          AxisDefinition  * axisDef; 
    255          GridDefinition  * gridDef; 
     263          FieldDefinition * fieldDef; 
     264           FileDefinition * fileDef; 
     265           AxisDefinition * axisDef; 
     266           GridDefinition * gridDef; 
    256267         DomainDefinition * domainDef; 
    257268 
Note: See TracChangeset for help on using the changeset viewer.