REC RPC library
rec_rpc_serialization_Pose2D.h
Go to the documentation of this file.
1 /*
2 Copyright (c) 2011, REC Robotics Equipment Corporation GmbH, Planegg, Germany
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without modification,
6 are permitted provided that the following conditions are met:
7 
8 - Redistributions of source code must retain the above copyright notice,
9  this list of conditions and the following disclaimer.
10 - Redistributions in binary form must reproduce the above copyright notice,
11  this list of conditions and the following disclaimer in the documentation and/or
12  other materials provided with the distribution.
13 - Neither the name of the REC Robotics Equipment Corporation GmbH nor the names of
14  its contributors may be used to endorse or promote products derived from this software
15  without specific prior written permission.
16 
17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
18 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
19 AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
20 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
23 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
24 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26 
27 #ifndef _REC_RPC_SERIALIZATION_POSE2D_H_
28 #define _REC_RPC_SERIALIZATION_POSE2D_H_
29 
32 #include "rec/rpc/defines.h"
33 
34 #include <QtCore>
35 
36 namespace rec
37 {
38  namespace rpc
39  {
40  namespace serialization
41  {
44  {
45  public:
47  Pose2D();
49  Pose2D( const QPointF& pos, float rotDeg );
50 
52  QPointF pos;
53 
55  float rotDeg;
56 
57  private:
58  virtual void serialize( QDataStream& ) const;
59  virtual void deserialize( QDataStream& );
60  };
61 
63  typedef QSharedPointer< Pose2D > Pose2DPtr;
64 
68  typedef QSharedPointer< Pose2DArray > Pose2DArrayPtr;
69  }
70  }
71 }
72 
83 #define DECLARE_POSE2D_MEMBER( NAME ) \
84  private: \
85  rec::rpc::serialization::Pose2DPtr _##NAME; \
86  void create_##NAME() { _##NAME = rec::rpc::serialization::Pose2DPtr( new rec::rpc::serialization::Pose2D ); } \
87  public: \
88  const rec::rpc::serialization::Pose2D& NAME() const { return *_##NAME; } \
89  rec::rpc::serialization::Pose2D& NAME() { return *_##NAME; } \
90  void set##NAME( const rec::rpc::serialization::Pose2D& pos ) { *_##NAME = pos; } \
91  const rec::rpc::serialization::Pose2DPtr& NAME##PtrConst() const { return _##NAME; } \
92  rec::rpc::serialization::Pose2DPtr& NAME##Ptr() { return _##NAME; }
93 
99 #define DEFINE_POSE2D_PARAM( FUNCTIONNAME ) DEFINE_SERIALIZABLE( FUNCTIONNAME##Param, rec::rpc::serialization::Pose2D );
100 
106 #define DEFINE_POSE2D_RESULT( FUNCTIONNAME ) DEFINE_SERIALIZABLE( FUNCTIONNAME##Result, rec::rpc::serialization::Pose2D );
107 
113 #define DEFINE_POSE2D_TOPICDATA( TOPICNAME ) DEFINE_SERIALIZABLE( topic##TOPICNAME##Data, rec::rpc::serialization::Pose2D );
114 
125 #define DECLARE_POSE2DARRAY_MEMBER( NAME ) \
126  private: \
127  rec::rpc::serialization::Pose2DArrayPtr _##NAME; \
128  void create_##NAME() { _##NAME = rec::rpc::serialization::Pose2DArrayPtr( new rec::rpc::serialization::Pose2DArray ); } \
129  public: \
130  const rec::rpc::serialization::Pose2DArray& NAME() const { return *_##NAME; } \
131  rec::rpc::serialization::Pose2DArray& NAME() { return *_##NAME; } \
132  void set##NAME( const rec::rpc::serialization::Pose2DArray& pos ) { *_##NAME = pos; } \
133  const rec::rpc::serialization::Pose2DArrayPtr& NAME##PtrConst() const { return _##NAME; } \
134  rec::rpc::serialization::Pose2DArrayPtr& NAME##Ptr() { return _##NAME; }
135 
141 #define DEFINE_POSE2DARRAY_PARAM( FUNCTIONNAME ) DEFINE_SERIALIZABLE( FUNCTIONNAME##Param, rec::rpc::serialization::Pose2DArray );
142 
148 #define DEFINE_POSE2DARRAY_RESULT( FUNCTIONNAME ) DEFINE_SERIALIZABLE( FUNCTIONNAME##Result, rec::rpc::serialization::Pose2DArray );
149 
155 #define DEFINE_POSE2DARRAY_TOPICDATA( TOPICNAME ) DEFINE_SERIALIZABLE( topic##TOPICNAME##Data, rec::rpc::serialization::Pose2DArray );
156 
157 Q_DECLARE_METATYPE( rec::rpc::serialization::Pose2D )
158 Q_DECLARE_METATYPE( rec::rpc::serialization::Pose2DPtr )
159 Q_DECLARE_METATYPE( rec::rpc::serialization::Pose2DArray )
160 Q_DECLARE_METATYPE( rec::rpc::serialization::Pose2DArrayPtr )
161 
162 #endif //_REC_RPC_SERIALIZATION_POSE2D_H_
Pre-defined serialization class that stores a 2D pose.
Primitive< QVector< Pose2D > > Pose2DArray
Serializable array type definition.
#define REC_RPC_EXPORT
Definition: defines.h:49
Serialization class for primitive objects and values.
QSharedPointer< Pose2D > Pose2DPtr
Shared pointer type definition.
QSharedPointer< Pose2DArray > Pose2DArrayPtr
Serializable array shared pointer type definition.