Go to the documentation of this file.00001
00026 #ifndef TAP_H
00027 #define TAP_H
00028
00029 #include <QDBusArgument>
00030
00031 #include <datatypes/tapdata.h>
00032
00036 class Tap : public QObject
00037 {
00038 Q_OBJECT
00039
00040 Q_PROPERTY(int direction READ direction)
00041 Q_PROPERTY(int type READ type)
00042
00043 public:
00047 Tap() {}
00048
00054 Tap(const TapData& tapData);
00055
00061 Tap(const Tap& tap);
00062
00067 const TapData& tapData() const { return data_; }
00068
00073 TapData::Direction direction() const { return data_.direction_; }
00074
00079 TapData::Type type() const { return data_.type_; }
00080
00081 private:
00082 TapData data_;
00084 friend const QDBusArgument &operator>>(const QDBusArgument &argument, Tap& tap);
00085 };
00086
00087 Q_DECLARE_METATYPE( Tap )
00088
00089
00096 inline QDBusArgument &operator<<(QDBusArgument &argument, const Tap &tap)
00097 {
00098 argument.beginStructure();
00099 argument << tap.tapData().timestamp_ << (int)(tap.tapData().direction_) << (int)(tap.tapData().type_);
00100 argument.endStructure();
00101 return argument;
00102 }
00103
00111 inline const QDBusArgument &operator>>(const QDBusArgument &argument, Tap &tap)
00112 {
00113 int tmp;
00114 argument.beginStructure();
00115 argument >> tap.data_.timestamp_;
00116 argument >> tmp;
00117 tap.data_.direction_ = (TapData::Direction)tmp;
00118 argument >> tmp;
00119 tap.data_.type_ = (TapData::Type)tmp;
00120 argument.endStructure();
00121 return argument;
00122 }
00123
00124 #endif // TAP_H