Changeset 2265
- Timestamp:
- 11/25/21 18:25:19 (19 months ago)
- Location:
- XIOS/dev/dev_ym/XIOS_COUPLING/src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
XIOS/dev/dev_ym/XIOS_COUPLING/src/client.cpp
r2260 r2265 487 487 CTimer::get("XIOS init/finalize",false).suspend() ; 488 488 CTimer::get("XIOS").suspend() ; 489 489 CContext::removeAllContexts() ; // free memory for related context 490 490 CXios::finalizeDaemonsManager() ; 491 491 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/interface/c/icdata.cpp
r2243 r2265 135 135 CContext* context = CContext::getCurrent(); 136 136 context->finalize(); 137 CContext::removeContext(context->getId()) ; 137 138 CTimer::get("XIOS context finalize").suspend(); 138 139 CTimer::get("XIOS").suspend(); -
XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/server_context.cpp
r2260 r2265 252 252 if (context_->eventLoop()) 253 253 { 254 info(100)<<"Remove context server with id "<<context_->getId()<<endl ; 255 CContext::removeContext(context_->getId()) ; 254 256 context_=nullptr ; 255 257 // destroy context ??? --> later -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/calendar_wrapper.hpp
r1542 r2265 82 82 }; // class CCalendarWrapper 83 83 84 typedef CCalendarWrapper CCalendarWrapperGroup; 84 85 typedef CCalendarWrapper CCalendarWrapperDefinition; 85 86 } // namespace xios -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.cpp
r2258 r2265 289 289 CATCH 290 290 291 void CContext::removeContext(const string& contextId) 292 { 293 #define DECLARE_NODE(Name_, name_) CObjectFactory::deleteContext< C##Name_ >(contextId); 294 #define DECLARE_NODE_PAR(Name_, name_) CObjectFactory::deleteContext< C##Name_ >(contextId); 295 #include "node_type.conf" 296 #define DECLARE_NODE(Name_, name_) CObjectFactory::deleteContext< C##Name_##Group >(contextId); 297 #define DECLARE_NODE_PAR(Name_, name_) 298 #include "node_type.conf" 299 300 /* 301 #define DECLARE_NODE(Name_, name_) CObjectFactory::dumpObjects< C##Name_##Group >(); 302 #define DECLARE_NODE_PAR(Name_, name_) 303 #include "node_type.conf" 304 305 #define DECLARE_NODE(Name_, name_) CObjectFactory::dumpObjects< C##Name_>(); 306 #define DECLARE_NODE_PAR(Name_, name_) 307 #include "node_type.conf" 308 */ 309 } 310 311 void CContext::removeAllContexts(void) 312 { 313 #define DECLARE_NODE(Name_, name_) CObjectFactory::deleteAllContexts< C##Name_ >(); 314 #define DECLARE_NODE_PAR(Name_, name_) CObjectFactory::deleteAllContexts< C##Name_ >(); 315 #include "node_type.conf" 316 #define DECLARE_NODE(Name_, name_) CObjectFactory::deleteAllContexts< C##Name_##Group >(); 317 #define DECLARE_NODE_PAR(Name_, name_) 318 #include "node_type.conf" 319 /* 320 #define DECLARE_NODE(Name_, name_) CObjectFactory::dumpObjects< C##Name_##Group >(); 321 #define DECLARE_NODE_PAR(Name_, name_) 322 #include "node_type.conf" 323 324 #define DECLARE_NODE(Name_, name_) CObjectFactory::dumpObjects< C##Name_>(); 325 #define DECLARE_NODE_PAR(Name_, name_) 326 #include "node_type.conf" 327 */ 328 } 291 329 ///--------------------------------------------------------------- 292 330 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.hpp
r2209 r2265 246 246 static void ShowTree(StdOStream & out = std::clog); 247 247 static void CleanTree(void); 248 static void removeContext(const std::string& contextId); 249 static void removeAllContexts(void) ; 248 250 int getServiceType(void) {return serviceType_;} 249 251 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/object_factory.hpp
r1869 r2265 54 54 static std::shared_ptr<U> CreateAlias(const StdString& id, const StdString& alias) ; 55 55 56 template <typename U> static const StdString &GetUIdBase(void);56 template <typename U> static const StdString GetUIdBase(void); 57 57 template <typename U> static StdString GenUId(void); 58 58 template <typename U> static bool IsGenUId(const StdString& id); 59 59 template <typename U> static void deleteContext(const StdString & context) ; 60 template <typename U> static void deleteAllContexts(void) ; 61 template <typename U> static void dumpObjects(void) ; 60 62 private : 61 63 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/object_factory_decl_macro.hpp
r2130 r2265 14 14 template std::shared_ptr<U> CObjectFactory::CreateObject<U>(const StdString& id ); \ 15 15 template std::shared_ptr<U> CObjectFactory::CreateAlias<U>(const StdString& id, const StdString& alias ); \ 16 template const StdString &CObjectFactory::GetUIdBase<U>(void); \16 template const StdString CObjectFactory::GetUIdBase<U>(void); \ 17 17 template StdString CObjectFactory::GenUId<U>(void); \ 18 template bool CObjectFactory::IsGenUId<U>(const StdString& id); 18 template bool CObjectFactory::IsGenUId<U>(const StdString& id);\ 19 template void CObjectFactory::deleteContext<U>(const StdString & context) ;\ 20 template void CObjectFactory::deleteAllContexts<U>() ;\ 21 template void CObjectFactory::dumpObjects<U>(void) ; 19 22 20 23 21 24 25 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/object_factory_impl.hpp
r2183 r2265 147 147 148 148 template <typename U> 149 const StdString &CObjectFactory::GetUIdBase(void)150 { 151 staticStdString base ;149 const StdString CObjectFactory::GetUIdBase(void) 150 { 151 StdString base ; 152 152 // base = "__"+CObjectFactory::CurrContext + "::" + U::GetName() + "_undef_id_"; 153 153 base = CObjectFactory::CurrContext + "__" + U::GetName() + "_undef_id_"; … … 166 166 bool CObjectFactory::IsGenUId(const StdString& id) 167 167 { 168 const StdString &base = GetUIdBase<U>();168 const StdString base = GetUIdBase<U>(); 169 169 return (id.size() > base.size() && id.compare(0, base.size(), base) == 0); 170 170 } 171 171 172 template <typename U> 173 void CObjectFactory::deleteContext(const StdString & context) 174 { 175 for (auto& v : U::AllVectObj[context]) v.reset() ; 176 U::AllVectObj[context].clear() ; 177 U::AllVectObj.erase(context) ; 178 for (auto& m : U::AllMapObj[context]) m.second.reset() ; 179 U::AllMapObj[context].clear() ; 180 U::AllMapObj.erase(context) ; 181 182 U::GenId.erase(context) ; 183 } 184 185 template <typename U> 186 void CObjectFactory::deleteAllContexts(void) 187 { 188 list<StdString> contextList ; 189 for(auto& context : U::AllMapObj) contextList.push_back(context.first) ; 190 for(auto& context : contextList) deleteContext<U>(context) ; 191 } 192 193 194 template <typename U> 195 void CObjectFactory::dumpObjects(void) 196 { 197 for (auto& context : U::AllMapObj) 198 for(auto& m : context.second) 199 { 200 info(100)<<"Dump All Object"<<endl ; 201 info(100)<<"Object from context "<<context.first<<" with id "<<m.first<<endl ; 202 } 203 } 172 204 } // namespace xios 173 205 -
XIOS/dev/dev_ym/XIOS_COUPLING/src/object_template.hpp
r2243 r2265 124 124 CObjectTemplate(void); 125 125 explicit CObjectTemplate(const StdString & id); 126 CObjectTemplate(const CObjectTemplate<T> & object, 127 bool withAttrList = true, bool withId = true); 126 CObjectTemplate(const CObjectTemplate<T> & object, bool withAttrList = true, bool withId = true); 128 127 CObjectTemplate(const CObjectTemplate<T> * const object); // Not implemented. 129 128 … … 131 130 132 131 /// Propriétés statiques /// 133 static xios_map<StdString, 134 xios_map<StdString, 135 std::shared_ptr<DerivedType> > > AllMapObj; 136 static xios_map<StdString, 137 std::vector<std::shared_ptr<DerivedType> > > AllVectObj; 132 static xios_map<StdString, xios_map<StdString, std::shared_ptr<DerivedType> > > AllMapObj; 133 static xios_map<StdString, std::vector<std::shared_ptr<DerivedType> > > AllVectObj; 138 134 139 135 static xios_map< StdString, long int > GenId ; -
XIOS/dev/dev_ym/XIOS_COUPLING/src/server.cpp
r2243 r2265 313 313 314 314 // MPI_Comm_free(&intraComm); 315 315 CContext::removeAllContexts() ; // free memory for related context 316 316 CXios::finalizeDaemonsManager(); 317 317
Note: See TracChangeset
for help on using the changeset viewer.