DiaDes  0.1
DIAgnosisofDiscrete-EventSystem
Automata.hh
Go to the documentation of this file.
1 #ifndef __DIADES__IO__XML__AUTOMATA__AUTOMATA__HH__
2 #define __DIADES__IO__XML__AUTOMATA__AUTOMATA__HH__
3 
13 #include<sstream>
14 #include<string>
15 #include"boost/date_time/posix_time/posix_time.hpp"
16 #include<tinyxml.h>
19 #include<diades/io/xml/Xml.hh>
21 
22 namespace Diades
23 {
24  namespace Io
25  {
26  namespace Xml
27  {
28 
29  /***********************************************************************************/
30 
31  template< >
32  struct XmlGetFunctor<boost::posix_time::time_duration>
33  {
34  boost::posix_time::time_duration operator()(const TiXmlElement * pElem) const
35  {
36  std::stringstream stream;
37  stream << pElem->GetText();
38  long totalSeconds;
39  stream >> totalSeconds;
40  return boost::posix_time::time_duration(boost::posix_time::seconds(totalSeconds));
41  }
42  };
43 
44 
45  /***********************************************************************************/
46 
47 
48  template< >
50  {
51  Diades::Automata::Event operator()(const TiXmlElement * pElem) const
52  {
53  return Diades::Automata::EventFactory::factory()->getEvent(pElem->GetText());
54  }
55  };
56  };
57  };
58 };
59 
60 #endif
Event getEvent(Event::Id id)
boost::posix_time::time_duration operator()(const TiXmlElement *pElem) const
Definition: Automata.hh:34
xml input/output
Namespace of the Diades project.
static EventFactory * factory()
Diades::Automata::Event operator()(const TiXmlElement *pElem) const
Definition: Automata.hh:51