sensorfw
xyz.h
Go to the documentation of this file.
1 
27 #ifndef XYZ_H
28 #define XYZ_H
29 
30 #include <QDBusArgument>
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 
44 public:
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 
115 private:
116  TimedXyzData data_;
118  friend const QDBusArgument &operator>>(const QDBusArgument &argument, XYZ& xyz);
119 };
120 
122 
123 
130 inline 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
int y_
Y value.
Definition: genericdata.h:71
int y() const
Returns the value for Y.
Definition: xyz.h:81
bool operator==(const XYZ &right) const
Comparison operator.
Definition: xyz.h:106
friend const QDBusArgument & operator>>(const QDBusArgument &argument, XYZ &xyz)
Unmarshall XYZ data from the D-Bus argument.
Definition: xyz.h:145
quint64 timestamp_
monotonic time (microsec)
Definition: genericdata.h:46
int z_
Z value.
Definition: genericdata.h:72
Q_DECLARE_METATYPE(TMatrix)
QObject facade for #TimedXYZData.
Definition: xyz.h:36
Datatypes for different filters.
int z() const
Returns the value for Z.
Definition: xyz.h:87
Class for vector type measurement data (timestamp, x, y, z).
Definition: genericdata.h:52
const QDBusArgument & operator>>(const QDBusArgument &argument, XYZ &xyz)
Unmarshall XYZ data from the D-Bus argument.
Definition: xyz.h:145
int x_
X value.
Definition: genericdata.h:70
XYZ & operator=(const XYZ &origin)
Assignment operator.
Definition: xyz.h:94
int x() const
Returns the value for X.
Definition: xyz.h:75
XYZ()
Default constructor.
Definition: xyz.h:49
const TimedXyzData & XYZData() const
Returns the contained #TimedXYZData.
Definition: xyz.h:69