Index: XIOS/dev/branch_yushan_merged/src/object_factory_impl.hpp
===================================================================
--- XIOS/dev/branch_yushan_merged/src/object_factory_impl.hpp	(revision 1131)
+++ XIOS/dev/branch_yushan_merged/src/object_factory_impl.hpp	(revision 1134)
@@ -10,8 +10,12 @@
        int CObjectFactory::GetObjectNum(void)
    {
-      if (CurrContext.size() == 0)
+      if (CurrContext_ptr->size() == 0)
          ERROR("CObjectFactory::GetObjectNum(void)",
                << "please define current context id !");
-      return (U::AllVectObj[CObjectFactory::CurrContext].size());
+
+      if(U::AllVectObj == NULL) return 0;
+      
+      
+      return (*U::AllVectObj)[*CObjectFactory::CurrContext_ptr].size();
    }
 
@@ -19,8 +23,12 @@
       int CObjectFactory::GetObjectIdNum(void)
    {
-      if (CurrContext.size() == 0)
+      if (CurrContext_ptr->size() == 0)
          ERROR("CObjectFactory::GetObjectIdNum(void)",
                << "please define current context id !");
-      return (U::AllMapObj[CObjectFactory::CurrContext].size());
+      if(U::AllMapObj  == NULL) return 0;
+
+      
+
+      return (* U::AllMapObj) [*CObjectFactory::CurrContext_ptr].size();
    }
 
@@ -28,9 +36,14 @@
       bool CObjectFactory::HasObject(const StdString & id)
    {
-      if (CurrContext.size() == 0)
+      if (CurrContext_ptr->size() == 0)
          ERROR("CObjectFactory::HasObject(const StdString & id)",
                << "[ id = " << id << " ] please define current context id !");
-      return (U::AllMapObj[CObjectFactory::CurrContext].find(id) !=
-              U::AllMapObj[CObjectFactory::CurrContext].end());
+      
+      if(U::AllMapObj  == NULL)  return false;
+
+      
+
+      return ((*U::AllMapObj)[*CObjectFactory::CurrContext_ptr].find(id) !=
+              (*U::AllMapObj)[*CObjectFactory::CurrContext_ptr].end());
    }
 
@@ -38,6 +51,13 @@
       bool CObjectFactory::HasObject(const StdString & context, const StdString & id)
    {
-      if (U::AllMapObj.find(context) == U::AllMapObj.end()) return false ;
-      else return (U::AllMapObj[context].find(id) !=  U::AllMapObj[context].end());
+      if(U::AllMapObj  == NULL) return false;
+
+      if (U::AllMapObj->find(context) == U::AllMapObj->end()) return false ;
+
+      else
+      {
+         return ((*U::AllMapObj)[context].find(id) !=  (*U::AllMapObj)[context].end());
+      } 
+         
    }
 
@@ -45,9 +65,11 @@
       boost::shared_ptr<U> CObjectFactory::GetObject(const U * const object)
    {
-      if (CurrContext.size() == 0)
+      if(U::AllVectObj == NULL) return (boost::shared_ptr<U>());
+   
+      if (CurrContext_ptr->size() == 0)
          ERROR("CObjectFactory::GetObject(const U * const object)",
                << "please define current context id !");
       std::vector<boost::shared_ptr<U> > & vect =
-                     U::AllVectObj[CObjectFactory::CurrContext];
+                     (*U::AllVectObj)[*CObjectFactory::CurrContext_ptr];
 
       typename std::vector<boost::shared_ptr<U> >::const_iterator
@@ -70,5 +92,7 @@
       boost::shared_ptr<U> CObjectFactory::GetObject(const StdString & id)
    {
-      if (CurrContext.size() == 0)
+      if(U::AllMapObj  == NULL) return (boost::shared_ptr<U>());
+
+      if (CurrContext_ptr->size() == 0)
          ERROR("CObjectFactory::GetObject(const StdString & id)",
                << "[ id = " << id << " ] please define current context id !");
@@ -77,5 +101,5 @@
                << "[ id = " << id << ", U = " << U::GetName() << " ] "
                << "object was not found.");
-      return (U::AllMapObj[CObjectFactory::CurrContext][id]);
+      return (*U::AllMapObj)[*CObjectFactory::CurrContext_ptr][id];
    }
 
@@ -83,9 +107,12 @@
       boost::shared_ptr<U> CObjectFactory::GetObject(const StdString & context, const StdString & id)
    {
+      if(U::AllMapObj  == NULL) return (boost::shared_ptr<U>());
+
       if (!CObjectFactory::HasObject<U>(context,id))
          ERROR("CObjectFactory::GetObject(const StdString & id)",
                << "[ id = " << id << ", U = " << U::GetName() <<", context = "<<context<< " ] "
                << "object was not found.");
-      return (U::AllMapObj[context][id]);
+
+      return (*U::AllMapObj)[context][id];
    }
 
@@ -93,5 +120,9 @@
    boost::shared_ptr<U> CObjectFactory::CreateObject(const StdString& id)
    {
-      if (CurrContext.empty())
+      if(U::AllVectObj == NULL) U::AllVectObj = new xios_map<StdString, std::vector<boost::shared_ptr<U> > >;
+      if(U::AllMapObj  == NULL) U::AllMapObj  = new xios_map<StdString, xios_map<StdString, boost::shared_ptr<U> > >;
+
+      
+      if (CurrContext_ptr->empty())
          ERROR("CObjectFactory::CreateObject(const StdString& id)",
                << "[ id = " << id << " ] please define current context id !");
@@ -105,6 +136,6 @@
          boost::shared_ptr<U> value(new U(id.empty() ? CObjectFactory::GenUId<U>() : id));
 
-         U::AllVectObj[CObjectFactory::CurrContext].insert(U::AllVectObj[CObjectFactory::CurrContext].end(), value);
-         U::AllMapObj[CObjectFactory::CurrContext].insert(std::make_pair(value->getId(), value));
+         (* U::AllVectObj)[*CObjectFactory::CurrContext_ptr].insert((*U::AllVectObj)[*CObjectFactory::CurrContext_ptr].end(), value);
+         (* U::AllMapObj) [*CObjectFactory::CurrContext_ptr].insert(std::make_pair(value->getId(), value));
 
          return value;
@@ -116,5 +147,7 @@
          CObjectFactory::GetObjectVector(const StdString & context)
    {
-      return (U::AllVectObj[context]);
+      if(U::AllVectObj != NULL) 
+      
+      return (*U::AllVectObj)[context];
    }
 
@@ -130,5 +163,6 @@
    {
       StdOStringStream oss;
-      oss << GetUIdBase<U>() << U::GenId[CObjectFactory::CurrContext]++;
+      if(U::GenId == NULL) U::GenId = new xios_map< StdString, long int >;
+      oss << GetUIdBase<U>() << (*U::GenId)[*CObjectFactory::CurrContext_ptr]++;
       return oss.str();
    }
