[591] | 1 | #ifndef __XIOS_CObjectFactory__ |
---|
| 2 | #define __XIOS_CObjectFactory__ |
---|
[219] | 3 | |
---|
| 4 | /// boost headers /// |
---|
| 5 | #include <boost/shared_ptr.hpp> |
---|
| 6 | |
---|
[591] | 7 | /// XIOS headers /// |
---|
| 8 | #include "xios_spl.hpp" |
---|
[219] | 9 | #include "exception.hpp" |
---|
| 10 | #include "object_template.hpp" |
---|
| 11 | |
---|
[335] | 12 | namespace xios |
---|
[219] | 13 | { |
---|
[1331] | 14 | /// ////////////////////// Déclarations ////////////////////// /// |
---|
| 15 | class CObjectFactory |
---|
| 16 | { |
---|
| 17 | public : |
---|
[219] | 18 | |
---|
[1331] | 19 | /// Mutateurs /// |
---|
| 20 | static void SetCurrentContextId(const StdString & context); |
---|
[219] | 21 | |
---|
[1331] | 22 | /// Accesseurs /// |
---|
| 23 | static StdString & GetCurrentContextId(void); |
---|
[219] | 24 | |
---|
[1331] | 25 | template <typename U> |
---|
| 26 | static boost::shared_ptr<U> GetObject(const StdString & id); |
---|
[219] | 27 | |
---|
[1331] | 28 | template <typename U> |
---|
| 29 | static boost::shared_ptr<U> GetObject(const StdString& context,const StdString & id); |
---|
[286] | 30 | |
---|
[1331] | 31 | template <typename U> |
---|
| 32 | static boost::shared_ptr<U> GetObject(const U * const object); |
---|
[219] | 33 | |
---|
[1331] | 34 | template <typename U> |
---|
| 35 | static int GetObjectNum(void); |
---|
| 36 | template <typename U> |
---|
| 37 | static int GetObjectIdNum(void); |
---|
[219] | 38 | |
---|
[1331] | 39 | template <typename U> |
---|
| 40 | static const std::vector<boost::shared_ptr<U> > & |
---|
| 41 | GetObjectVector(const StdString & context = CObjectFactory::GetCurrentContextId()); |
---|
[219] | 42 | |
---|
[1331] | 43 | /// Tests /// |
---|
| 44 | template <typename U> |
---|
| 45 | static bool HasObject(const StdString & id); |
---|
[219] | 46 | |
---|
[1331] | 47 | template <typename U> |
---|
| 48 | static bool HasObject(const StdString& context,const StdString & id); |
---|
[286] | 49 | |
---|
[1331] | 50 | /// Instanciateur /// |
---|
| 51 | template <typename U> |
---|
| 52 | static boost::shared_ptr<U> CreateObject(const StdString & id = StdString("")); |
---|
[219] | 53 | |
---|
[1331] | 54 | template <typename U> static const StdString& GetUIdBase(void); |
---|
| 55 | template <typename U> static StdString GenUId(void); |
---|
| 56 | template <typename U> static bool IsGenUId(const StdString& id); |
---|
[219] | 57 | |
---|
[1331] | 58 | private : |
---|
[219] | 59 | |
---|
[1331] | 60 | /// Propriétés statiques /// |
---|
[1334] | 61 | static StdString *CurrContext_ptr; |
---|
| 62 | #pragma omp threadprivate(CurrContext_ptr) |
---|
[219] | 63 | |
---|
[1331] | 64 | }; // class CObjectFactory |
---|
[335] | 65 | } // namespace xios |
---|
[219] | 66 | |
---|
[352] | 67 | //#include "object_factory_impl.hpp" |
---|
[219] | 68 | |
---|
[591] | 69 | #endif // __XIOS_CObjectFactory__ |
---|