Subversion Repositories HomeAutomation

Rev

Rev 1314 | Rev 1323 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1314 Rev 1322
Line 14... Line 14...
14
{
14
{
15
    this->myName = name;
15
    this->myName = name;
16
    this->myRequired = required;
16
    this->myRequired = required;
17
    this->myUnit = unit;
17
    this->myUnit = unit;
18
 
18
 
19
    xml::Node datatypeNode = Protocol::getInstance()->getRootNode().selectFirst("datatypes").selectFirst("datatype", xml::Node::attributePair("name", datatype));
-
 
20
 
-
 
21
    this->myLength = convert::string2uint(datatypeNode["length"]);
19
    this->myDatatype = Datatype::create(datatype);
22
    this->myDatatype = boost::make_shared<Datatype>(Datatype::getTypeFromString(datatypeNode["type"]));
-
 
23
}
20
}
24
 
21
 
25
Variable::Variable()
22
Variable::Variable()
26
{
23
{
27
}
24
}
28
 
25
 
29
Variable::~Variable()
26
Variable::~Variable()
30
{
27
{
31
}
28
}
32
 
29
 
33
boost::any Variable::getValue()
30
string Variable::getName()
-
 
31
{
-
 
32
    return this->myName;
-
 
33
}
-
 
34
 
-
 
35
Datatype::pointer Variable::getDatatype()
34
{
36
{
35
    return this->myDatatype->getValue();
37
    return this->myDatatype;
-
 
38
}
-
 
39
 
-
 
40
string Variable::getUnit()
-
 
41
{
-
 
42
    return this->myUnit;
-
 
43
}
-
 
44
 
-
 
45
bool Variable::isRequired()
-
 
46
{
-
 
47
    return this->myRequired;
36
}
48
}
37
 
49
 
38
void Variable::setValue(boost::any value)
50
void Variable::readBits(BitBuffer & buffer)
39
{
51
{
40
    this->myDatatype->setValue(value);
52
    this->myDatatype->readBits(buffer);
41
}
53
}
42
 
54
 
43
void Variable::readBits(BitBuffer & buffer)
55
void Variable::writeBits(BitBuffer & buffer)
44
{
56
{
45
    this->myDatatype->readBits(buffer, this->myLength);
57
    this->myDatatype->writeBits(buffer);
46
}
58
}
47
 
59
 
48
}
60
}
49
}
61
}