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