Changeset 346 for XIOS/trunk


Ignore:
Timestamp:
04/12/12 17:02:23 (12 years ago)
Author:
ymipsl
Message:

Suppress access to CObjectFactory class and CTreeManager.

YM

Location:
XIOS/trunk/src
Files:
34 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/client.cpp

    r345 r346  
    129129    void CClient::registerContext(const string& id,MPI_Comm contextComm) 
    130130    { 
    131       CObjectFactory::SetCurrentContextId(id); 
    132       shared_ptr<CContext> context=CTreeManager::CreateContext(id) ; 
     131      CContext::setCurrent(id) ; 
     132      shared_ptr<CContext> context=CContext::create(id) ; 
    133133         
    134134      if (!CXios::isServer) 
  • XIOS/trunk/src/context_server.cpp

    r345 r346  
    167167    int rank ; 
    168168    list<CEventServer::SSubEvent>::iterator it ; 
    169     CTreeManager::SetCurrentContextId(context->getId()) ; 
     169    CContext::setCurrent(context->getId()) ; 
    170170         
    171171    if (event.classId==CContext::GetType() && event.type==CContext::EVENT_ID_CONTEXT_FINALIZE) 
  • XIOS/trunk/src/cxios.cpp

    r345 r346  
    44#include "client.hpp" 
    55#include "server.hpp" 
    6 #include "tree_manager.hpp" 
     6//#include "tree_manager.hpp" 
     7#include "xml_parser.hpp" 
    78#include <boost/functional/hash.hpp> 
    89#include <mpi.h> 
     
    2526  void CXios::initialize() 
    2627  { 
    27     CTreeManager::ParseFile(rootFile); 
     28    parseFile(rootFile); 
    2829    usingServer=getin<bool>("using_server",false) ; 
    2930    usingOasis=getin<bool>("using_oasis",false) ; 
     
    6566  }  
    6667   
     68  void CXios::parseFile(const string& filename) 
     69  { 
     70    xml::CXMLParser::ParseFile(filename);  
     71  } 
     72   
    6773 
    6874} 
  • XIOS/trunk/src/cxios.hpp

    r335 r346  
    2020     static void initServerSide(void) ; 
    2121     static void clientFinalize(void) ; 
     22     static void parseFile(const string& filename) ; 
    2223    
    2324     template <typename T> 
  • XIOS/trunk/src/cxios_impl.hpp

    r335 r346  
    44#include "xmlioserver_spl.hpp" 
    55#include "variable.hpp" 
     6#include "object_template_impl.hpp" 
    67 
    78namespace xios 
     
    1011  T CXios::getin(const string& id) 
    1112  { 
    12     return CObjectFactory::GetObject<CVariable>("xios",id)->getData<T>() ; 
     13    return CVariable::get("xios",id)->getData<T>() ; 
    1314  } 
    1415 
     
    1617  T CXios::getin(const string& id, const T& defaultValue) 
    1718  { 
    18     if (CObjectFactory::HasObject<CVariable>("xios",id)) 
    19       return CObjectFactory::GetObject<CVariable>("xios",id)->getData<T>() ; 
     19    if (CVariable::has("xios",id)) return CVariable::get("xios",id)->getData<T>() ; 
    2020    else return defaultValue ; 
    2121  } 
  • XIOS/trunk/src/data_output.cpp

    r345 r346  
    2323         if (grid->axis_ref.isEmpty()) 
    2424         { 
    25             this->writeGrid 
    26             (CObjectFactory::GetObject<CDomain>(grid->domain_ref.getValue())); 
     25            this->writeGrid(CDomain::get(grid->domain_ref.getValue())); 
    2726         } 
    2827         else 
    2928         { 
    30             this->writeGrid 
    31             (CObjectFactory::GetObject<CDomain>(grid->domain_ref.getValue()), 
    32              CObjectFactory::GetObject<CAxis>(grid->axis_ref.getValue())); 
     29            this->writeGrid(CDomain::get(grid->domain_ref.getValue()), 
     30                            CAxis::get(grid->axis_ref.getValue())); 
    3331         } 
    3432      } 
     
    7573         (const boost::shared_ptr<CField> field) 
    7674      { 
    77          boost::shared_ptr<CContext> context = 
    78          CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()); 
     75         boost::shared_ptr<CContext> context = CContext::getCurrent() ; 
    7976         boost::shared_ptr<CCalendar> calendar = context->getCalendar(); 
    8077          
     
    9592      void CDataOutput::writeFieldData(const boost::shared_ptr<CField> field) 
    9693      { 
    97          boost::shared_ptr<CGrid> grid = 
    98             CObjectFactory::GetObject<CGrid>(field->grid_ref.getValue()); 
    99          boost::shared_ptr<CDomain> domain = 
    100             CObjectFactory::GetObject<CDomain>(grid->domain_ref.getValue()); 
     94         boost::shared_ptr<CGrid> grid = CGrid::get(field->grid_ref.getValue()); 
     95         boost::shared_ptr<CDomain> domain = CDomain::get(grid->domain_ref.getValue()); 
    10196             
    10297//         if (domain->isEmpty()) return; 
  • XIOS/trunk/src/field_impl.hpp

    r345 r346  
    2323      bool CField::updateData(const ARRAY(double, N) _data) 
    2424   {         
    25       shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     25      shared_ptr<CContext> context=CContext::getCurrent(); 
    2626      const CDate & currDate = context->getCalendar()->getCurrentDate(); 
    2727      const CDate opeDate      = *last_operation + freq_operation; 
  • XIOS/trunk/src/generate_fortran_interface.cpp

    r345 r346  
    1111  string path="./interface/" ; 
    1212   
    13   CContext* context=CTreeManager::CreateContext("interface").get(); 
     13  CContext* context=CContext::create("interface").get(); 
    1414  CAxis axis ; 
    1515  CAxisGroup axisgroup ; 
  • XIOS/trunk/src/group_parser.hpp

    r335 r346  
    6767            } 
    6868 
    69             DEBUG(<< "Dans le contexte \'" << CObjectFactory::GetCurrentContextId() 
     69            DEBUG(<< "Dans le contexte \'" << CContext::getCurrent()->getId() 
    7070                  << "\', un objet de type \'" << V::GetName() 
    7171                  << "\' ne peut contenir qu'un objet de type \'" << V::GetName() 
  • XIOS/trunk/src/group_template.hpp

    r345 r346  
    6666//         static boost::shared_ptr<V> create(const string& id=string("")) ; 
    6767         boost::shared_ptr<U> createChild(const string& id="") ;  
     68         void addChild(shared_ptr<U> child) ;  
    6869         boost::shared_ptr<V> createChildGroup(const string& id="") ;  
     70         void addChildGroup(shared_ptr<V> childGroup) ;  
    6971         static bool dispatchEvent(CEventServer& event) ; 
    7072         void sendCreateChild(const string& id="") ; 
  • XIOS/trunk/src/group_template_impl.hpp

    r345 r346  
    341341   ///-------------------------------------------------------------- 
    342342 
     343   
    343344   template <class U, class V, class W> 
    344345   boost::shared_ptr<U> CGroupTemplate<U, V, W>::createChild(const string& id)  
     
    346347    return CGroupFactory::CreateChild<V>(this->get(), id) ; 
    347348  } 
     349 
     350   template <class U, class V, class W> 
     351   void CGroupTemplate<U, V, W>::addChild(shared_ptr<U> child)  
     352  { 
     353    return CGroupFactory::AddChild<V>(this->get(),child) ; 
     354  } 
    348355   
    349356   template <class U, class V, class W> 
     
    353360  } 
    354361 
     362   template <class U, class V, class W> 
     363   void CGroupTemplate<U, V, W>::addChildGroup(shared_ptr<V> childGroup)  
     364  { 
     365    return CGroupFactory::AddGroup<V>(this->get(), childGroup) ; 
     366  } 
     367 
    355368 
    356369   template <class U, class V, class W> 
    357370   void CGroupTemplate<U, V, W>::sendCreateChild(const string& id) 
    358371   { 
    359     shared_ptr<CContext> context=CContext::current() ; 
     372    shared_ptr<CContext> context=CContext::getCurrent() ; 
    360373     
    361374    if (! context->hasServer ) 
     
    380393   void CGroupTemplate<U, V, W>::sendCreateChildGroup(const string& id) 
    381394   { 
    382     shared_ptr<CContext> context=CContext::current() ; 
     395    shared_ptr<CContext> context=CContext::getCurrent() ; 
    383396    if (! context->hasServer ) 
    384397    { 
  • XIOS/trunk/src/interface/c/icaxis.cpp

    r345 r346  
    3030      if (!cstr2string(_id, _id_len, id)) return; 
    3131 
    32       *_ret = xios::CObjectFactory::GetObject<xios::CAxis>(id).get(); 
     32      *_ret = xios::CAxis::get(id).get(); 
    3333   } 
    3434    
     
    3838      if (!cstr2string(_id, _id_len, id)) return; 
    3939 
    40       *_ret = xios::CObjectFactory::GetObject<xios::CAxisGroup>(id).get(); 
     40      *_ret = xios::CAxisGroup::get(id).get(); 
    4141   } 
    4242 
     
    4848      if (!cstr2string(_id, _id_len, id)) return; 
    4949 
    50       *_ret = xios::CObjectFactory::HasObject<xios::CAxis>(id); 
     50      *_ret = xios::CAxis::has(id); 
    5151   } 
    5252 
     
    5656      if (!cstr2string(_id, _id_len, id)) return; 
    5757 
    58       *_ret = xios::CObjectFactory::HasObject<xios::CAxisGroup>(id); 
     58      *_ret = xios::CAxisGroup::has(id); 
    5959   } 
    6060    
  • XIOS/trunk/src/interface/c/iccontext.cpp

    r345 r346  
    3434 
    3535      std::vector<boost::shared_ptr<xios::CContext> > def_vector = 
    36             xios::CContext::GetContextGroup()->getChildList(); 
     36            xios::CContext::getRoot()->getChildList(); 
    3737 
    3838      for (std::size_t i = 0; i < def_vector.size(); i++) 
     
    4949   void cxios_context_set_current(XContextPtr context, bool withswap) 
    5050   { 
    51       CTreeManager::SetCurrentContextId(context->getId()); 
     51      CContext::setCurrent(context->getId()); 
    5252   } 
    5353    
     
    6161 
    6262      std::vector<boost::shared_ptr<xios::CContext> > def_vector = 
    63             xios::CContext::GetContextGroup()->getChildList(); 
     63            xios::CContext::getRoot()->getChildList(); 
    6464 
    6565      for (std::size_t i = 0; i < def_vector.size(); i++) 
  • XIOS/trunk/src/interface/c/icdata.cpp

    r345 r346  
    6767    void cxios_context_close_definition() 
    6868   { 
    69      boost::shared_ptr<CContext> context = 
    70             CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()); 
     69     boost::shared_ptr<CContext> context = CContext::getCurrent() ; 
    7170     context->closeDefinition() ; 
    7271   }   
     
    7473   void cxios_context_finalize() 
    7574   { 
    76      boost::shared_ptr<CContext> context = 
    77             CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()); 
     75     boost::shared_ptr<CContext> context = CContext::getCurrent() ; 
    7876     context->finalize() ; 
    7977   } 
     
    9189   { 
    9290      std::string fieldid_str; 
    93       boost::shared_ptr<CContext> context = 
    94       CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()); 
     91      boost::shared_ptr<CContext> context = CContext::getCurrent() ; 
    9592      if (!cstr2string(fieldid, fieldid_size, fieldid_str)) return;  
    9693       
     
    108105   { 
    109106      std::string fieldid_str; 
    110       boost::shared_ptr<CContext> context = 
    111       CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()); 
     107      boost::shared_ptr<CContext> context = CContext::getCurrent() ; 
    112108      if (!cstr2string(fieldid, fieldid_size, fieldid_str)) return; 
    113109       
     
    124120   { 
    125121      std::string fieldid_str; 
    126       boost::shared_ptr<CContext> context = 
    127       CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()); 
     122      boost::shared_ptr<CContext> context = CContext::getCurrent() ; 
    128123      if (!cstr2string(fieldid, fieldid_size, fieldid_str)) return;  
    129124       
     
    141136   { 
    142137      std::string fieldid_str; 
    143       boost::shared_ptr<CContext> context = 
    144       CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()); 
     138      boost::shared_ptr<CContext> context = CContext::getCurrent() ; 
    145139      if (!cstr2string(fieldid, fieldid_size, fieldid_str)) return;  
    146140       
     
    160154   { 
    161155      std::string fieldid_str; 
    162       boost::shared_ptr<CContext> context = 
    163       CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()); 
     156      boost::shared_ptr<CContext> context = CContext::getCurrent() ; 
    164157      if (!cstr2string(fieldid, fieldid_size, fieldid_str)) return;  
    165158       
     
    179172   { 
    180173      std::string fieldid_str; 
    181       boost::shared_ptr<CContext> context = 
    182       CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()); 
     174      boost::shared_ptr<CContext> context = CContext::getCurrent() ; 
    183175      if (!cstr2string(fieldid, fieldid_size, fieldid_str)) return;  
    184176       
  • XIOS/trunk/src/interface/c/icdate.cpp

    r345 r346  
    2626      { 
    2727         CDuration dur = {ts_year, ts_month, ts_day, ts_hour, ts_minute, ts_second}; 
    28          boost::shared_ptr<xios::CContext> context = 
    29          xios::CObjectFactory::GetObject<xios::CContext> 
    30             (CObjectFactory::GetCurrentContextId()); 
     28         boost::shared_ptr<xios::CContext> context = CContext::getCurrent() ; 
    3129          
    3230            context->timestep.setValue(dur.toString()); 
     
    4240   void cxios_update_calendar(int step) 
    4341   { 
    44       boost::shared_ptr<xios::CContext> context = 
    45             xios::CObjectFactory::GetObject<xios::CContext> 
    46             (CObjectFactory::GetCurrentContextId()); 
     42      boost::shared_ptr<xios::CContext> context = CContext::getCurrent() ; 
    4743      context->updateCalendar(step) ; 
    4844      context->sendUpdateCalendar(step) ; 
  • XIOS/trunk/src/interface/c/icdomain.cpp

    r345 r346  
    3030      if (!cstr2string(_id, _id_len, id)) return; 
    3131 
    32       *_ret = xios::CObjectFactory::GetObject<xios::CDomain>(id).get(); 
     32      *_ret = CDomain::get(id).get(); 
    3333   } 
    3434    
     
    3838      if (!cstr2string(_id, _id_len, id)) return; 
    3939 
    40       *_ret = xios::CObjectFactory::GetObject<xios::CDomainGroup>(id).get(); 
     40      *_ret = CDomainGroup::get(id).get(); 
    4141   } 
    4242 
     
    4848      if (!cstr2string(_id, _id_len, id)) return; 
    4949 
    50       *_ret = xios::CObjectFactory::HasObject<xios::CDomain>(id); 
     50      *_ret = CDomain::has(id); 
    5151   } 
    5252 
     
    5656      if (!cstr2string(_id, _id_len, id)) return; 
    5757 
    58       *_ret = xios::CObjectFactory::HasObject<xios::CDomainGroup>(id); 
     58      *_ret = CDomainGroup::has(id); 
    5959   } 
    6060} // extern "C" 
  • XIOS/trunk/src/interface/c/icfield.cpp

    r345 r346  
    3232      if (!cstr2string(_id, _id_len, id)) return; 
    3333 
    34       *_ret = xios::CObjectFactory::GetObject<xios::CField>(id).get(); 
     34      *_ret = CField::get(id).get(); 
    3535   } 
    3636    
     
    4040      if (!cstr2string(_id, _id_len, id)) return; 
    4141 
    42       *_ret = xios::CObjectFactory::GetObject<xios::CFieldGroup>(id).get(); 
     42      *_ret = CFieldGroup::get(id).get(); 
    4343   } 
    4444 
     
    5151      if (!cstr2string(_id, _id_len, id)) return; 
    5252 
    53       *_ret = xios::CObjectFactory::HasObject<xios::CField>(id); 
     53      *_ret = CField::has(id); 
    5454   } 
    5555 
     
    5959      if (!cstr2string(_id, _id_len, id)) return; 
    6060 
    61       *_ret = xios::CObjectFactory::HasObject<xios::CFieldGroup>(id); 
     61      *_ret = CFieldGroup::has(id); 
    6262   } 
    6363 
  • XIOS/trunk/src/interface/c/icfile.cpp

    r345 r346  
    3030      if (!cstr2string(_id, _id_len, id)) return; 
    3131 
    32       *_ret = xios::CObjectFactory::GetObject<xios::CFile>(id).get(); 
     32      *_ret = CFile::get(id).get(); 
    3333   } 
    3434    
     
    3838      if (!cstr2string(_id, _id_len, id)) return; 
    3939 
    40       *_ret = xios::CObjectFactory::GetObject<xios::CFileGroup>(id).get(); 
     40      *_ret = CFileGroup::get(id).get(); 
    4141   } 
    4242 
     
    4848      if (!cstr2string(_id, _id_len, id)) return; 
    4949 
    50       *_ret = xios::CObjectFactory::HasObject<xios::CFile>(id); 
     50      *_ret = CFile::has(id); 
    5151   } 
    5252 
     
    5656      if (!cstr2string(_id, _id_len, id)) return; 
    5757 
    58       *_ret = xios::CObjectFactory::HasObject<xios::CFileGroup>(id); 
     58      *_ret = CFileGroup::has(id); 
    5959   } 
    6060} // extern "C" 
  • XIOS/trunk/src/interface/c/icgrid.cpp

    r345 r346  
    3030      if (!cstr2string(_id, _id_len, id)) return; 
    3131 
    32       *_ret = xios::CObjectFactory::GetObject<xios::CGrid>(id).get(); 
     32      *_ret = CGrid::get(id).get(); 
    3333   } 
    3434    
     
    3838      if (!cstr2string(_id, _id_len, id)) return; 
    3939 
    40       *_ret = xios::CObjectFactory::GetObject<xios::CGridGroup>(id).get(); 
     40      *_ret = CGridGroup::get(id).get(); 
    4141   } 
    4242 
     
    4848      if (!cstr2string(_id, _id_len, id)) return; 
    4949 
    50       *_ret = xios::CObjectFactory::HasObject<xios::CGrid>(id); 
     50      *_ret = CGrid::has(id); 
    5151   } 
    5252 
     
    5656      if (!cstr2string(_id, _id_len, id)) return; 
    5757 
    58       *_ret = xios::CObjectFactory::HasObject<xios::CGridGroup>(id); 
     58      *_ret = CGridGroup::has(id); 
    5959   } 
    6060} // extern "C" 
  • XIOS/trunk/src/interface/c/icxml_tree.cpp

    r345 r346  
    241241   // ----------------------- Affichage de l'arborescence ---------------------- 
    242242    
    243    void cxios_xml_tree_show   (const char * filename, int filename_size)  
    244    { 
    245       std::string filename_str; 
    246       try 
    247       { 
    248          if (cstr2string(filename, filename_size, filename_str)) 
    249             xios::CTreeManager::PrintTreeToFile(filename_str); 
    250          else 
    251             xios::CTreeManager::PrintTreeToStream(std::clog); 
    252       } 
    253       catch (xios::CException & exc) 
    254       { 
    255          std::cerr << exc.getMessage() << std::endl; 
    256          exit (EXIT_FAILURE); 
    257       } 
    258    } 
     243//   void cxios_xml_tree_show   (const char * filename, int filename_size)  
     244//   { 
     245//      std::string filename_str; 
     246//      try 
     247//      { 
     248//         if (cstr2string(filename, filename_size, filename_str)) 
     249//            xios::CTreeManager::PrintTreeToFile(filename_str); 
     250//         else 
     251//            xios::CTreeManager::PrintTreeToStream(std::clog); 
     252//      } 
     253//      catch (xios::CException & exc) 
     254//      { 
     255//         std::cerr << exc.getMessage() << std::endl; 
     256//         exit (EXIT_FAILURE); 
     257//      } 
     258//  } 
    259259      
    260260    
    261261   // ----------------------- Parsing de document xml -------------------------- 
    262262    
    263    void cxios_xml_parse_file  (const char * filename  , int filename_size) 
    264    { 
    265       std::string filename_str;  
    266       if (!cstr2string(filename, filename_size, filename_str)) return; 
    267  
    268       try 
    269       { 
    270          xios::CTreeManager::ParseFile(filename_str); 
    271       } 
    272       catch (xios::CException & exc) 
    273       { 
    274          std::cerr << exc.getMessage() << std::endl; 
    275          exit (EXIT_FAILURE); 
    276       } 
    277    } 
    278     
    279    void cxios_xml_parse_string(const char * xmlcontent, int xmlcontent_size) 
    280    { 
    281       std::string xmlcontent_str;  
    282       if (!cstr2string(xmlcontent, xmlcontent_size, xmlcontent_str)) return; 
    283  
    284       try 
    285       { 
    286          xios::CTreeManager::ParseString(xmlcontent_str); 
    287       } 
    288       catch (xios::CException & exc) 
    289       { 
    290          std::cerr << exc.getMessage() << std::endl; 
    291          exit (EXIT_FAILURE); 
    292       } 
    293    } 
     263//   void cxios_xml_parse_file  (const char * filename  , int filename_size)// 
     264//   { 
     265//      std::string filename_str;  
     266//      if (!cstr2string(filename, filename_size, filename_str)) return; 
     267// 
     268//      try 
     269//      { 
     270//         xios::CTreeManager::ParseFile(filename_str); 
     271//      } 
     272//      catch (xios::CException & exc) 
     273//      { 
     274//         std::cerr << exc.getMessage() << std::endl; 
     275//         exit (EXIT_FAILURE); 
     276//      } 
     277//   } 
     278    
     279//   void cxios_xml_parse_string(const char * xmlcontent, int xmlcontent_size) 
     280//   { 
     281//      std::string xmlcontent_str;  
     282//      if (!cstr2string(xmlcontent, xmlcontent_size, xmlcontent_str)) return; 
     283// 
     284//      try 
     285//      { 
     286//         xios::CTreeManager::ParseString(xmlcontent_str); 
     287//      } 
     288//      catch (xios::CException & exc) 
     289//      { 
     290//         std::cerr << exc.getMessage() << std::endl; 
     291//         exit (EXIT_FAILURE); 
     292//      } 
     293//   } 
    294294    
    295295 
  • XIOS/trunk/src/manager/tree_manager.cpp

    r345 r346  
    1717      boost::shared_ptr<CContext> CTreeManager::CreateContext(const StdString & id) 
    1818      { 
    19          boost::shared_ptr<CContextGroup> group_context = CContext::GetContextGroup(); 
     19         boost::shared_ptr<CContextGroup> group_context = CContext::getRoot(); 
    2020         CTreeManager::SetCurrentContextId(id); 
    2121         bool hasctxt = CObjectFactory::HasObject<CContext>(id); 
     
    7979            CObjectFactory::GetCurrentContextId(); 
    8080         std::vector<boost::shared_ptr<CContext> > def_vector = 
    81             CContext::GetContextGroup()->getChildList(); 
     81            CContext::getRoot()->getChildList(); 
    8282             
    8383         const StdSize size = def_vector.size();          
     
    116116         ENodeType renum = Unknown; 
    117117          
    118          boost::shared_ptr<CContextGroup> group_context = 
    119                            CContext::GetContextGroup(); 
     118         boost::shared_ptr<CContextGroup> group_context = CContext::getRoot(); 
    120119                            
    121120         is.read (reinterpret_cast<char*>(&renum), sizeof(ENodeType));    
     
    172171         StdString currentContextId = 
    173172            CObjectFactory::GetCurrentContextId(); 
    174          std::vector<boost::shared_ptr<CContext> > def_vector = 
    175             CContext::GetContextGroup()->getChildList(); 
     173         std::vector<boost::shared_ptr<CContext> > def_vector = CContext::getRoot()->getChildList(); 
    176174             
    177175         const StdSize size = def_vector.size();          
     
    262260         ENodeType renum = Unknown; 
    263261          
    264          boost::shared_ptr<CContextGroup> group_context = 
    265                            CContext::GetContextGroup(); 
    266          std::vector<boost::shared_ptr<CContext> > def_vector = 
    267             CContext::GetContextGroup()->getChildList(); 
     262         boost::shared_ptr<CContextGroup> group_context = CContext::getRoot(); 
     263         std::vector<boost::shared_ptr<CContext> > def_vector = CContext::getRoot()->getChildList(); 
    268264             
    269265         const StdSize size = def_vector.size();   
  • XIOS/trunk/src/node/context.cpp

    r345 r346  
    1212#include "context_server.hpp" 
    1313#include "nc4_data_output.hpp" 
     14#include "node_type.hpp" 
    1415 
    1516namespace xios { 
     17   
     18  shared_ptr<CContextGroup> CContext::root ; 
    1619    
    1720   /// ////////////////////// Définitions ////////////////////// /// 
     
    4144   //---------------------------------------------------------------- 
    4245 
    43    boost::shared_ptr<CContextGroup> CContext::GetContextGroup(void) 
     46   boost::shared_ptr<CContextGroup> CContext::getRoot(void) 
    4447   {   
    45       static boost::shared_ptr<CContextGroup> group_context 
    46                           (new CContextGroup(xml::CXMLNode::GetRootName())); 
    47       return (group_context);  
     48      if (root.get()==NULL) root=shared_ptr<CContextGroup>(new CContextGroup(xml::CXMLNode::GetRootName())) ; 
     49      return root;  
    4850   } 
    4951    
     
    134136#define DECLARE_NODE(Name_, name_)    \ 
    135137   if (name.compare(C##Name_##Definition::GetDefName()) == 0) \ 
    136    { CObjectFactory::CreateObject<C##Name_##Definition>(C##Name_##Definition::GetDefName()) -> parse(node); \ 
    137    continue; } 
     138   { C##Name_##Definition::create(C##Name_##Definition::GetDefName()) -> parse(node) ; continue; } 
    138139#define DECLARE_NODE_PAR(Name_, name_) 
    139140#include "node_type.conf" 
    140141 
    141142            DEBUG(<< "L'élément nommé \'"     << name 
    142                   << "\' dans le contexte \'" << CObjectFactory::GetCurrentContextId() 
     143                  << "\' dans le contexte \'" << CContext::getCurrent()->getId() 
    143144                  << "\' ne représente pas une définition !"); 
    144145 
     
    153154   void CContext::ShowTree(StdOStream & out) 
    154155   { 
    155       StdString currentContextId = 
    156          CObjectFactory::GetCurrentContextId(); 
     156      StdString currentContextId = CContext::getCurrent() -> getId() ; 
    157157      std::vector<boost::shared_ptr<CContext> > def_vector = 
    158          CContext::GetContextGroup()->getChildList(); 
     158         CContext::getRoot()->getChildList(); 
    159159      std::vector<boost::shared_ptr<CContext> >::iterator 
    160160         it = def_vector.begin(), end = def_vector.end(); 
     
    166166      { 
    167167         boost::shared_ptr<CContext> context = *it;          
    168          CTreeManager::SetCurrentContextId(context->getId());          
     168         CContext::setCurrent(context->getId());          
    169169         out << *context << std::endl; 
    170170      } 
    171171       
    172172      out << "</" << xml::CXMLNode::GetRootName() << " >" << std::endl; 
    173       CTreeManager::SetCurrentContextId(currentContextId);   
     173      CContext::setCurrent(currentContextId);   
    174174   } 
    175175    
     
    179179   { 
    180180      SuperClass::toBinary(os); 
    181         
     181 
    182182#define DECLARE_NODE(Name_, name_)                                         \ 
    183183   {                                                                       \ 
    184184      ENodeType renum = C##Name_##Definition::GetType();                   \ 
    185       bool val = CObjectFactory::HasObject<C##Name_##Definition>           \ 
    186                      (C##Name_##Definition::GetDefName());                 \ 
     185      bool val = C##Name_##Definition::has(C##Name_##Definition::GetDefName()); \ 
    187186      os.write (reinterpret_cast<const char*>(&renum), sizeof(ENodeType)); \ 
    188187      os.write (reinterpret_cast<const char*>(&val), sizeof(bool));        \ 
    189       if (val) CObjectFactory::GetObject<C##Name_##Definition>             \ 
    190                      (C##Name_##Definition::GetDefName())->toBinary(os);   \ 
     188      if (val) C##Name_##Definition::get(C##Name_##Definition::GetDefName())->toBinary(os);   \ 
    191189   }    
    192190#define DECLARE_NODE_PAR(Name_, name_) 
     
    208206         ERROR("CContext::fromBinary(StdIStream & is)",                    \ 
    209207               << "[ renum = " << renum << "] Bad type !");                \ 
    210       if (val) CObjectFactory::CreateObject<C##Name_##Definition>          \ 
    211                    (C##Name_##Definition::GetDefName()) -> fromBinary(is); \ 
     208      if (val) C##Name_##Definition::create(C##Name_##Definition::GetDefName()) -> fromBinary(is); \ 
    212209   }    
    213210#define DECLARE_NODE_PAR(Name_, name_) 
     
    233230 
    234231#define DECLARE_NODE(Name_, name_)    \ 
    235    if (CObjectFactory::HasObject<C##Name_##Definition>(C##Name_##Definition::GetDefName())) \ 
    236    oss << *CObjectFactory::GetObject<C##Name_##Definition>(C##Name_##Definition::GetDefName()) << std::endl; 
     232   if (C##Name_##Definition::has(C##Name_##Definition::GetDefName())) \ 
     233   oss << * C##Name_##Definition::get(C##Name_##Definition::GetDefName()) << std::endl; 
    237234#define DECLARE_NODE_PAR(Name_, name_) 
    238235#include "node_type.conf" 
     
    250247   { 
    251248#define DECLARE_NODE(Name_, name_)    \ 
    252    if (CObjectFactory::HasObject<C##Name_##Definition>(C##Name_##Definition::GetDefName())) \ 
    253    CObjectFactory::GetObject<C##Name_##Definition>(C##Name_##Definition::GetDefName())->solveDescInheritance(); 
     249   if (C##Name_##Definition::has(C##Name_##Definition::GetDefName())) \  
     250     C##Name_##Definition::get(C##Name_##Definition::GetDefName())->solveDescInheritance(); 
    254251#define DECLARE_NODE_PAR(Name_, name_) 
    255252#include "node_type.conf" 
     
    262259      return ( 
    263260#define DECLARE_NODE(Name_, name_)    \ 
    264    CObjectFactory::HasObject<C##Name_##Definition>  (C##Name_##Definition::GetDefName())   || 
     261   C##Name_##Definition::has(C##Name_##Definition::GetDefName())   || 
    265262#define DECLARE_NODE_PAR(Name_, name_) 
    266263#include "node_type.conf" 
     
    273270   { 
    274271      if (!this->hasId()) return; 
    275       std::vector<boost::shared_ptr<CField> > allField 
     272      std::vector<boost::shared_ptr<CField> >& allField 
    276273               = CObjectTemplate<CField>::GetAllVectobject(this->getId()); 
    277274      std::vector<boost::shared_ptr<CField> >::iterator  
     
    379376 
    380377     // Résolution des héritages par référence au niveau des fichiers. 
    381       const std::vector<boost::shared_ptr<CFile> > & allFiles 
    382              = CObjectFactory::GetObjectVector<CFile>(); 
     378      const std::vector<boost::shared_ptr<CFile> > & allFiles=CFile::getAll() ; 
    383379 
    384380      for (unsigned int i = 0; i < allFiles.size(); i++) 
     
    388384   void CContext::findEnabledFiles(void) 
    389385   { 
    390       const std::vector<boost::shared_ptr<CFile> > & allFiles 
    391           = CObjectFactory::GetObjectVector<CFile>(); 
     386      const std::vector<boost::shared_ptr<CFile> > & allFiles = CFile::getAll(); 
    392387 
    393388      for (unsigned int i = 0; i < allFiles.size(); i++) 
     
    541536   }  
    542537    
    543    shared_ptr<CContext> CContext::current(void) 
     538   shared_ptr<CContext> CContext::getCurrent(void) 
    544539   { 
    545540     return CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
    546541   } 
    547542    
     543   void CContext::setCurrent(const string& id) 
     544   { 
     545     CObjectFactory::SetCurrentContextId(id); 
     546     CGroupFactory::SetCurrentContextId(id); 
     547   } 
     548    
     549  boost::shared_ptr<CContext> CContext::create(const StdString& id) 
     550  { 
     551    CContext::setCurrent(id) ; 
     552  
     553    bool hasctxt = CContext::has(id); 
     554    boost::shared_ptr<CContext> context = CObjectFactory::CreateObject<CContext>(id); 
     555    if (!hasctxt) CGroupFactory::AddChild(getRoot(), context); 
     556 
     557#define DECLARE_NODE(Name_, name_) \ 
     558    C##Name_##Definition::create(C##Name_##Definition::GetDefName()); 
     559#define DECLARE_NODE_PAR(Name_, name_) 
     560#include "node_type.conf" 
     561 
     562    return (context); 
     563  } 
    548564} // namespace xios 
  • XIOS/trunk/src/node/context.hpp

    r345 r346  
    127127         static void recvCreateFileHeader(CEventServer& event) ; 
    128128         void recvCreateFileHeader(CBufferIn& buffer) ; 
    129          static shared_ptr<CContext> current(void) ; 
     129         static shared_ptr<CContext> getCurrent(void) ; 
     130         static shared_ptr<CContextGroup> getRoot(void) ; 
     131         static void setCurrent(const string& id) ; 
     132         static shared_ptr<CContext> create(const string& id = "") ; 
    130133          
    131134      public : 
     
    143146  
    144147         std::vector<boost::shared_ptr<CFile> > enabledFiles; 
     148         static shared_ptr<CContextGroup> root ; 
    145149 
    146150 
  • XIOS/trunk/src/node/domain.cpp

    r345 r346  
    635635   { 
    636636      if (this->isChecked) return; 
    637       shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     637      shared_ptr<CContext> context=CContext::getCurrent() ; 
    638638 
    639639      this->checkGlobalDomain(); 
     
    696696    int jend_srv ; 
    697697     
    698     shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     698    shared_ptr<CContext> context=CContext::getCurrent() ; 
    699699    CContextClient* client=context->client ; 
    700700    int nbServer=client->serverSize ; 
     
    738738    jbegin_client=jbegin.getValue() ; jend_client=jend.getValue() ; nj_client=nj.getValue() ; 
    739739      
    740     shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     740    shared_ptr<CContext> context = CContext::getCurrent() ; 
    741741    CContextClient* client=context->client ; 
    742742    int nbServer=client->serverSize ; 
     
    847847  void CDomain::sendLonLat(void) 
    848848  { 
    849     shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     849    shared_ptr<CContext> context = CContext::getCurrent() ; 
    850850    CContextClient* client=context->client ; 
    851851    // send lon lat for each connected server 
  • XIOS/trunk/src/node/field.cpp

    r345 r346  
    9494  void CField::sendUpdateData(void) 
    9595  { 
    96     shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     96    shared_ptr<CContext> context = CContext::getCurrent() ; 
    9797    CContextClient* client=context->client ; 
    9898     
     
    150150    } 
    151151 
    152     shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     152    shared_ptr<CContext> context = CContext::getCurrent() ; 
    153153    const CDate & currDate = context->getCalendar()->getCurrentDate(); 
    154154    const CDate opeDate      = *last_operation_srv + freq_operation_srv; 
     
    187187      getRelFile()->checkFile(); 
    188188      this->incrementNStep(); 
    189       getRelFile()->getDataOutput()->writeFieldData(CObjectFactory::GetObject<CField>(this)); 
     189      getRelFile()->getDataOutput()->writeFieldData(CField::get(this)); 
    190190    } 
    191191  } 
     
    239239         return (this->getBaseFieldReference()); 
    240240 
    241       if (! CObjectFactory::HasObject<CField>(this->field_ref.getValue())) 
     241      if (! CField::has(this->field_ref.getValue())) 
    242242         ERROR("CField::getDirectFieldReference(void)", 
    243243               << "[ ref_name = " << this->field_ref.getValue() << "]" 
    244244               << " invalid field name !"); 
    245245 
    246       return (CObjectFactory::GetObject<CField>(this->field_ref.getValue())); 
     246      return (CField::get(this->field_ref.getValue())); 
    247247   } 
    248248 
     
    328328      CField * refer_ptr = this; 
    329329       
    330       this->baseRefObject = CObjectFactory::GetObject<CField>(this); 
     330      this->baseRefObject = CField::get(this); 
    331331       
    332332      while (refer_ptr->hasDirectFieldReference()) 
     
    356356        
    357357      StdString id = this->getBaseFieldReference()->getId(); 
    358       boost::shared_ptr<CContext> context = 
    359          CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()); 
     358      boost::shared_ptr<CContext> context = CContext::getCurrent(); 
    360359 
    361360      if (operation.isEmpty() || freq_op.isEmpty() || this->file->output_freq.isEmpty()) 
     
    448447      if (!domain_ref.isEmpty()) 
    449448      { 
    450          if (CObjectFactory::HasObject<CDomain>(domain_ref.getValue())) 
    451             domain = CObjectFactory::GetObject<CDomain>(domain_ref.getValue()) ; 
     449         if (CDomain::has(domain_ref.getValue())) 
     450            domain = CDomain::get(domain_ref.getValue()) ; 
    452451         else 
    453452            ERROR("CField::solveGridReference(void)", 
     
    458457      if (!axis_ref.isEmpty()) 
    459458      { 
    460          if (CObjectFactory::HasObject<CAxis>(axis_ref.getValue())) 
    461             axis = CObjectFactory::GetObject<CAxis>(axis_ref.getValue()) ; 
     459         if (CAxis::has(axis_ref.getValue())) 
     460            axis = CAxis::get(axis_ref.getValue()) ; 
    462461         else 
    463462            ERROR("CField::solveGridReference(void)", 
     
    468467      if (!grid_ref.isEmpty()) 
    469468      { 
    470          if (CObjectFactory::HasObject<CGrid>(grid_ref.getValue())) 
    471             this->grid = CObjectFactory::GetObject<CGrid>(grid_ref.getValue()) ; 
     469         if (CGrid::has(grid_ref.getValue())) 
     470            this->grid = CGrid::get(grid_ref.getValue()) ; 
    472471         else 
    473472            ERROR("CField::solveGridReference(void)", 
     
    514513      StdString gref = this->group_ref.getValue(); 
    515514 
    516       if (!CObjectFactory::HasObject<CFieldGroup>(gref)) 
     515      if (!CFieldGroup::has(gref)) 
    517516         ERROR("CGroupTemplate<CField, CFieldGroup, CFieldAttributes>::solveRefInheritance(void)", 
    518517               << "[ gref = " << gref << "]" 
    519518               << " invalid group name !"); 
    520519 
    521       boost::shared_ptr<CFieldGroup> group 
    522                = CObjectFactory::GetObject<CFieldGroup>(gref); 
    523       boost::shared_ptr<CFieldGroup> owner 
    524                = CObjectFactory::GetObject<CFieldGroup> 
    525                   (boost::polymorphic_downcast<CFieldGroup*>(this)); 
     520      boost::shared_ptr<CFieldGroup> group = CFieldGroup::get(gref); 
     521      boost::shared_ptr<CFieldGroup> owner = CFieldGroup::get(boost::polymorphic_downcast<CFieldGroup*>(this)); 
    526522 
    527523      std::vector<boost::shared_ptr<CField> > allChildren  = group->getAllChildren(); 
     
    532528      { 
    533529         boost::shared_ptr<CField> child = *it; 
    534          if (child->hasId()) 
    535             CGroupFactory::CreateChild(owner)->field_ref.setValue(child->getId()); 
     530         if (child->hasId()) owner->createChild()->field_ref.setValue(child->getId()) ; 
     531             
    536532      } 
    537533   } 
  • XIOS/trunk/src/node/file.cpp

    r345 r346  
    101101         (*it)->refObject.push_back(*it); 
    102102         // Le champ est finalement actif, on y ajoute la référence au champ de base. 
    103          (*it)->setRelFile(CObjectFactory::GetObject(this)); 
     103         (*it)->setRelFile(CFile::get(this)); 
    104104         (*it)->baseRefObject->refObject.push_back(*it); 
    105105         // A faire, ajouter les references intermediaires... 
     
    121121   void CFile::setVirtualFieldGroup(void) 
    122122   { 
    123       this->setVirtualFieldGroup 
    124          (CObjectFactory::CreateObject<CFieldGroup>()); 
     123      this->setVirtualFieldGroup(CFieldGroup::create()); 
    125124   } 
    126125 
     
    128127   bool CFile::isSyncTime(void) 
    129128   { 
    130      shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     129     shared_ptr<CContext> context = CContext::getCurrent() ; 
    131130     CDate& currentDate=context->calendar->getCurrentDate() ; 
    132131     if (! sync_freq.isEmpty()) 
     
    143142   void CFile::initFile(void) 
    144143   { 
    145       shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     144      shared_ptr<CContext> context = CContext::getCurrent() ; 
    146145      CDate& currentDate=context->calendar->getCurrentDate() ; 
    147146       
     
    164163   bool CFile::checkSync(void) 
    165164   { 
    166      shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     165     shared_ptr<CContext> context = CContext::getCurrent() ; 
    167166     CDate& currentDate=context->calendar->getCurrentDate() ; 
    168167     if (! sync_freq.isEmpty()) 
     
    181180    bool CFile::checkSplit(void) 
    182181    { 
    183       shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     182      shared_ptr<CContext> context = CContext::getCurrent() ; 
    184183      CDate& currentDate=context->calendar->getCurrentDate() ; 
    185184      if (! split_freq.isEmpty()) 
     
    200199   void CFile::createHeader(void) 
    201200   { 
    202       shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     201      shared_ptr<CContext> context = CContext::getCurrent() ; 
    203202      CDate& currentDate=context->calendar->getCurrentDate() ; 
    204203       
     
    258257         isOpen=true ; 
    259258 
    260          data_out->writeFile(CObjectFactory::GetObject<CFile>(this)); 
     259         data_out->writeFile(CFile::get(this)); 
    261260         for (it = this->enabledFields.begin() ;it != end; it++) 
    262261         { 
     
    395394   void CFile::sendAddField(const string& id) 
    396395   { 
    397     shared_ptr<CContext> context=CContext::current() ; 
     396    shared_ptr<CContext> context=CContext::getCurrent() ; 
    398397     
    399398    if (! context->hasServer ) 
     
    417416   void CFile::sendAddFieldGroup(const string& id) 
    418417   { 
    419     shared_ptr<CContext> context=CContext::current() ; 
     418    shared_ptr<CContext> context=CContext::getCurrent() ; 
    420419    if (! context->hasServer ) 
    421420    { 
  • XIOS/trunk/src/node/grid.cpp

    r345 r346  
    158158   { 
    159159      if (this->isChecked) return; 
    160       shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     160      shared_ptr<CContext> context = CContext::getCurrent() ; 
    161161      CContextClient* client=context->client ; 
    162162       
     
    187187      if (!domain_ref.isEmpty()) 
    188188      { 
    189          if (CObjectFactory::HasObject<CDomain>(domain_ref.getValue())) 
    190          { 
    191             this->domain = CObjectFactory::GetObject<CDomain>(domain_ref.getValue()) ; 
     189         if (CDomain::has(domain_ref.getValue())) 
     190         { 
     191            this->domain = CDomain::get(domain_ref.getValue()) ; 
    192192            domain->checkAttributes() ; 
    193193         } 
     
    206206      { 
    207207         this->withAxis = true ; 
    208          if (CObjectFactory::GetObject<CAxis>(axis_ref.getValue())) 
    209          { 
    210             this->axis = CObjectFactory::GetObject<CAxis>(axis_ref.getValue()) ; 
     208         if (CAxis::get(axis_ref.getValue())) 
     209         { 
     210            this->axis = CAxis::get(axis_ref.getValue()) ; 
    211211            axis->checkAttributes() ; 
    212212         } 
     
    310310   { 
    311311      StdString new_id = StdString("__") + domain->getId() + StdString("__") ; 
    312       boost::shared_ptr<CGrid> grid = 
    313          CGroupFactory::CreateChild(CObjectFactory::GetObject<CGridGroup> ("grid_definition"), new_id); 
     312      boost::shared_ptr<CGrid> grid = CGridGroup::get("grid_definition")->createChild(new_id) ; 
    314313      grid->domain_ref.setValue(domain->getId()); 
    315314      return (grid); 
     
    321320      StdString new_id = StdString("__") + domain->getId() + 
    322321                         StdString("_") + axis->getId() + StdString("__") ; 
    323       boost::shared_ptr<CGrid> grid = 
    324          CGroupFactory::CreateChild(CObjectFactory::GetObject<CGridGroup> ("grid_definition"), new_id); 
     322      boost::shared_ptr<CGrid> grid = CGridGroup::get("grid_definition")->createChild(new_id) ; 
    325323      grid->domain_ref.setValue(domain->getId()); 
    326324      grid->axis_ref.setValue(axis->getId()); 
     
    418416  void CGrid::sendIndex(void) 
    419417  { 
    420     shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     418    shared_ptr<CContext> context = CContext::getCurrent() ; 
    421419    CContextClient* client=context->client ; 
    422420     
  • XIOS/trunk/src/node/variable.cpp

    r345 r346  
    8383   { 
    8484      boost::shared_ptr<CVariableGroup> group_ptr = (this->hasId()) 
    85          ? CObjectFactory::GetObject<CVariableGroup>(this->getId()) 
    86          : CObjectFactory::GetObject(this); 
     85         ? CVariableGroup::get(this->getId()) : CVariableGroup::get(this); 
    8786 
    8887      StdString content; 
     
    101100           subdata   = content.substr ( begindata, enddata-begindata); 
    102101 
    103            CGroupFactory::CreateChild(group_ptr, subid)->content = subdata; 
     102           group_ptr->createChild(subid)->content = subdata ; 
    104103        } 
    105104      } 
  • XIOS/trunk/src/object_template.hpp

    r345 r346  
    6767          
    6868         static bool has(const string& id) ; 
     69         static bool has(const string& contextId, const string& id) ; 
    6970         static boost::shared_ptr<T> get(const string& id) ; 
     71         static boost::shared_ptr<T> get(const T* ptr) ; 
     72         static boost::shared_ptr<T> get(const string& contextId, const string& id) ; 
    7073         boost::shared_ptr<T> get(void) ; 
    7174         static boost::shared_ptr<T> create(const string& id=string("")) ; 
    72           
     75         static const vector< boost::shared_ptr<T> >& getAll() ; 
     76         static const vector< boost::shared_ptr<T> >& getAll(const string& contextId) ; 
     77         
    7378         void generateCInterface(ostream& oss) ; 
    7479         void generateFortran2003Interface(ostream& oss) ; 
  • XIOS/trunk/src/object_template_impl.hpp

    r345 r346  
    146146   { 
    147147      std::vector<boost::shared_ptr<T> > & avect = 
    148          CObjectTemplate<T>::GetAllVectobject(CObjectFactory::GetCurrentContextId()); 
     148         CObjectTemplate<T>::GetAllVectobject(CContext::getCurrent()->getId()); 
    149149      typename std::vector<boost::shared_ptr<T> >::iterator 
    150150            it = avect.begin(), end = avect.end(); 
     
    168168   void CObjectTemplate<T>::sendAttributToServer(CAttribute& attr) 
    169169   { 
    170      shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     170     shared_ptr<CContext> context=CContext::getCurrent() ; 
    171171      
    172172    if (!context->hasServer) 
     
    232232 
    233233   template <typename T> 
     234   bool CObjectTemplate<T>::has(const string& contextId, const string & id) 
     235   { 
     236     return CObjectFactory::HasObject<T>(contextId,id) ; 
     237   } 
     238 
     239   template <typename T> 
    234240   boost::shared_ptr<T> CObjectTemplate<T>::get(const string & id) 
    235241   { 
    236242     return CObjectFactory::GetObject<T>(id) ; 
     243   } 
     244 
     245   template <typename T> 
     246   boost::shared_ptr<T> CObjectTemplate<T>::get(const T* ptr) 
     247   { 
     248     return CObjectFactory::GetObject<T>(ptr) ; 
     249   } 
     250    
     251    
     252   template <typename T> 
     253   const vector<boost::shared_ptr<T> >& CObjectTemplate<T>::getAll() 
     254   { 
     255     return CObjectFactory::GetObjectVector<T>() ; 
     256   } 
     257 
     258   template <typename T> 
     259   const vector<boost::shared_ptr<T> >& CObjectTemplate<T>::getAll(const string & id) 
     260   { 
     261     return CObjectFactory::GetObjectVector<T>(id) ; 
     262   } 
     263 
     264   template <typename T> 
     265   boost::shared_ptr<T> CObjectTemplate<T>::get(const string& contextId, const string & id) 
     266   { 
     267     return CObjectFactory::GetObject<T>(contextId,id) ; 
    237268   } 
    238269 
     
    247278  { 
    248279    return CObjectFactory::GetObject<T>((T*)this) ; 
     280//      return shared_ptr<T>((T*)this) ; 
    249281  } 
    250282   
  • XIOS/trunk/src/output/nc4_data_output.cpp

    r345 r346  
    5757      void CNc4DataOutput::writeDomain_(const boost::shared_ptr<CDomain> domain) 
    5858      { 
    59          shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     59         shared_ptr<CContext> context = CContext::getCurrent() ; 
    6060         CContextServer* server=context->server ; 
    6161          
     
    271271      void CNc4DataOutput::writeField_(const boost::shared_ptr<CField> field) 
    272272      { 
    273          shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     273         shared_ptr<CContext> context = CContext::getCurrent() ; 
    274274         CContextServer* server=context->server ; 
    275275 
     
    463463      void CNc4DataOutput::writeFieldData_ (const boost::shared_ptr<CField>  field) 
    464464      { 
    465          shared_ptr<CContext> context=CObjectFactory::GetObject<CContext>(CObjectFactory::GetCurrentContextId()) ; 
     465         shared_ptr<CContext> context = CContext::getCurrent() ; 
    466466//          if (field->getRelFile()->isSyncTime()) SuperClassWriter::sync() ; 
    467467 
  • XIOS/trunk/src/server.cpp

    r345 r346  
    346346              <<"Context has already been registred") ; 
    347347       
    348       shared_ptr<CContext> context=CTreeManager::CreateContext(contextId) ; 
     348      shared_ptr<CContext> context=CContext::create(contextId) ; 
    349349      contextList[contextId]=context.get() ; 
    350350      context->initServer(intraComm,contextIntercomm) ; 
  • XIOS/trunk/src/test/test_xios.cpp

    r342 r346  
    6868//     CClient::registerContext("tata",CClient::intraComm) ; 
    6969     CClient::registerContext("tutu",CClient::intraComm) ; 
    70      CObjectFactory::SetCurrentContextId("tutu") ; 
    71      CContext*  tutu=(CObjectFactory::GetObject<CContext>("tutu")).get();  
     70     CContext::setCurrent("tutu") ; 
     71     CContext*  tutu=CContext::get("tutu").get() ;  
    7272      
    7373      
    74      CObjectFactory::SetCurrentContextId("toto") ; 
    75      CContext*  toto=(CObjectFactory::GetObject<CContext>("toto")).get();  
     74     CContext::setCurrent("toto") ; 
     75     CContext*  toto=(CContext::get("toto").get() ; 
    7676     toto->calendar_type.setValue("NoLeap") ; 
    7777     toto->sendAttributToServer("calendar_type" ); 
     
    101101     CXios::initClientSide("test2") ; 
    102102     CClient::registerContext("tito",CClient::intraComm) ; 
    103      CObjectFactory::SetCurrentContextId("tito") ; 
    104      CContext*  tito=(CObjectFactory::GetObject<CContext>("tito")).get(); 
     103     CContext::setCurrent("tito") ; 
     104     CContext*  tito=CContext::get("tito").get() ; 
    105105       
    106106     CClient::registerContext("tete",CClient::intraComm) ; 
    107      CObjectFactory::SetCurrentContextId("tete") ; 
    108      CContext*  tete=(CObjectFactory::GetObject<CContext>("tete")).get();  
     107     CContext::setCurrent("tete") ; 
     108     CContext*  tete=CContext::get("tete").get() ;  
    109109 
    110110     tito->client->finalize() ; 
     
    116116     CXios::initClientSide("test3") ; 
    117117     CClient::registerContext("turlututu",CClient::intraComm) ; 
    118      CObjectFactory::SetCurrentContextId("turlututu") ; 
    119      CContext*  turlututu=(CObjectFactory::GetObject<CContext>("turlututu")).get();  
     118     CContext::setCurrent("turlututu") ; 
     119     CContext*  turlututu=CContext::get("turlututu").get() ;  
    120120     turlututu->client->finalize() ; 
    121121     CXios::clientFinalize() ; 
  • XIOS/trunk/src/xml_parser.cpp

    r345 r346  
    5252               do 
    5353               { 
    54                   boost::shared_ptr<CContextGroup> group_context = 
    55                                     CContext::GetContextGroup(); 
     54                  boost::shared_ptr<CContextGroup> group_context = CContext::getRoot() ; 
     55  
    5656                  attributes = node.getAttributes(); 
    5757 
     
    6262                  } 
    6363 
    64                   CObjectFactory::SetCurrentContextId(attributes["id"]); 
    65                   CGroupFactory::SetCurrentContextId(attributes["id"]); 
     64                  CContext::setCurrent(attributes["id"]) ; 
    6665 
    67                   bool hasctxt = CObjectFactory::HasObject<CContext>(attributes["id"]); 
     66                  bool hasctxt = CContext::has(attributes["id"]); 
    6867 
    6968                  if(hasctxt) 
     
    7473                  } 
    7574 
    76                   boost::shared_ptr<CContext> context = 
    77                      CObjectFactory::CreateObject<CContext>(attributes["id"]); 
    78                   if (!hasctxt) CGroupFactory::AddChild(group_context, context); 
     75                  boost::shared_ptr<CContext> context = CContext::create(attributes["id"]); 
     76//                  if (!hasctxt)  group_context->addChild(context); 
    7977                  context->parse(node); 
    8078 
Note: See TracChangeset for help on using the changeset viewer.