MKValue.hpp
Go to the documentation of this file.
00001 /*
00002  * MKValue.hpp
00003  *
00004  *  Created on: Nov 25, 2011
00005  *      Author: mriedel
00006  */
00007 
00008 #ifndef MKVALUE_HPP_
00009 #define MKVALUE_HPP_
00010 
00011 #include <telekyb_defines/telekyb_defines.hpp>
00012 
00013 #include <telekyb_defines/MKDefines.hpp>
00014 
00015 #include <telekyb_base/Time.hpp>
00016 
00017 #include <ros/console.h>
00018 
00024 namespace TELEKYB_NAMESPACE {
00025 
00026 class MKValue {
00027 protected:
00028         std::string name;
00029         MKInt id;
00030         MKInt value;
00031         Time stamp;
00032 
00033         // Only MKData can create Values
00034         MKValue(const std::string& name_, MKInt id_);
00035 
00036         // Set Value // Only allowed by MKData
00037         void setValue(MKInt value_);
00038 
00039 public:
00040         virtual ~MKValue();
00041 
00042         bool isUnset() const;
00043 
00044         MKSingleValuePacket getMKSingleValuePacket() const;
00045         // For Setting
00046         MKSingleValuePacket getMKSingleValuePacketWithValue(MKInt value_) const;
00047         //MKSingleIdPacket getMKSingleIdPacket() const;
00048 
00049         // Setters / Getters
00050         MKInt getID() const;
00051         bool hasID(MKInt id_) const;
00052         //void setID(MKInt id_);
00053 
00054         MKInt getValue() const;
00055 
00056         // setStamp sets Stamp to current Time.
00057         void setStamp();
00058         Time getStamp() const;
00059 
00060         // getName
00061         std::string getName() const;
00062 
00063         // ID match?
00064 //      bool equals(MKSingleIdPacket packet) const;
00065 
00066         // ID & Value match?
00067         bool equals(MKSingleValuePacket packet) const;
00068 
00069         // only check ID & Value!
00070         bool equals(const MKValue& other) const;
00071 
00072         std::string toString() const;
00073 
00074         // friend classes
00075         friend class MKData;
00076 
00077 };
00078 
00079 // Inline
00080 // ID?
00081 inline
00082 bool MKValue::hasID(MKInt id_) const
00083 {
00084         return id == id_;
00085 }
00086 
00087 // ID match?
00088 //inline
00089 //bool MKValue::equals(MKSingleIdPacket packet) const
00090 //{
00091 //      return packet.id == id;
00092 //}
00093 
00094 // ID & Value match?
00095 inline
00096 bool MKValue::equals(MKSingleValuePacket packet) const
00097 {
00098         return (packet.id == id) && (packet.value == value);
00099 }
00100 
00101 inline
00102 // only check ID & Value!
00103 bool MKValue::equals(const MKValue& other) const
00104 {
00105         return (other.id == id) && (other.value == value);
00106 }
00107 
00108 inline
00109 void MKValue::setStamp()
00110 {
00111         stamp = Time();
00112 }
00113 
00114 inline
00115 Time MKValue::getStamp() const
00116 {
00117         return stamp;
00118 }
00119 
00120 inline
00121 std::string MKValue::getName() const
00122 {
00123         return name;
00124 }
00125 
00126 } /* namespace telekyb */
00127 #endif /* MKVALUE_HPP_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Defines


tk_mkinterface
Author(s): Martin Riedel
autogenerated on Wed Apr 24 2013 11:29:54