SmartFoxServer 2X C++ API
Vec3D.h
1 // ===================================================================
2 //
3 // Description
4 // Contains the definition of Vec3D
5 //
6 // Revision history
7 // Date Description
8 // 30-Nov-2013 First version
9 //
10 // ===================================================================
11 #ifndef __Vec3D__
12 #define __Vec3D__
13 
14 #include "../../Util/Common.h"
15 #include "SFSDataType.h"
16 #include <stdio.h>
17 
18 #include <boost/shared_ptr.hpp> // Boost Asio shared pointer
19 
20 #if defined(_MSC_VER)
21 #pragma warning(disable:4786) // STL library: disable warning 4786; this warning is generated due to a Microsoft bug
22 #endif
23 #include <string> // STL library: string object
24 #include <vector> // STL library: vector object
25 using namespace std; // STL library: declare the STL namespace
26 
27 namespace Sfs2X {
28 namespace Entities {
29 namespace Data {
30 
40  class DLLImportExport Vec3D
41  {
42  public:
43 
44  // -------------------------------------------------------------------
45  // Public methods
46  // -------------------------------------------------------------------
47 
48  ~Vec3D();
49 
51  static boost::shared_ptr<Vec3D> fromArray(long int tp, boost::shared_ptr<void> array);
52 
60  Vec3D (long int px, long int py, long int pz);
61 
68  Vec3D (long int px, long int py);
69 
77  Vec3D (float px, float py, float pz);
78 
85  Vec3D (float px, float py);
86 
92  bool IsFloat();
93 
97  float FloatX();
98 
102  float FloatY();
103 
107  float FloatZ();
108 
112  long int IntX();
113 
117  long int IntY();
118 
122  long int IntZ();
123 
125  boost::shared_ptr<vector<long int> > ToIntArray();
126 
128  boost::shared_ptr<vector<float> > ToFloatArray();
129 
131  boost::shared_ptr<string> ToString();
132 
133  // -------------------------------------------------------------------
134  // Public members
135  // -------------------------------------------------------------------
136 
137  protected:
138 
139  // -------------------------------------------------------------------
140  // Protected methods
141  // -------------------------------------------------------------------
142 
143  // -------------------------------------------------------------------
144  // Protected members
145  // -------------------------------------------------------------------
146 
147  private:
148 
149  // -------------------------------------------------------------------
150  // Private methods
151  // -------------------------------------------------------------------
152 
153  static boost::shared_ptr<Vec3D> fromIntArray(boost::shared_ptr<vector<long int> > array);
154  static boost::shared_ptr<Vec3D> fromFloatArray(boost::shared_ptr<vector<float> > array);
155 
156  // -------------------------------------------------------------------
157  // Private members
158  // -------------------------------------------------------------------
159 
160  float fx, fy, fz;
161  long int ix, iy, iz;
162  bool useFloat;
163  };
164 
165 } // namespace Data
166 } // namespace Entities
167 } // namespace Sfs2X
168 
169 #endif
STL namespace.
The Vec3D object represents a position in a 2D or 3D space.
Definition: Vec3D.h:40
Definition: SmartFox.cpp:24