CFx SDK Documentation  2020SP3
FMDataSerialize.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 #ifndef _FM_DATA_SERIALIZE_
24 #define _FM_DATA_SERIALIZE_
25 
26 #include <OdaCommon.h>
27 #include "OdPlatformSettings.h"
28 #include "Modeler/FMMdlBody.h"
29 #include "Modeler/FMMdlVertex.h"
30 #include <map>
31 
32 namespace FacetModeler
33 {
34 
35  static FacetModeler::BodyImpl* GetBodyImpl(const FacetModeler::Body& val)
36  {
37  FacetModeler::BodyImpl* pBodyImpl = *((FacetModeler::BodyImpl**)(&val));
38  return pBodyImpl;
39  }
40 
41  struct VertexImage
42  {
44  {}
46  void* pKey;
47  void* pPrev;
48  void* pNext;
49  };
50 
51  struct EdgeImage
52  {
55  {}
56 
58  void* pFaceKey;
59  void* pLoopKey;
60  void* pVertexKey;
61  void* pPrevKey;
62  void* pNextKey;
63  void* pPairKey;
64  void* pPartnerKey;
65  };
66 
67  struct LoopImage
68  {
70  {}
71 
72  void* pLoopKey;
73  std::vector<void*> edgeKeys;
74  };
75 
76  typedef std::vector<LoopImage> LoopImages;
77 
78  struct FaceImage
79  {
81  {}
82 
84  void* pFaceKey;
85  void* pPrevKey;
86  void* pNextKey;
87 
89  };
90 
91  typedef std::vector<VertexImage> VertexImages;
92  typedef std::map<void*, EdgeImage> EdgeImages;
93  typedef std::vector<FaceImage> FaceImages;
94 
95  class FMGEOMETRY_API BinaryStream
96  {
97  FILE* m_hFile;
98 
99  public:
101  {
102  ePoint2dMarker = 1,
103  eContour2dMarker = 2,
104  eProfile2dMarker = 3,
105  eBodyMarker = 4,
106  eFaceMarker = 5,
107  ePoint3dMarker = 6
108  };
109 
110  public:
113 
114  bool Create(const OdString& szFile);
115  bool Open(const OdString& szFile);
116 
117  void Write(const void* pData, size_t length);
118  void Read(void* pData, size_t length);
119 
120  template<typename T>
121  void Write(const T val)
122  {
123  Write(&val, sizeof(val));
124  }
125 
126  void Write(const OdGePoint2d& val);
127  void Write(const FacetModeler::Contour2D& val);
128  void Write(const FacetModeler::Profile2D& val);
129 
130  void Write(const OdGePoint3d& val);
131  void Write(const FacetModeler::Face& val);
132  void Write(const FacetModeler::Body& val);
133 
134  void WriteVertexList(FacetModeler::Vertex* pVertexList, OdUInt32 uVtxCount);
138 
139  template<typename T>
140  void Read(T& val)
141  {
142  Read(&val, sizeof(val));
143  }
144 
145  void Read(OdGePoint2d& val);
148 
149  void Read(OdGePoint3d& val);
152 
153  void ReadVertexImages(VertexImages& vertexImages, FacetModeler::Body* pBody);
155 
156  void ReadEdgeImages(EdgeImages& edgeImages);
157  void ReadFaceImages(FaceImages& faceImages);
158  };
159 
160 } // ::
161 #endif //_FM_DATA_SERIALIZE_
FacetModeler::BinaryStream::WriteVertexList
void WriteVertexList(FacetModeler::Vertex *pVertexList, OdUInt32 uVtxCount)
FacetModeler::VertexImage::pKey
void * pKey
Definition: FMDataSerialize.h:46
FacetModeler::BinaryStream::Write
void Write(const void *pData, size_t length)
FacetModeler::BinaryStream::Create
bool Create(const OdString &szFile)
OdString
Definition: OdString.h:95
FacetModeler::VertexImage::VertexImage
VertexImage()
Definition: FMDataSerialize.h:43
NULL
#define NULL
Definition: GsProperties.h:177
FacetModeler::BinaryStream::WriteEdge
void WriteEdge(FacetModeler::Edge *pEdge)
FacetModeler::LoopImage::pLoopKey
void * pLoopKey
Definition: FMDataSerialize.h:72
FacetModeler::BinaryStream::Open
bool Open(const OdString &szFile)
FacetModeler::FaceImage
Definition: FMDataSerialize.h:79
FacetModeler::Contour2D
Definition: FMContour2D.h:75
FacetModeler::EdgeImage::pEdge
FacetModeler::Edge * pEdge
Definition: FMDataSerialize.h:57
FacetModeler::BinaryStream::Read
void Read(OdGePoint2d &val)
FacetModeler
Definition: FMContour2D.h:35
FacetModeler::BinaryStream::Write
void Write(const OdGePoint3d &val)
FacetModeler::FaceImage::FaceImage
FaceImage()
Definition: FMDataSerialize.h:80
FacetModeler::EdgeImage::EdgeImage
EdgeImage()
Definition: FMDataSerialize.h:53
FacetModeler::BinaryStream::Write
void Write(const T val)
Definition: FMDataSerialize.h:121
FacetModeler::BinaryStream::~BinaryStream
~BinaryStream()
FacetModeler::VertexImage::pPrev
void * pPrev
Definition: FMDataSerialize.h:47
FacetModeler::BinaryStream::Read
void Read(void *pData, size_t length)
FacetModeler::BinaryStream::BinaryStream
BinaryStream()
FacetModeler::BinaryStream::Write
void Write(const FacetModeler::Face &val)
FacetModeler::EdgeImage::pPairKey
void * pPairKey
Definition: FMDataSerialize.h:63
FacetModeler::EdgeImage::pLoopKey
void * pLoopKey
Definition: FMDataSerialize.h:59
OdUInt32
unsigned int OdUInt32
Definition: OdPlatformSettings.h:783
FacetModeler::EdgeImage::pVertexKey
void * pVertexKey
Definition: FMDataSerialize.h:60
FacetModeler::BinaryStream::Read
void Read(T &val)
Definition: FMDataSerialize.h:140
FacetModeler::EdgeImages
std::map< void *, EdgeImage > EdgeImages
Definition: FMDataSerialize.h:92
FacetModeler::FaceImage::pNextKey
void * pNextKey
Definition: FMDataSerialize.h:86
FacetModeler::EdgeImage
Definition: FMDataSerialize.h:52
FacetModeler::Body
Definition: FMMdlBody.h:47
OD::File::Write
@ Write
Definition: RxFS.h:62
FacetModeler::LoopImage::edgeKeys
std::vector< void * > edgeKeys
Definition: FMDataSerialize.h:73
OdGePoint3d
Definition: GePoint3d.h:55
FMMdlBody.h
FacetModeler::BinaryStream::ReadEdgeImages
void ReadEdgeImages(EdgeImages &edgeImages)
FacetModeler::BinaryStream::Read
void Read(FacetModeler::Profile2D &val)
FacetModeler::FaceImage::loopImages
LoopImages loopImages
Definition: FMDataSerialize.h:88
FacetModeler::BinaryStream::Write
void Write(const FacetModeler::Profile2D &val)
FacetModeler::Edge
Definition: FMMdlEdge.h:43
FacetModeler::BinaryStream::SetVertexListForBody
void SetVertexListForBody(VertexImages &vertexImages, FacetModeler::Body &val)
FMMdlVertex.h
FacetModeler::BinaryStream::Read
void Read(OdGePoint3d &val)
FacetModeler::EdgeImage::pNextKey
void * pNextKey
Definition: FMDataSerialize.h:62
length
GLuint GLsizei GLsizei * length
Definition: gles2_ext.h:274
OdaCommon.h
OdPlatformSettings.h
OD::File::Read
@ Read
Definition: RxFS.h:61
FacetModeler::BinaryStream
Definition: FMDataSerialize.h:96
FacetModeler::VertexImage::pVtx
FacetModeler::Vertex * pVtx
Definition: FMDataSerialize.h:45
FacetModeler::VertexImages
std::vector< VertexImage > VertexImages
Definition: FMDataSerialize.h:91
FacetModeler::BinaryStream::Write
void Write(const FacetModeler::Contour2D &val)
FacetModeler::FaceImage::pFace
FacetModeler::Face * pFace
Definition: FMDataSerialize.h:83
FacetModeler::Face
Definition: FMMdlFace.h:47
FacetModeler::FaceImages
std::vector< FaceImage > FaceImages
Definition: FMDataSerialize.h:93
FacetModeler::Vertex
Definition: FMMdlVertex.h:42
FacetModeler::LoopImage
Definition: FMDataSerialize.h:68
FacetModeler::BinaryStream::Read
void Read(FacetModeler::Contour2D &val)
FacetModeler::BinaryStream::ReadVertexImages
void ReadVertexImages(VertexImages &vertexImages, FacetModeler::Body *pBody)
FacetModeler::EdgeImage::pPrevKey
void * pPrevKey
Definition: FMDataSerialize.h:61
FacetModeler::LoopImage::LoopImage
LoopImage()
Definition: FMDataSerialize.h:69
FacetModeler::Profile2D
Definition: FMProfile2D.h:39
FacetModeler::BinaryStream::Write
void Write(const FacetModeler::Body &val)
FacetModeler::BinaryStream::Read
void Read(FacetModeler::Body &val)
FacetModeler::BinaryStream::Write
void Write(const OdGePoint2d &val)
FacetModeler::FaceImage::pPrevKey
void * pPrevKey
Definition: FMDataSerialize.h:85
FacetModeler::VertexImage::pNext
void * pNext
Definition: FMDataSerialize.h:48
FacetModeler::BinaryStream::ReadFaceImages
void ReadFaceImages(FaceImages &faceImages)
FacetModeler::EdgeImage::pPartnerKey
void * pPartnerKey
Definition: FMDataSerialize.h:64
FacetModeler::VertexImage
Definition: FMDataSerialize.h:42
FacetModeler::BinaryStream::WriteEdgesList
void WriteEdgesList(const FacetModeler::Body &val)
FacetModeler::BinaryStream::WriteVertex
void WriteVertex(FacetModeler::Vertex *pVertex)
FacetModeler::BinaryStream::ReadFaceToBody
void ReadFaceToBody(FacetModeler::Body &val)
FacetModeler::FaceImage::pFaceKey
void * pFaceKey
Definition: FMDataSerialize.h:84
FacetModeler::BinaryStream::OdaObjectMarker
OdaObjectMarker
Definition: FMDataSerialize.h:101
OdGePoint2d
Definition: GePoint2d.h:60
FacetModeler::LoopImages
std::vector< LoopImage > LoopImages
Definition: FMDataSerialize.h:76
FacetModeler::EdgeImage::pFaceKey
void * pFaceKey
Definition: FMDataSerialize.h:58