Subversion Repositories HomeAutomation

Rev

Rev 1311 | Rev 1323 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | SVN | RSS feed

Rev Author Line No. Line
1309 runge 1
/*
2
 * Header.cpp
3
 *
4
 *  Created on: Jul 23, 2009
5
 *      Author: Mattias Runge
6
 */
7
 
8
#include "Header.h"
9
 
10
namespace atom {
11
namespace message {
12
 
13
Header::Header()
14
{
1311 runge 15
    xml::Node::nodeList nodes = Protocol::getInstance()->getRootNode().selectFirst("header").select("variable");
1310 runge 16
 
17
    for (unsigned int n = 0; n < nodes.size(); n++)
18
    {
1314 runge 19
        Variable variable(nodes[n]["name"], nodes[n]["datatype"], convert::string2bool(nodes[n]["required"]), nodes[n]["unit"]);
1310 runge 20
        this->myVariables[nodes[n]["name"]] = variable;
21
    }
1309 runge 22
}
23
 
24
Header::~Header()
25
{
26
}
27
 
28
Variable & Header::getVariable(string name)
29
{
30
    return this->myVariables[name];
31
 
32
    // TODO Check if it does not exist, throw exception?
33
}
34
 
35
void Header::readBits(BitBuffer & buffer)
36
{
37
    for (variableMap::iterator iter = this->myVariables.begin(); iter != this->myVariables.end(); iter++)
38
    {
39
        iter->second.readBits(buffer);
40
    }
41
}
42
 
43
}
44
}