Subversion Repositories HomeAutomation

Rev

Rev 1318 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

  1. /*
  2.  * Protocol.cpp
  3.  *
  4.  *  Created on: Jul 23, 2009
  5.  *      Author: Mattias Runge
  6.  */
  7.  
  8. #include "Protocol.h"
  9.  
  10. namespace atom {
  11.  
  12. Protocol::pointer Protocol::Instance(new Protocol());
  13.  
  14. Protocol::Protocol()
  15. {
  16.     LOG.setName("Protocol");
  17. }
  18.  
  19. Protocol::~Protocol()
  20. {
  21. }
  22.  
  23. Protocol::pointer Protocol::getInstance()
  24. {
  25.     return Protocol::Instance;
  26. }
  27.  
  28. void Protocol::load(string filename, string cachefilename)
  29. {
  30.     this->myXmlNode.load(filename);
  31.  
  32.     LOG.info("Loaded protocol from \"" + filename + "\".");
  33.  
  34.     // TODO Catch exceptions thrown by load
  35.  
  36.     // TODO Do validation of XML-data, check if needed sections are defined
  37.  
  38.  
  39.     this->myXmlCacheNode.load(cachefilename);
  40.  
  41.     LOG.info("Loaded protocol cache from \"" + cachefilename + "\".");
  42.  
  43.     // TODO If not found generate one
  44.  
  45.     // TODO Check if versions match, if not update cache
  46. }
  47.  
  48. xml::Node & Protocol::getRootNode()
  49. {
  50.     return this->myXmlNode;
  51. }
  52.  
  53. xml::Node & Protocol::getRootCacheNode()
  54. {
  55.     return this->myXmlCacheNode;
  56. }
  57.  
  58. }
  59.  
  60.