sensorfw: datatypes/xyz.h Source File

sensorfw

xyz.h
Go to the documentation of this file.
1
27#ifndef XYZ_H
28#define XYZ_H
29
30#include <QDBusArgument>
31#include <datatypes/orientationdata.h>
32
36 class 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
121 Q_DECLARE_METATYPE( XYZ )
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
145 inline 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
TimedData::timestamp_
quint64 timestamp_
monotonic time (microsec)
Definition: genericdata.h:46
TimedXyzData
Class for vector type measurement data (timestamp, x, y, z).
Definition: genericdata.h:53
TimedXyzData::x_
int x_
X value.
Definition: genericdata.h:70
TimedXyzData::y_
int y_
Y value.
Definition: genericdata.h:71
TimedXyzData::z_
int z_
Z value.
Definition: genericdata.h:72
XYZ
QObject facade for XYZData.
Definition: xyz.h:37
XYZ::y
int y
Definition: xyz.h:41
XYZ::z
int z() const
Returns the value for Z.
Definition: xyz.h:87
XYZ::operator==
bool operator==(const XYZ &right) const
Comparison operator.
Definition: xyz.h:106
XYZ::XYZData
const TimedXyzData & XYZData() const
Returns the contained XYZData.
Definition: xyz.h:69
XYZ::XYZ
XYZ(const XYZ &xyz)
Copy constructor.
XYZ::y
int y() const
Returns the value for Y.
Definition: xyz.h:81
XYZ::x
int x() const
Returns the value for X.
Definition: xyz.h:75
XYZ::x
int x
Definition: xyz.h:40
XYZ::XYZ
XYZ(const TimedXyzData &xyzData)
Copy constructor.
XYZ::z
int z
Definition: xyz.h:42
XYZ::operator=
XYZ & operator=(const XYZ &origin)
Assignment operator.
Definition: xyz.h:94
XYZ::operator>>
friend const QDBusArgument & operator>>(const QDBusArgument &argument, XYZ &xyz)
Unmarshall XYZ data from the D-Bus argument.
Definition: xyz.h:145
XYZ::XYZ
XYZ()
Default constructor.
Definition: xyz.h:49
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(TMatrix)
orientationdata.h
Datatypes for different filters.
operator>>
const QDBusArgument & operator>>(const QDBusArgument &argument, XYZ &xyz)
Unmarshall XYZ data from the D-Bus argument.
Definition: xyz.h:145