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/domain.hpp

    r2206 r2267  
    285285       ////////////////////////////////////////////////////////////////////////////////////// 
    286286       private: 
    287          CLocalElement* localElement_ = nullptr ; 
     287         shared_ptr<CLocalElement> localElement_ = nullptr ; 
    288288         void initializeLocalElement(void) ; 
    289289        
    290290       public:   
    291          CLocalElement* getLocalElement(void) { if (localElement_==nullptr) initializeLocalElement() ; return localElement_ ; } 
    292          CLocalView* getLocalView(CElementView::type type) { return getLocalElement()->getView(type) ;} 
     291         shared_ptr<CLocalElement> getLocalElement(void) { if (localElement_==nullptr) initializeLocalElement() ; return localElement_ ; } 
     292         shared_ptr<CLocalView> getLocalView(CElementView::type type) { return getLocalElement()->getView(type) ;} 
    293293        
    294294       private:   
     
    298298         
    299299       private: 
    300          CLocalConnector* modelToWorkflowConnector_ ; 
     300         shared_ptr<CLocalConnector> modelToWorkflowConnector_ ; 
    301301         void computeModelToWorkflowConnector(void)  ; 
    302302       public: 
    303          CLocalConnector* getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;} 
     303         shared_ptr<CLocalConnector> getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;} 
    304304 
    305305       public: 
    306306         void computeRemoteElement(CContextClient* client, EDistributionType) ; 
    307          void distributeToServer(CContextClient* client, std::map<int, CArray<size_t,1>>& globalIndex, CScattererConnector* &scattererConnector, 
     307         void distributeToServer(CContextClient* client, std::map<int, CArray<size_t,1>>& globalIndex, shared_ptr<CScattererConnector> &scattererConnector, 
    308308                                 const string& domainId="") ; 
    309309 
     
    311311         void receivedDomainDistribution(CEventServer& event, int phasis) ; 
    312312 
    313          void sendDistributedAttributes(CContextClient* client, CScattererConnector& scaterrerConnector, const string& domainId) ; 
     313         void sendDistributedAttributes(CContextClient* client, shared_ptr<CScattererConnector> scaterrerConnector, const string& domainId) ; 
    314314         static void recvDistributedAttributes(CEventServer& event) ; 
    315315         void recvDistributedAttributes(CEventServer& event, const string& type) ; 
     
    317317 
    318318       private: 
    319          map<CContextClient*, CDistributedElement*> remoteElement_ ; 
     319         map<CContextClient*, shared_ptr<CDistributedElement>> remoteElement_ ; 
    320320       public:  
    321          CDistributedElement* getRemoteElement(CContextClient* client) {return remoteElement_[client] ;} 
    322        private: 
    323          map<CContextClient*, CScattererConnector*> clientToServerConnector_ ; 
     321         shared_ptr<CDistributedElement> getRemoteElement(CContextClient* client) {return remoteElement_[client] ;} 
     322       private: 
     323         map<CContextClient*, shared_ptr<CScattererConnector>> clientToServerConnector_ ; 
    324324       public:  
    325          CScattererConnector* getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;} 
    326         
    327        private: 
    328          CGathererConnector*  gathererConnector_ ; 
    329        public: 
    330          CGathererConnector* getGathererConnector(void) { return gathererConnector_ ;} 
     325         shared_ptr<CScattererConnector> getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;} 
     326        
     327       private: 
     328         shared_ptr<CGathererConnector>  gathererConnector_ ; 
     329       public: 
     330         shared_ptr<CGathererConnector> getGathererConnector(void) { return gathererConnector_ ;} 
    331331        private: 
    332          CGathererConnector* serverFromClientConnector_ ; 
    333          CDistributedElement* elementFrom_ ; 
    334        public: 
    335          CGathererConnector* getServerFromClientConnector(void) { return serverFromClientConnector_ ;} 
    336  
    337        private: 
    338          CScattererConnector*  serverToClientConnector_ = nullptr ; 
     332         shared_ptr<CGathererConnector> serverFromClientConnector_ ; 
     333         shared_ptr<CDistributedElement> elementFrom_ ; 
     334       public: 
     335         shared_ptr<CGathererConnector> getServerFromClientConnector(void) { return serverFromClientConnector_ ;} 
     336 
     337       private: 
     338         shared_ptr<CScattererConnector>  serverToClientConnector_ = nullptr ; 
    339339       public:  
    340          CScattererConnector* getServerToClientConnector(void) { return serverToClientConnector_ ;}  
    341  
    342        private: 
    343          map<CContextClient*,CGathererConnector*>  clientFromServerConnector_  ; 
     340         shared_ptr<CScattererConnector> getServerToClientConnector(void) { return serverToClientConnector_ ;}  
     341 
     342       private: 
     343         map<CContextClient*,shared_ptr<CGathererConnector>>  clientFromServerConnector_  ; 
    344344       public:  
    345          CGathererConnector* getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client] ;}         
     345         shared_ptr<CGathererConnector> getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client] ;}         
    346346          
    347347 
Note: See TracChangeset for help on using the changeset viewer.