sensorfw: datatypes/unsigned.h Source File

sensorfw

unsigned.h
Go to the documentation of this file.
1
27 #ifndef UNSIGNED_H
28 #define UNSIGNED_H
29
30 #include <QDBusArgument>
31 #include <datatypes/timedunsigned.h>
32
36 class Unsigned : public QObject
37 {
38 Q_OBJECT
39 Q_PROPERTY(int x READ x)
40
41 public:
42
46 Unsigned() {}
47
53 Unsigned(const TimedUnsigned& unsignedData);
54
60 Unsigned(const Unsigned& data);
61
66 const TimedUnsigned& UnsignedData() const { return data_; }
67
72 int x() const { return data_.value_; }
73
79 Unsigned& operator=(const Unsigned& origin)
80 {
81 data_ = origin.UnsignedData();
82 return *this;
83 }
84
91 bool operator==(const Unsigned& right) const
92 {
93 TimedUnsigned rdata = right.UnsignedData();
94 return (data_.value_ == rdata.value_ &&
95 data_.timestamp_ == rdata.timestamp_);
96 }
97
98 private:
99 TimedUnsigned data_;
101 friend const QDBusArgument &operator>>(const QDBusArgument &argument, Unsigned& data);
102 };
103
104 Q_DECLARE_METATYPE( Unsigned )
105
106
113 inline QDBusArgument &operator<<(QDBusArgument &argument, const Unsigned &data)
114 {
115 argument.beginStructure();
116 argument << data.UnsignedData().timestamp_ << data.UnsignedData().value_;
117 argument.endStructure();
118 return argument;
119 }
120
128 inline const QDBusArgument &operator>>(const QDBusArgument &argument, Unsigned &data)
129 {
130 argument.beginStructure();
131 argument >> data.data_.timestamp_ >> data.data_.value_;
132 argument.endStructure();
133 return argument;
134 }
135
136 #endif // UNSIGNED_H
TimedData::timestamp_
quint64 timestamp_
monotonic time (microsec)
Definition: genericdata.h:46
TimedUnsigned
Datatype for unsigned integer value with timestamp.
Definition: timedunsigned.h:34
TimedUnsigned::value_
unsigned value_
Measurement value.
Definition: timedunsigned.h:49
Unsigned
QObject facae for TimedUnsigned.
Definition: unsigned.h:37
Unsigned::x
int x() const
Returns the value.
Definition: unsigned.h:72
Unsigned::Unsigned
Unsigned()
Default constructor.
Definition: unsigned.h:46
Unsigned::Unsigned
Unsigned(const TimedUnsigned &unsignedData)
Constructor.
Unsigned::operator=
Unsigned & operator=(const Unsigned &origin)
Assignment operator.
Definition: unsigned.h:79
Unsigned::UnsignedData
const TimedUnsigned & UnsignedData() const
Returns the contained TimedUnsigned.
Definition: unsigned.h:66
Unsigned::Unsigned
Unsigned(const Unsigned &data)
Copy constructor.
Unsigned::operator==
bool operator==(const Unsigned &right) const
Comparison operator.
Definition: unsigned.h:91
Unsigned::operator>>
friend const QDBusArgument & operator>>(const QDBusArgument &argument, Unsigned &data)
Unmarshall Unsigned data from the D-Bus argument.
Definition: unsigned.h:128
Unsigned::x
int x
Definition: unsigned.h:39
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(TMatrix)
timedunsigned.h
Datatype for unsigned values.
operator>>
const QDBusArgument & operator>>(const QDBusArgument &argument, Unsigned &data)
Unmarshall Unsigned data from the D-Bus argument.
Definition: unsigned.h:128