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

    r2206 r2267  
    222222          
    223223        private: 
    224          CLocalElement* localElement_ = nullptr ; 
     224         shared_ptr<CLocalElement> localElement_ ; 
    225225         void initializeLocalElement(void) ; 
    226226        public:  
    227          CLocalElement* getLocalElement(void) { if (localElement_==nullptr) initializeLocalElement() ; return localElement_ ; } 
    228          CLocalView* getLocalView(CElementView::type type) { return getLocalElement()->getView(type) ;} 
     227         shared_ptr<CLocalElement> getLocalElement(void) { if (localElement_==nullptr) initializeLocalElement() ; return localElement_ ; } 
     228         shared_ptr<CLocalView> getLocalView(CElementView::type type) { return getLocalElement()->getView(type) ;} 
    229229        private: 
    230230         void addFullView(void) ; 
     
    233233 
    234234        private: 
    235          CLocalConnector* modelToWorkflowConnector_ ; 
     235         shared_ptr<CLocalConnector> modelToWorkflowConnector_ ; 
    236236         void computeModelToWorkflowConnector(void)  ; 
    237237        public: 
    238          CLocalConnector* getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;} 
     238         shared_ptr<CLocalConnector> getModelToWorkflowConnector(void) { if (modelToWorkflowConnector_==nullptr) computeModelToWorkflowConnector() ; return modelToWorkflowConnector_ ;} 
    239239        
    240240       public: 
    241241         void computeRemoteElement(CContextClient* client, EDistributionType) ; 
    242          void distributeToServer(CContextClient* client, std::map<int, CArray<size_t,1>>& globalIndex, CScattererConnector* &scattererConnector, 
     242         void distributeToServer(CContextClient* client, std::map<int, CArray<size_t,1>>& globalIndex, shared_ptr<CScattererConnector>& scattererConnector, 
    243243                                 const string& axisId="") ; 
    244244 
     
    246246         void receivedAxisDistribution(CEventServer& event, int phasis) ; 
    247247         void setServerMask(CArray<bool,1>& serverMask, CContextClient* client ) ; 
    248          void sendDistributedAttributes(CContextClient* client, CScattererConnector& scattererConnector, const string& axisId) ; 
     248         void sendDistributedAttributes(CContextClient* client, shared_ptr<CScattererConnector> scattererConnector, const string& axisId) ; 
    249249         static void recvDistributedAttributes(CEventServer& event) ; 
    250250         void recvDistributedAttributes(CEventServer& event, const string& type) ; 
    251251       private: 
    252          map<CContextClient*, CDistributedElement*> remoteElement_ ; 
    253        public:  
    254          CDistributedElement* getRemoteElement(CContextClient* client) {return remoteElement_[client] ;} 
    255        private: 
    256          map<CContextClient*, CScattererConnector*> clientToServerConnector_ ; 
    257        public:  
    258          CScattererConnector* getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;} 
    259        private: 
    260          CGathererConnector*  gathererConnector_ ; 
     252         map<CContextClient*, shared_ptr<CDistributedElement>> remoteElement_ ; 
     253       public:  
     254         shared_ptr<CDistributedElement> getRemoteElement(CContextClient* client) {return remoteElement_[client] ;} 
     255       private: 
     256         map<CContextClient*, shared_ptr<CScattererConnector>> clientToServerConnector_ ; 
     257       public:  
     258         shared_ptr<CScattererConnector> getClientToServerConnector(CContextClient* client) { return clientToServerConnector_[client] ;} 
     259       private: 
     260         shared_ptr<CGathererConnector>  gathererConnector_ ; 
    261261       public: 
    262          CGathererConnector* getGathererConnector(void) { return gathererConnector_ ;} 
    263        private: 
    264          CGathererConnector* serverFromClientConnector_ ; 
    265          CDistributedElement* elementFrom_ ; 
     262         shared_ptr<CGathererConnector> getGathererConnector(void) { return gathererConnector_ ;} 
     263       private: 
     264         shared_ptr<CGathererConnector> serverFromClientConnector_ ; 
     265         shared_ptr<CDistributedElement> elementFrom_ ; 
    266266       public: 
    267         CGathererConnector* getServerFromClientConnector(void) { return serverFromClientConnector_ ;} 
    268  
    269        private: 
    270          CScattererConnector* serverToClientConnector_ = nullptr ; 
    271        public:  
    272          CScattererConnector* getServerToClientConnector(void) { return serverToClientConnector_ ;}  
    273  
    274        private: 
    275           map<CContextClient*,CGathererConnector*>  clientFromServerConnector_  ; 
    276        public:  
    277          CGathererConnector* getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client] ;}  
     267        shared_ptr<CGathererConnector> getServerFromClientConnector(void) { return serverFromClientConnector_ ;} 
     268 
     269       private: 
     270         shared_ptr<CScattererConnector> serverToClientConnector_ = nullptr ; 
     271       public:  
     272         shared_ptr<CScattererConnector> getServerToClientConnector(void) { return serverToClientConnector_ ;}  
     273 
     274       private: 
     275          map<CContextClient*,shared_ptr<CGathererConnector>>  clientFromServerConnector_  ; 
     276       public:  
     277        shared_ptr<CGathererConnector> getClientFromServerConnector(CContextClient* client) { return clientFromServerConnector_[client] ;}  
    278278 
    279279         DECLARE_REF_FUNC(Axis,axis) 
Note: See TracChangeset for help on using the changeset viewer.