object_factory.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef __XIOS_CObjectFactory__
  2. #define __XIOS_CObjectFactory__
  3. /// boost headers ///
  4. #include <boost/shared_ptr.hpp>
  5. /// XIOS headers ///
  6. #include "xios_spl.hpp"
  7. #include "exception.hpp"
  8. #include "object_template.hpp"
  9. namespace xios
  10. {
  11. /// ////////////////////// Déclarations ////////////////////// ///
  12. class CObjectFactory
  13. {
  14. public :
  15. /// Mutateurs ///
  16. static void SetCurrentContextId(const StdString & context);
  17. /// Accesseurs ///
  18. static StdString & GetCurrentContextId(void);
  19. template <typename U>
  20. static boost::shared_ptr<U> GetObject(const StdString & id);
  21. template <typename U>
  22. static boost::shared_ptr<U> GetObject(const StdString& context,const StdString & id);
  23. template <typename U>
  24. static boost::shared_ptr<U> GetObject(const U * const object);
  25. template <typename U>
  26. static int GetObjectNum(void);
  27. template <typename U>
  28. static int GetObjectIdNum(void);
  29. template <typename U>
  30. static const std::vector<boost::shared_ptr<U> > &
  31. GetObjectVector(const StdString & context = CObjectFactory::GetCurrentContextId());
  32. /// Tests ///
  33. template <typename U>
  34. static bool HasObject(const StdString & id);
  35. template <typename U>
  36. static bool HasObject(const StdString& context,const StdString & id);
  37. /// Instanciateur ///
  38. template <typename U>
  39. static boost::shared_ptr<U> CreateObject(const StdString & id = StdString(""));
  40. template <typename U> static const StdString& GetUIdBase(void);
  41. template <typename U> static StdString GenUId(void);
  42. template <typename U> static bool IsGenUId(const StdString& id);
  43. private :
  44. /// Propriétés statiques ///
  45. static StdString CurrContext;
  46. }; // class CObjectFactory
  47. } // namespace xios
  48. //#include "object_factory_impl.hpp"
  49. #endif // __XIOS_CObjectFactory__