RTFX  0.3
Real time special effects collaborative visualization and production library.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends
RTFXProperty.h
Go to the documentation of this file.
1 #ifndef __RTFX_PROPERTY__
2 #define __RTFX_PROPERTY__
3 
4 
5 
6 #include "RTFXBoostIncludes.h"
7 
8 #include "RTFXMath.h"
9 #include "RTFXRecorder.h"
10 #include "RTFXHelpers.h"
11 #include "RTFXError.h"
12 
22 using namespace std;
23 
24 namespace RTFX
25 {
33  class RTFXAPI RTFXProperty
34  {
35  public:
38  {
39  BASICTYPE = 0,
40  STRING = 1,
41  CHARARRAY = 2,
42  VECTOR3 = 3,
43  POINT3 = 4,
44  MATRIX4 = 5,
45  RAWDATA = 6,
46  VECTOROF = 7,
47  COLOUR = 8,
48  BASICARRAY = 9,
49  DELETEOBJECT = 10,
50  };
51 
54  {
55  CHAR = 0,
56  BOOL = 1,
57  INT = 2,
58  UNSIGNEDINT = 3,
59  DOUBLE = 4,
60  FLOAT = 5,
61  DATASTRING = 6,
62  UNKNOWN = 7,
63  };
64 
67  {
68  // verbose( ostringstream().flush() << "RTFXProperty Constructor" << endl );
69  canChangeBasis = false;
70  isOwnedByObject = false;
71  isChanged = false;
72  name = "";
73  description = "";
74  id = 0;
75  owner = boost::uuids::nil_uuid();
76  dataType = UNKNOWN;
77  isToBeDeleted = false;
78  localFrame = XLEFT_YUP_ZBACKWARD;
79  dataLock = new boost::mutex();
80  }
81 
83  virtual ~RTFXProperty()
84  {
85  debug( ostringstream().flush() << "RTFXProperty::Destructor: " << name << endl );
86  delete dataLock;
87  }
88 
90  virtual RTFXBIGINT GetLength() { return 0; }
91 
93  void SetType( RTFXPropertyType _type ) { type = _type; }
94 
96  void SetName( string _name ) { name = _name; }
97 
99  void SetOwner( boost::uuids::uuid _owner ) { owner = _owner; }
100 
102  void SetChanged( bool _changed ) { isChanged = _changed; }
103 
105  void SetDescription( string _description ) { description = _description; }
106 
108  void SetID( unsigned int _id ) { id = _id; }
109 
111  void SetDelete( bool _v ) { isToBeDeleted = _v; }
112 
114  bool GetDelete() { return isToBeDeleted; }
115 
117  void SetAll( string _name, string _description, bool _changed, unsigned int _id )
118  {
119  name = _name;
120  description = _description;
121  isChanged = _changed;
122  id = _id;
123  }
124 
126  RTFXPropertyType GetType() { return type; }
127 
129  string GetName() { return name; }
130 
132  boost::uuids::uuid GetOwner() { return owner; }
133 
135  bool GetChanged() { return isChanged; }
136 
138  string GetDescription() { return description; }
139 
141  unsigned int GetID() { return id; }
142 
144  virtual bool EqualTo( RTFXProperty * other ) = 0;
145 
149  virtual void ChangeFrame( AXISFRAME frameA, AXISFRAME frameB ) {};
150 
154  void SetBasis( bool _basis ){ canChangeBasis = _basis; }
155 
157  bool GetBasis() { return canChangeBasis; }
158 
160  virtual void Copy( RTFXProperty * p ) = 0;
161 
163  void SetOwnedByObject( bool _ownedByObject ) { isOwnedByObject = _ownedByObject; }
164 
166  bool GetOwnedByObject() { return isOwnedByObject; }
167 
169  RTFXPropertyData GetDataType() { return dataType; }
170 
173  void SetDataType( RTFXPropertyData _dt ) { dataType = _dt; }
174 
176  AXISFRAME GetAxis() { return localFrame; }
177 
179  void SetAxis( AXISFRAME _frame ) { localFrame = _frame; }
180 
182  static void EncodeLong( RTFXBIGINT _encodeMe, char * _data )
183  {
184  memcpy( _data, &_encodeMe, sizeof( RTFXBIGINT ) );
185  }
186 
188  static void DecodeLong( RTFXBIGINT &_decodeTo, char * _data )
189  {
190  RTFXBIGINT ret_;
191  memcpy( &ret_, _data, sizeof( RTFXBIGINT ) );
192  _decodeTo = ret_;
193  }
194 
195  protected:
196 
198  boost::mutex * dataLock;
199 
200  private:
201 
203  AXISFRAME localFrame;
204 
208 
211 
214 
216  string name;
217 
219  string description;
220 
222  bool isChanged;
223 
225  boost::uuids::uuid owner;
226 
229  unsigned int id;
230 
236 
240 
242  friend class boost::serialization::access;
243 
244  template<class Archive>
245  void serialize( Archive &_ar, const unsigned int _version )
246  {
247  //verbose( ostringstream().flush() << "RTFXProperty::serialize" << endl );
248  _ar & type & owner & id & isChanged & canChangeBasis & isToBeDeleted & name & description & isOwnedByObject & dataType;
249  };
250  };
251  BOOST_SERIALIZATION_ASSUME_ABSTRACT( RTFXProperty );
252 }
253 
254 #endif