Go to the documentation of this file.00001
00006 #ifndef REGISTERPROPERTIES_H_
00007 #define REGISTERPROPERTIES_H_
00008
00009 #include <boost/shared_ptr.hpp>
00010 #include <boost/unordered_map.hpp>
00011 #include <vector>
00012 #include <algorithm>
00013 #include "robot_instance/BitWizard.h"
00014
00015 class PropertyDef
00016 {
00017 public:
00018 PropertyDef(const std::string& name, const std::string& notes, BitMinion::BitIndexEnumType bitIndex, BitMinion::BitCountMaskEnumType sizeMask)
00019 : name(name), notes(notes), bitIndex(bitIndex), sizeMask(sizeMask) {};
00020 PropertyDef()
00021 {
00022 name = "null";
00023 notes = "null";
00024 bitIndex = BitMinion::BIT_ZERO_INDEX;
00025 sizeMask = BitMinion::ONE_BIT_MASK;
00026 };
00027 virtual ~PropertyDef() {};
00028
00029 std::string name;
00030 std::string notes;
00031 BitMinion::BitIndexEnumType bitIndex;
00032 BitMinion::BitCountMaskEnumType sizeMask;
00033 };
00034
00035 typedef boost::unordered_map<std::string, PropertyDef> PropertyDefMap;
00036 typedef std::vector<PropertyDef*> PropertyDefVector;
00037
00038 class RegisterProperties
00039 {
00040 public:
00041 struct comparePropertyDefPointers
00042 {
00043 bool operator () (PropertyDef* lhs, PropertyDef* rhs)
00044 {
00045 return lhs->bitIndex < rhs->bitIndex;
00046 }
00047 };
00048
00049 RegisterProperties() : REGISTER_CERTIFICATE_VALUE(0), REGISTER_CERTIFICATE_MASK(0), isWritable(false) {};
00050 virtual ~RegisterProperties()
00051 {
00052 registerProperty.clear();
00053 registerPropertyVector.clear();
00054 };
00055
00056 uint16_t REGISTER_CERTIFICATE_VALUE;
00057 uint16_t REGISTER_CERTIFICATE_MASK;
00058 bool isWritable;
00059
00060 PropertyDefMap registerProperty;
00061 PropertyDefVector registerPropertyVector;
00062 };
00063
00064 typedef boost::shared_ptr<RegisterProperties> RegisterPropertiesPtr;
00065
00066 #endif