Rev 1318 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | SVN | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 1309 | runge | 1 | /* |
| 1311 | runge | 2 | * Protocol.cpp |
| 1309 | runge | 3 | * |
| 4 | * Created on: Jul 23, 2009 |
||
| 5 | * Author: Mattias Runge |
||
| 6 | */ |
||
| 7 | |||
| 1311 | runge | 8 | #include "Protocol.h" |
| 1309 | runge | 9 | |
| 10 | namespace atom { |
||
| 11 | |||
| 1311 | runge | 12 | Protocol::pointer Protocol::Instance(new Protocol()); |
| 1310 | runge | 13 | |
| 1311 | runge | 14 | Protocol::Protocol() |
| 1309 | runge | 15 | { |
| 1326 | runge | 16 | LOG.setName("Protocol"); |
| 1309 | runge | 17 | } |
| 18 | |||
| 1311 | runge | 19 | Protocol::~Protocol() |
| 1309 | runge | 20 | { |
| 21 | } |
||
| 22 | |||
| 1311 | runge | 23 | Protocol::pointer Protocol::getInstance() |
| 1310 | runge | 24 | { |
| 1311 | runge | 25 | return Protocol::Instance; |
| 1309 | runge | 26 | } |
| 1310 | runge | 27 | |
| 1326 | runge | 28 | void Protocol::load(string filename, string cachefilename) |
| 1310 | runge | 29 | { |
| 30 | this->myXmlNode.load(filename); |
||
| 1311 | runge | 31 | |
| 1326 | runge | 32 | LOG.info("Loaded protocol from \"" + filename + "\"."); |
| 33 | |||
| 1311 | runge | 34 | // TODO Catch exceptions thrown by load |
| 35 | |||
| 36 | // TODO Do validation of XML-data, check if needed sections are defined |
||
| 1326 | runge | 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 |
||
| 1309 | runge | 46 | } |
| 1310 | runge | 47 | |
| 1311 | runge | 48 | xml::Node & Protocol::getRootNode() |
| 1310 | runge | 49 | { |
| 50 | return this->myXmlNode; |
||
| 51 | } |
||
| 52 | |||
| 1326 | runge | 53 | xml::Node & Protocol::getRootCacheNode() |
| 54 | { |
||
| 55 | return this->myXmlCacheNode; |
||
| 1310 | runge | 56 | } |
| 1311 | runge | 57 | |
| 1326 | runge | 58 | } |
| 59 |