Ignore:
Timestamp:
12/01/21 16:52:24 (3 years ago)
Author:
ymipsl
Message:

tracking memory leak
Elements, views, and connectors are now managed with shared pointer.
YM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.hpp

    r2206 r2267  
    328328 
    329329      private:   
    330         CGridLocalElements* gridLocalElements_= nullptr ; 
     330       shared_ptr<CGridLocalElements> gridLocalElements_= nullptr ; 
    331331        void computeGridLocalElements(void) ; 
    332332      public: 
    333         CGridLocalElements* getGridLocalElements(void) { if (gridLocalElements_==nullptr) computeGridLocalElements() ; return gridLocalElements_ ;} 
    334  
    335       private: 
    336         CGridLocalConnector* modelToWorkflowConnector_ = nullptr ; 
     333        shared_ptr<CGridLocalElements> getGridLocalElements(void) { if (gridLocalElements_==nullptr) computeGridLocalElements() ; return gridLocalElements_ ;} 
     334 
     335      private: 
     336        shared_ptr<CGridLocalConnector> modelToWorkflowConnector_ = nullptr ; 
    337337      public: 
    338338        void computeModelToWorkflowConnector(void) ; 
    339         CGridLocalConnector* getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_;} 
    340  
    341       private: 
    342         CGridLocalConnector* workflowToModelConnector_ = nullptr; 
     339        shared_ptr<CGridLocalConnector> getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_;} 
     340 
     341      private: 
     342        shared_ptr<CGridLocalConnector> workflowToModelConnector_ = nullptr; 
    343343      public: 
    344344        void computeWorkflowToModelConnector(void) ; 
    345         CGridLocalConnector* getWorkflowToModelConnector(void) { if (workflowToModelConnector_==nullptr) computeWorkflowToModelConnector() ; return workflowToModelConnector_;} 
     345        shared_ptr<CGridLocalConnector> getWorkflowToModelConnector(void) { if (workflowToModelConnector_==nullptr) computeWorkflowToModelConnector() ; return workflowToModelConnector_;} 
    346346 
    347347      public: //?  
     
    350350             
    351351      private: 
    352         CGridLocalConnector* workflowToFullConnector_ = nullptr; 
     352        shared_ptr<CGridLocalConnector> workflowToFullConnector_ = nullptr; 
    353353      public: 
    354354        void computeWorkflowToFullConnector(void) ; 
    355         CGridLocalConnector* getWorkflowToFullConnector(void) { if (workflowToFullConnector_==nullptr) computeWorkflowToFullConnector() ; return workflowToFullConnector_;} 
    356  
    357       private: 
    358         CGridLocalConnector* fullToWorkflowConnector_ = nullptr; 
     355        shared_ptr<CGridLocalConnector> getWorkflowToFullConnector(void) { if (workflowToFullConnector_==nullptr) computeWorkflowToFullConnector() ; return workflowToFullConnector_;} 
     356 
     357      private: 
     358        shared_ptr<CGridLocalConnector> fullToWorkflowConnector_ = nullptr; 
    359359      public: 
    360360        void computeFullToWorkflowConnector(void) ; 
    361         CGridLocalConnector* getFullToWorkflowConnector(void) { if (fullToWorkflowConnector_==nullptr) computeFullToWorkflowConnector() ; return fullToWorkflowConnector_;} 
     361        shared_ptr<CGridLocalConnector> getFullToWorkflowConnector(void) { if (fullToWorkflowConnector_==nullptr) computeFullToWorkflowConnector() ; return fullToWorkflowConnector_;} 
    362362 
    363363     
    364364 
    365365      private: 
    366          CGridGathererConnector* clientFromClientConnector_ = nullptr ; 
    367       public: 
    368          CGridGathererConnector* getClientFromClientConnector(void) { if (clientFromClientConnector_==nullptr) computeClientFromClientConnector() ; return clientFromClientConnector_;} 
     366         shared_ptr<CGridGathererConnector> clientFromClientConnector_ = nullptr ; 
     367      public: 
     368         shared_ptr<CGridGathererConnector> getClientFromClientConnector(void) { if (clientFromClientConnector_==nullptr) computeClientFromClientConnector() ; return clientFromClientConnector_;} 
    369369         void computeClientFromClientConnector(void) ; 
    370370 
    371371      private: 
    372          map<CContextClient*, CGridScattererConnector*> clientToClientConnector_ ; 
    373       public: 
    374          CGridScattererConnector* getClientToClientConnector(CContextClient* client) { return clientToClientConnector_[client] ;} // make some test to see if connector exits for the given client 
     372         map<CContextClient*, shared_ptr<CGridScattererConnector>> clientToClientConnector_ ; 
     373      public: 
     374         shared_ptr<CGridScattererConnector> getClientToClientConnector(CContextClient* client) { return clientToClientConnector_[client] ;} // make some test to see if connector exits for the given client 
    375375   
    376376 
    377377      private: 
    378          map<CContextClient*,CGridGathererConnector*> clientFromServerConnector_  ; 
    379       public: 
    380          CGridGathererConnector* getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client];} 
     378         map<CContextClient*,shared_ptr<CGridGathererConnector>> clientFromServerConnector_  ; 
     379      public: 
     380         shared_ptr<CGridGathererConnector> getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client];} 
    381381         void computeClientFromServerConnector(void) ; 
    382382 
    383383      private: 
    384          CGridScattererConnector* serverToClientConnector_=nullptr ; 
    385       public: 
    386          CGridScattererConnector* getServerToClientConnector(void) { if (serverToClientConnector_==nullptr) computeServerToClientConnector() ; return serverToClientConnector_;} 
     384         shared_ptr<CGridScattererConnector> serverToClientConnector_=nullptr ; 
     385      public: 
     386         shared_ptr<CGridScattererConnector> getServerToClientConnector(void) { if (serverToClientConnector_==nullptr) computeServerToClientConnector() ; return serverToClientConnector_;} 
    387387         void computeServerToClientConnector(void) ; 
    388388      private: 
    389          map<CContextClient*, CGridScattererConnector*> clientToServerConnector_ ; 
    390       public: 
    391          CGridScattererConnector* getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;} // make some test to see if connector exits for the given client 
     389         map<CContextClient*, shared_ptr<CGridScattererConnector>> clientToServerConnector_ ; 
     390      public: 
     391         shared_ptr<CGridScattererConnector> getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;} // make some test to see if connector exits for the given client 
    392392          
    393393      private: 
    394          CGridGathererConnector* serverFromClientConnector_ = nullptr ; 
    395       public: 
    396          CGridGathererConnector* getServerFromClientConnector(void) { if (serverFromClientConnector_==nullptr) computeServerFromClientConnector() ; return serverFromClientConnector_;} 
     394         shared_ptr<CGridGathererConnector> serverFromClientConnector_ = nullptr ; 
     395      public: 
     396         shared_ptr<CGridGathererConnector> getServerFromClientConnector(void) { if (serverFromClientConnector_==nullptr) computeServerFromClientConnector() ; return serverFromClientConnector_;} 
    397397         void computeServerFromClientConnector(void) ; 
    398398 
Note: See TracChangeset for help on using the changeset viewer.