[591] | 1 | #ifndef __XIOS_CGroupFactory__ |
---|
| 2 | #define __XIOS_CGroupFactory__ |
---|
[219] | 3 | |
---|
[591] | 4 | /// XIOS headers /// |
---|
| 5 | #include "xios_spl.hpp" |
---|
[219] | 6 | #include "exception.hpp" |
---|
| 7 | #include "object_factory.hpp" |
---|
| 8 | #include "group_template.hpp" |
---|
[278] | 9 | #include "xml_parser.hpp" |
---|
[219] | 10 | |
---|
[335] | 11 | namespace xios |
---|
[219] | 12 | { |
---|
| 13 | /// ////////////////////// Déclarations ////////////////////// /// |
---|
| 14 | class CGroupFactory |
---|
| 15 | { |
---|
| 16 | public : |
---|
| 17 | |
---|
| 18 | /// Mutateurs /// |
---|
| 19 | static void SetCurrentContextId(const StdString & context); |
---|
[2274] | 20 | static void clearCurrentContextId() {CurrContext.clear(); CurrContext.shrink_to_fit();} |
---|
[219] | 21 | |
---|
| 22 | template <typename U> |
---|
[1542] | 23 | static void AddGroup(std::shared_ptr<U> pgroup, |
---|
| 24 | std::shared_ptr<U> cgroup); |
---|
[219] | 25 | |
---|
| 26 | template <typename U> |
---|
[1542] | 27 | static void AddChild(std::shared_ptr<U> group, |
---|
| 28 | std::shared_ptr<typename U::RelChild> child); |
---|
[219] | 29 | |
---|
| 30 | /// Accesseurs /// |
---|
| 31 | static StdString & GetCurrentContextId(void); |
---|
| 32 | |
---|
| 33 | template <typename U> |
---|
[1542] | 34 | static std::shared_ptr<U> |
---|
| 35 | GetGroup(std::shared_ptr<U> group, const StdString & id); |
---|
[219] | 36 | |
---|
| 37 | template <typename U> |
---|
[1542] | 38 | static std::shared_ptr<typename U::RelChild> |
---|
| 39 | GetChild(std::shared_ptr<U> group, const StdString & id); |
---|
[219] | 40 | |
---|
| 41 | template <typename U> |
---|
[1542] | 42 | static int GetGroupNum(std::shared_ptr<U> group); |
---|
[219] | 43 | template <typename U> |
---|
[1542] | 44 | static int GetGroupIdNum(std::shared_ptr<U> group); |
---|
[219] | 45 | template <typename U> |
---|
[1542] | 46 | static int GetChildNum(std::shared_ptr<U> group); |
---|
[219] | 47 | template <typename U> |
---|
[1542] | 48 | static int GetChildIdNum(std::shared_ptr<U> group); |
---|
[219] | 49 | |
---|
| 50 | /// Tests /// |
---|
| 51 | template <typename U> |
---|
[1542] | 52 | static bool HasGroup(std::shared_ptr<U> group, const StdString & id); |
---|
[219] | 53 | |
---|
| 54 | template <typename U> |
---|
[1542] | 55 | static bool HasChild(std::shared_ptr<U> group, const StdString & id); |
---|
[219] | 56 | |
---|
| 57 | /// Instanciateur /// |
---|
| 58 | template <typename U> |
---|
[1542] | 59 | static std::shared_ptr<U> |
---|
| 60 | CreateGroup(std::shared_ptr<U> group, const StdString & id = StdString("")); |
---|
[219] | 61 | |
---|
| 62 | template <typename U> |
---|
[1542] | 63 | static std::shared_ptr<typename U::RelChild> |
---|
| 64 | CreateChild(std::shared_ptr<U> group, const StdString & id = StdString("")); |
---|
[219] | 65 | |
---|
| 66 | private : |
---|
| 67 | |
---|
| 68 | /// Propriétés statiques /// |
---|
| 69 | static StdString CurrContext; |
---|
| 70 | |
---|
| 71 | }; // class CGroupFactory |
---|
[335] | 72 | } // namespace xios |
---|
[219] | 73 | |
---|
[352] | 74 | //#include "group_factory_impl.hpp" |
---|
| 75 | //#include "group_parser.hpp" |
---|
[219] | 76 | |
---|
[591] | 77 | #endif // __XIOS_CGroupFactory__ |
---|