Ignore:
Timestamp:
07/09/12 11:33:05 (12 years ago)
Author:
ymipsl
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/group_template_impl.hpp

    r347 r352  
    44#include "xmlioserver_spl.hpp" 
    55#include "event_server.hpp" 
    6 #include "object_template_impl.hpp" 
     6#include "object_template.hpp" 
    77#include "group_template.hpp" 
    88#include "context.hpp" 
    99#include "event_client.hpp" 
    1010#include "context_client.hpp" 
     11#include "message.hpp" 
     12#include "type.hpp" 
     13#include "type_util.hpp" 
    1114 
    1215 
     
    238241         CGroupTemplate<U, V, W>::getGroupMap(void) const 
    239242   {  
    240       return (this->groupList); 
     243      return (this->groupMap); 
    241244   } 
    242245 
     
    351354   void CGroupTemplate<U, V, W>::addChild(U* child)  
    352355  { 
    353     return CGroupFactory::AddChild<V>(this->getShared,child->getShared()) ; 
     356    return CGroupFactory::AddChild<V>(this->getShared(),child->getShared()) ; 
    354357  } 
    355358   
     
    475478   } 
    476479 
     480   template <class U, class V, class W> 
     481      void CGroupTemplate<U, V, W>::parse(xml::CXMLNode & node, bool withAttr) 
     482   { 
     483 
     484      StdString name = node.getElementName(); 
     485      xml::THashAttributes attributes = node.getAttributes(); 
     486      if (withAttr) 
     487      { 
     488         CGroupTemplate<U, V, W>::SuperClass::parse(node); 
     489         if (attributes.end() != attributes.find("src")) 
     490         { 
     491            StdIFStream ifs ( attributes["src"].c_str() , StdIFStream::in ); 
     492            if (!ifs.good()) 
     493               ERROR("CGroupTemplate<U, V, W>::parse(xml::CXMLNode & node, bool withAttr)", 
     494                     << "[ filename = " << attributes["src"] << " ] Bad xml stream !"); 
     495            xml::CXMLParser::ParseInclude(ifs, *this); 
     496         } 
     497      } 
     498 
     499      // PARSING POUR GESTION DES ENFANTS 
     500           V* group_ptr = (this->hasId())  
     501         ? V::get(this->getId()) 
     502         : boost::polymorphic_downcast<V*>(this); 
     503 
     504      if (!(node.goToChildElement())) 
     505      { 
     506         if (this->hasId()) 
     507         { 
     508            DEBUG(<< "L'objet de type \'" << V::GetName() 
     509                  << "\' nommé \'" << this->getId() 
     510                  << "\' ne contient pas d\'enfant !"); 
     511         } 
     512      } 
     513      else 
     514      { 
     515         do { // Parcours pour traitement. 
     516 
     517            StdString name = node.getElementName(); 
     518            attributes.clear(); 
     519            attributes = node.getAttributes(); 
     520 
     521            if (name.compare(V::GetName()) == 0) 
     522            { 
     523               if (attributes.end() == attributes.find("id")) 
     524                  CGroupFactory::CreateGroup(group_ptr->getShared())->parse(node); 
     525               else 
     526                  CGroupFactory::CreateGroup(group_ptr->getShared(), attributes["id"])->parse(node); 
     527               continue; 
     528            } 
     529 
     530            if (name.compare(U::GetName()) == 0) 
     531            { 
     532               if (attributes.end() == attributes.find("id")) 
     533                  CGroupFactory::CreateChild(group_ptr->getShared())->parse(node); 
     534               else 
     535                  CGroupFactory::CreateChild(group_ptr->getShared(), attributes["id"])->parse(node); 
     536               continue; 
     537            } 
     538 
     539            DEBUG(<< "Dans le contexte \'" << CContext::getCurrent()->getId() 
     540                  << "\', un objet de type \'" << V::GetName() 
     541                  << "\' ne peut contenir qu'un objet de type \'" << V::GetName() 
     542                  << "\' ou de type \'" << U::GetName() 
     543                  << "\' (reçu : " << name << ") !"); 
     544 
     545         } while (node.goToNextElement()); 
     546         node.goToParentElement(); // Retour au parent 
     547      } 
     548   } 
    477549} // namespace xios 
    478550 
Note: See TracChangeset for help on using the changeset viewer.