Subversion Repositories HomeAutomation

Rev

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

Rev 1026 Rev 1046
Line 23... Line 23...
23
#define _CANVARIABLE_H
23
#define _CANVARIABLE_H
24
 
24
 
25
using namespace std;
25
using namespace std;
26
 
26
 
27
#include <string>
27
#include <string>
-
 
28
#include <map>
28
 
29
 
29
class CanVariable
30
class CanVariable
30
{
31
{
31
public:
32
public:
32
    CanVariable() {};
33
    CanVariable() {};
Line 54... Line 55...
54
    void setType(string type) { myType = type; };
55
    void setType(string type) { myType = type; };
55
 
56
 
56
    string getUnit() { return myUnit; };
57
    string getUnit() { return myUnit; };
57
    void setUnit(string unit) { myUnit = unit; };
58
    void setUnit(string unit) { myUnit = unit; };
58
 
59
 
59
    int getBitLength() { return myBitLength; };
60
    unsigned int getBitLength() { return myBitLength; };
60
    void setBitLength(int bitLength) { myBitLength = bitLength; };
61
    void setBitLength(int bitLength) { myBitLength = bitLength; };
61
 
62
 
62
    int getStartBit() { return myStartBit; };
63
    unsigned int getStartBit() { return myStartBit; };
63
    void setStartBit(int startBit) { myStartBit = startBit; };
64
    void setStartBit(int startBit) { myStartBit = startBit; };
-
 
65
 
-
 
66
    string getEnumIdValue()
-
 
67
    {
-
 
68
        for (map<string, string>::iterator iter; iter != myEnumValues.end(); iter++)
-
 
69
        {
-
 
70
            if (iter->second == myValue)
-
 
71
            {
-
 
72
                return iter->first;
-
 
73
            }
-
 
74
        }
-
 
75
 
-
 
76
        return "";
-
 
77
    }
-
 
78
 
-
 
79
    void addEnumValue(string id, string name)
-
 
80
    {
-
 
81
        myEnumValues[id] = name;
-
 
82
    }
64
 
83
 
65
private:
84
private:
66
    string myName;
85
    string myName;
67
    string myValue;
86
    string myValue;
68
    string myType;
87
    string myType;
69
    string myUnit;
88
    string myUnit;
70
    int myBitLength;
89
    unsigned int myBitLength;
71
    int myStartBit;
90
    unsigned int myStartBit;
-
 
91
    map<string, string> myEnumValues;
72
};
92
};
73
 
93
 
74
#endif  /* _CANVARIABLE_H */
94
#endif  /* _CANVARIABLE_H */
75
 
95