sensorfw
xyz.h
Go to the documentation of this file.
1
27#ifndef XYZ_H
28#define XYZ_H
29
30#include <QDBusArgument>
32
36class XYZ : public QObject
37{
38 Q_OBJECT
39
40 Q_PROPERTY(int x READ x)
41 Q_PROPERTY(int y READ y)
42 Q_PROPERTY(int z READ z)
43
44public:
45
49 XYZ() {}
50
56 XYZ(const TimedXyzData& xyzData);
57
63 XYZ(const XYZ& xyz);
64
69 const TimedXyzData& XYZData() const { return data_; }
70
75 int x() const { return data_.x_; }
76
81 int y() const { return data_.y_; }
82
87 int z() const { return data_.z_; }
88
94 XYZ& operator=(const XYZ& origin)
95 {
96 data_ = origin.XYZData();
97 return *this;
98 }
99
106 bool operator==(const XYZ& right) const
107 {
108 TimedXyzData rdata = right.XYZData();
109 return (data_.x_ == rdata.x_ &&
110 data_.y_ == rdata.y_ &&
111 data_.z_ == rdata.z_ &&
112 data_.timestamp_ == rdata.timestamp_);
113 }
114
115private:
116 TimedXyzData data_;
118 friend const QDBusArgument &operator>>(const QDBusArgument &argument, XYZ& xyz);
119};
120
122
123
130inline QDBusArgument &operator<<(QDBusArgument &argument, const XYZ &xyz)
131{
132 argument.beginStructure();
133 argument << xyz.XYZData().timestamp_ << xyz.XYZData().x_ << xyz.XYZData().y_ << xyz.XYZData().z_;
134 argument.endStructure();
135 return argument;
136}
137
145inline const QDBusArgument &operator>>(const QDBusArgument &argument, XYZ &xyz)
146{
147 argument.beginStructure();
148 argument >> xyz.data_.timestamp_ >> xyz.data_.x_ >> xyz.data_.y_ >> xyz.data_.z_;
149 argument.endStructure();
150 return argument;
151}
152
153#endif // XYZ_H
quint64 timestamp_
monotonic time (microsec)
Definition: genericdata.h:46
Class for vector type measurement data (timestamp, x, y, z).
Definition: genericdata.h:53
int x_
X value.
Definition: genericdata.h:70
int y_
Y value.
Definition: genericdata.h:71
int z_
Z value.
Definition: genericdata.h:72
QObject facade for XYZData.
Definition: xyz.h:37
int y
Definition: xyz.h:41
int z() const
Returns the value for Z.
Definition: xyz.h:87
bool operator==(const XYZ &right) const
Comparison operator.
Definition: xyz.h:106
const TimedXyzData & XYZData() const
Returns the contained XYZData.
Definition: xyz.h:69
XYZ(const XYZ &xyz)
Copy constructor.
int y() const
Returns the value for Y.
Definition: xyz.h:81
int x() const
Returns the value for X.
Definition: xyz.h:75
int x
Definition: xyz.h:40
XYZ(const TimedXyzData &xyzData)
Copy constructor.
int z
Definition: xyz.h:42
XYZ & operator=(const XYZ &origin)
Assignment operator.
Definition: xyz.h:94
friend const QDBusArgument & operator>>(const QDBusArgument &argument, XYZ &xyz)
Unmarshall XYZ data from the D-Bus argument.
Definition: xyz.h:145
XYZ()
Default constructor.
Definition: xyz.h:49
Q_DECLARE_METATYPE(TMatrix)
Datatypes for different filters.
const QDBusArgument & operator>>(const QDBusArgument &argument, XYZ &xyz)
Unmarshall XYZ data from the D-Bus argument.
Definition: xyz.h:145