• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

datatypes/xyz.h

Go to the documentation of this file.
00001 
00027 #ifndef XYZ_H
00028 #define XYZ_H
00029 
00030 #include <QDBusArgument>
00031 #include <datatypes/orientationdata.h>
00032 
00036 class XYZ : public QObject
00037 {
00038     Q_OBJECT
00039 
00040     Q_PROPERTY(int x READ x)
00041     Q_PROPERTY(int y READ y)
00042     Q_PROPERTY(int z READ z)
00043 
00044 public:
00045 
00049     XYZ() {}
00050 
00056     XYZ(const TimedXyzData& xyzData);
00057 
00063     XYZ(const XYZ& xyz);
00064 
00069     const TimedXyzData& XYZData() const { return data_; }
00070 
00075     int x() const { return data_.x_; }
00076 
00081     int y() const { return data_.y_; }
00082 
00087     int z() const { return data_.z_; }
00088 
00094     XYZ& operator=(const XYZ& origin)
00095     {
00096         data_ = origin.XYZData();
00097         return *this;
00098     }
00099 
00106     bool operator==(const XYZ& right) const
00107     {
00108         TimedXyzData rdata = right.XYZData();
00109         return (data_.x_ == rdata.x_ &&
00110                 data_.y_ == rdata.y_ &&
00111                 data_.z_ == rdata.z_ &&
00112                 data_.timestamp_ == rdata.timestamp_);
00113     }
00114 
00115 private:
00116     TimedXyzData data_; 
00118     friend const QDBusArgument &operator>>(const QDBusArgument &argument, XYZ& xyz);
00119 };
00120 
00121 Q_DECLARE_METATYPE( XYZ )
00122 
00123 
00130 inline QDBusArgument &operator<<(QDBusArgument &argument, const XYZ &xyz)
00131 {
00132     argument.beginStructure();
00133     argument << xyz.XYZData().timestamp_ << xyz.XYZData().x_ << xyz.XYZData().y_ << xyz.XYZData().z_;
00134     argument.endStructure();
00135     return argument;
00136 }
00137 
00145 inline const QDBusArgument &operator>>(const QDBusArgument &argument, XYZ &xyz)
00146 {
00147     argument.beginStructure();
00148     argument >> xyz.data_.timestamp_ >> xyz.data_.x_ >> xyz.data_.y_ >> xyz.data_.z_;
00149     argument.endStructure();
00150     return argument;
00151 }
00152 
00153 #endif // XYZ_H

Generated on Mon Jun 27 2011 14:38:47 for sensorfw by  doxygen 1.7.1