source: XIOS/dev/dev_ym/XIOS_COUPLING/src/object_factory.hpp @ 2270

Last change on this file since 2270 was 2265, checked in by ymipsl, 3 years ago

tracking memory leak : remove context and all related object from object factory when context is finalized.
YM

  • Property copyright set to
    Software name : XIOS (Xml I/O Server)
    http://forge.ipsl.jussieu.fr/ioserver
    Creation date : January 2009
    Licence : CeCCIL version2
    see license file in root directory : Licence_CeCILL_V2-en.txt
    or http://www.cecill.info/licences/Licence_CeCILL_V2-en.html
    Holder : CEA/LSCE (Laboratoire des Sciences du CLimat et de l'Environnement)
    CNRS/IPSL (Institut Pierre Simon Laplace)
    Project Manager : Yann Meurdesoif
    yann.meurdesoif@cea.fr
File size: 2.3 KB
Line 
1#ifndef __XIOS_CObjectFactory__
2#define __XIOS_CObjectFactory__
3
4#include <memory>
5
6/// XIOS headers ///
7#include "xios_spl.hpp"
8#include "exception.hpp"
9#include "object_template.hpp"
10
11namespace xios
12{
13   /// ////////////////////// Déclarations ////////////////////// ///
14   class CObjectFactory
15   {
16      public :
17
18         /// Mutateurs ///
19         static void SetCurrentContextId(const StdString & context);
20
21         /// Accesseurs ///
22         static StdString & GetCurrentContextId(void);
23
24         template <typename U>
25            static  std::shared_ptr<U> GetObject(const StdString & id);
26
27         template <typename U>
28            static  std::shared_ptr<U> GetObject(const StdString& context,const StdString & id);
29
30         template <typename U>
31            static  std::shared_ptr<U> GetObject(const U * const object);
32
33         template <typename U>
34            static  int GetObjectNum(void);
35         template <typename U>
36            static  int GetObjectIdNum(void);
37
38         template <typename U>
39            static  const std::vector<std::shared_ptr<U> > &
40               GetObjectVector(const StdString & context = CObjectFactory::GetCurrentContextId());
41
42         /// Tests ///
43         template <typename U>
44            static  bool HasObject(const StdString & id);
45
46         template <typename U>
47            static  bool HasObject(const StdString& context,const StdString & id);
48
49         /// Instanciateur ///
50         template <typename U>
51            static  std::shared_ptr<U> CreateObject(const StdString & id = StdString(""));
52 
53         template <typename U>
54             static std::shared_ptr<U> CreateAlias(const StdString& id, const StdString& alias) ;
55         
56         template <typename U> static const StdString GetUIdBase(void);
57         template <typename U> static StdString GenUId(void);
58         template <typename U> static bool IsGenUId(const StdString& id);
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) ;
62      private :
63
64         /// Propriétés statiques ///
65         static StdString CurrContext;
66
67   }; // class CObjectFactory
68} // namespace xios
69
70//#include "object_factory_impl.hpp"
71
72#endif // __XIOS_CObjectFactory__
Note: See TracBrowser for help on using the repository browser.