source: XMLIO_V2/dev/dev_rv/src/group_template_impl.hpp @ 148

Last change on this file since 148 was 141, checked in by hozdoba, 13 years ago

Mise à jour depuis un autre dépôt

File size: 4.1 KB
Line 
1#ifndef __XMLIO_CGroupTemplate_impl__
2#define __XMLIO_CGroupTemplate_impl__
3
4namespace xmlioserver
5{
6   using namespace tree;
7
8   /// ////////////////////// Définitions ////////////////////// ///
9
10   template <class U, class V, class W>
11      CGroupTemplate<U, V, W>::CGroupTemplate(void)
12         : CObjectTemplate<V>() //, V()
13         , childMap(), childList()
14         , groupMap(), groupList()
15   { /* Ne rien faire de plus */ }
16
17   template <class U, class V, class W>
18      CGroupTemplate<U, V, W>::CGroupTemplate(const StdString & id)
19         : CObjectTemplate<V>(id) //, V()
20         , childMap(), childList()
21         , groupMap(), groupList()
22   { /* Ne rien faire de plus */ }
23
24   template <class U, class V, class W>
25      CGroupTemplate<U, V, W>::~CGroupTemplate(void)
26   { /* Ne rien faire de plus */ }
27
28   template <class U, class V, class W>
29      StdString CGroupTemplate<U, V, W>::toString(void) const
30   {
31      StdOStringStream oss;
32      StdString name = (this->getId().compare(V::GetDefName()) != 0)
33                     ? V::GetName()
34                     : V::GetDefName();
35
36      oss << "< " << name << " ";
37      if (this->hasId() && (this->getId().compare(V::GetDefName()) != 0))
38         oss << " id=\"" << this->getId() << "\" ";
39      if (this->hasChild())
40      {
41         oss << SuperClassAttribute::toString() << ">" << std::endl;
42         BOOST_FOREACH(boost::shared_ptr<V> group, this->groupList)
43            oss << *group << std::endl;
44         BOOST_FOREACH(boost::shared_ptr<U> child, this->childList)
45            oss << *child << std::endl;
46         oss << "</ " << name << " >";
47      }
48      else
49      {
50         oss << SuperClassAttribute::toString() << "/>";
51      }
52      return (oss.str());
53   }
54
55   template <class U, class V, class W>
56      void CGroupTemplate<U, V, W>::fromString(const StdString & str)
57   { ERROR("CGroupTemplate<U, V, W>::toString(void)",
58            << "[ str = " << str << "] Not implemented yet !"); }
59
60   template <class U, class V, class W>
61      StdString CGroupTemplate<U, V, W>::GetName(void)
62   { return (U::GetName().append("_group")); }
63
64   template <class U, class V, class W>
65      StdString CGroupTemplate<U, V, W>::GetDefName(void)
66   { return (U::GetName().append("_definition")); }
67
68   template <class U, class V, class W>
69      const std::vector<boost::shared_ptr<U> >&
70         CGroupTemplate<U, V, W>::getChildList(void) const
71   { return (this->childList); }
72
73   template <class U, class V, class W>
74      const boost::unordered_map<StdString, boost::shared_ptr<V> >&
75         CGroupTemplate<U, V, W>::getGroupMap(void) const
76   { return (this->groupList); }
77
78   template <class U, class V, class W>
79      bool CGroupTemplate<U, V, W>::hasChild(void) const
80   { return ((groupList.size() + childList.size()) > 0); }
81
82   template <class U, class V, class W>
83      void CGroupTemplate<U, V, W>::parse(xml::CXMLNode & node)
84   { this->parse(node, true); }
85
86   template <class U, class V, class W>
87      void CGroupTemplate<U, V, W>::solveDescInheritance(const CAttributeMap * const parent)
88   {
89      if (parent != NULL)
90         SuperClassAttribute::setAttributes(parent);
91      BOOST_FOREACH(boost::shared_ptr<U> child, childList)
92      {
93         child->solveDescInheritance(this);
94      }
95      BOOST_FOREACH(boost::shared_ptr<V> group, groupList)
96      {
97         group->solveRefInheritance();
98         group->solveDescInheritance(this);
99      }
100   }
101
102   template <class U, class V, class W>
103      void CGroupTemplate<U, V, W>::getAllChildren(std::vector<boost::shared_ptr<U> > & allc) const
104   {
105      allc.insert (allc.end(), childList.begin(), childList.end());
106      BOOST_FOREACH(boost::shared_ptr<V> group, groupList)
107         group->getAllChildren(allc);
108   }
109
110   template <class U, class V, class W>
111      std::vector<boost::shared_ptr<U> > CGroupTemplate<U, V, W>::getAllChildren(void) const
112   { std::vector<boost::shared_ptr<U> > allc; this->getAllChildren(allc); return (allc); }
113
114   template <class U, class V, class W>
115      void CGroupTemplate<U, V, W>::solveRefInheritance(void)
116   { /* Ne rien faire de plus */ }
117
118} // namespace xmlioserver
119
120
121#endif // __XMLIO_CGroupTemplate_impl__
Note: See TracBrowser for help on using the repository browser.