Ignore:
Timestamp:
09/20/10 17:30:34 (14 years ago)
Author:
hozdoba
Message:

Plusieurs modifications en attendant une version propre et stable.

File:
1 edited

Legend:

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

    r120 r122  
    1111      public: 
    1212 
    13          CFile(void) : ObjectTemplate<CFile>(), FileAttribut(), vfieldGroup(NULL), enabledFields() 
     13         CFile(void) : ObjectTemplate<CFile>(), FileAttribut(), vfieldGroup(NULL), enabledFields(), output(NULL) 
    1414         {/* Ne rien faire de plus */} 
    15          CFile(const string& _id) : ObjectTemplate<CFile>(_id), FileAttribut(), vfieldGroup(NULL), enabledFields() 
     15         CFile(const string& _id) : ObjectTemplate<CFile>(_id), FileAttribut(), vfieldGroup(NULL), enabledFields(), output(NULL) 
    1616         {/* Ne rien faire de plus */} 
    1717 
     
    3636         } 
    3737 
     38         const AbstractDataOutput* getDataOutput(void) const { return (output); } 
     39         void initializeDataOutput(AbstractDataOutput* _output) 
     40         { 
     41            if (_output != NULL) output = _output; 
     42            else throw XMLIOSERVER::XMLIOUndefinedValueException("Impossible d'initialiser la sortie de données pour le fichier nommé '"+ getId() +"'.") ; 
     43         } 
     44 
    3845         void getAllFields(std::vector<CField*>& _allF) const {  if (vfieldGroup!=NULL) vfieldGroup->getAllChildren(_allF); } 
     46         const std::vector<CField*>& getEnabledFields(void) const { return (enabledFields); } 
     47 
     48         const std::set<const CGrid*> getEnabledGrids(void) const 
     49         { 
     50            std::set<const CGrid*> sgrid; 
     51            const std::vector<CField*> enabledFields = getEnabledFields(); 
     52            std::vector<CField*>::const_iterator it; 
     53 
     54            for ( it = enabledFields.begin() ; it != enabledFields.end(); it++ ) 
     55               sgrid.insert((*it)->getGrid()); 
     56 
     57            return (sgrid); 
     58         } 
     59 
     60         const std::set<const CDomain*> getEnabledDomains(void) const 
     61         { 
     62            const std::set<const CGrid*> sgrid = getEnabledGrids(); 
     63            std::set<const CDomain*> sdomain; 
     64 
     65            std::set<const CGrid*>::const_iterator it; 
     66 
     67            for ( it = sgrid.begin() ; it != sgrid.end(); it++ ) 
     68               sdomain.insert((*it)->getRelDomain()); 
     69 
     70            return (sdomain); 
     71         } 
     72 
     73         const std::set<const CAxis*> getEnabledAxis(void) const 
     74         { 
     75            const std::set<const CGrid*> sgrid = getEnabledGrids(); 
     76            std::set<const CAxis*> saxis; 
     77 
     78            std::set<const CGrid*>::const_iterator it; 
     79 
     80            for ( it = sgrid.begin() ; it != sgrid.end(); it++ ) 
     81               saxis.insert((*it)->getRelAxis()); 
     82 
     83            return (saxis); 
     84         } 
    3985 
    4086         virtual bool hasChild(void) const { return (vfieldGroup != NULL); } 
     87         virtual void printChild(ostream& out) const { out << *vfieldGroup << std::endl; } 
    4188 
    42          virtual void printChild(ostream& out) const { out << *vfieldGroup << std::endl; } 
    43          /*{ // Sortie sans affichage des groupes. 
    44             std::vector<CField*> allF; getAllFields(allF); 
    45             for (unsigned int i = 0; i < allF.size(); i++) 
    46                out << *(allF[i]) << std::endl; 
    47          }*/ 
    48  
    49          virtual void resolveDescInheritance(const AttributRegistrar* _parent = 0) 
     89         virtual void resolveDescInheritance(const AttributRegistrar* const _parent = 0) 
    5090         { addAttributes(*_parent); if(vfieldGroup != NULL) vfieldGroup->resolveDescInheritance(); } 
    5191 
     
    65105            getAllFields(enabledFields); 
    66106 
    67             for ( it = enabledFields.begin() ; it < enabledFields.end(); it++ ) 
     107            for ( it = enabledFields.begin() ; it != enabledFields.end(); it++ ) 
    68108            { 
    69109               if ((*it)->enabled.hasValue()) // Si l'attribut 'enabled' est défini ... 
     
    88128                  { enabledFields.erase(it); continue; } 
    89129               } 
    90  
    91130            } 
    92131         } 
    93132 
     133         void solveEFGridRef(void) 
     134         { 
     135            for (unsigned int i = 0; i < enabledFields.size(); i++) 
     136               enabledFields[i]->SolveGridRef(); 
     137         } 
     138 
    94139         virtual  ~CFile(void) 
    95          { if(vfieldGroup != NULL) delete vfieldGroup; } 
     140         { 
     141            if(vfieldGroup != NULL) delete vfieldGroup; 
     142            if(output != NULL) delete output; 
     143         } 
    96144 
    97145      private : 
    98146 
    99147         FieldGroup* vfieldGroup; // FieldGroup "virtuel" 
    100          std::vector<CField*> enabledFields; 
     148         std::vector<CField*> enabledFields; // Liste des champs à sortie dans le fichier courant. 
     149         AbstractDataOutput* output; // Gestion de la sortie des données. 
    101150 
    102151   }; // class CFile 
Note: See TracChangeset for help on using the changeset viewer.