CFx SDK Documentation  2022 SP0
OdBlob.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 
24 // OdBlob.h: interface for the OdBlob class.
25 //
27 
28 #ifndef _ODBLOB_H_INCLUDED_
29 #define _ODBLOB_H_INCLUDED_
30 
31 #include "MemoryStreamImpl.h"
32 #include "StaticRxObject.h"
33 class OdDbStub;
34 
35 class FIRSTDLL_EXPORT OdBlob : public OdStaticRxObject<OdMemoryStreamImpl<OdMemoryStream> > //FELIX_CHANGE
36 {
37 public:
38  inline OdBlob(OdUInt32 nPageSize = 0x1000);
39 
40  inline bool rdBool();
41  inline void wrBool(bool);
42  inline OdInt8 rdInt8();
43  inline void wrInt8(OdInt8);
44  inline OdInt16 rdInt16();
45  inline void wrInt16(OdInt16);
46  inline OdInt32 rdInt32();
47  inline void wrInt32(OdInt32);
48  inline OdInt64 rdInt64();
49  inline void wrInt64(OdInt64);
50  inline double rdDouble();
51  inline void wrDouble(double);
52  inline OdGePoint3d rdPoint3d();
53  inline void wrPoint3d(const OdGePoint3d&);
54  inline OdGeVector3d rdVector3d();
55  inline void wrVector3d(const OdGeVector3d&);
56  inline void* rdAddress();
57  inline void wrAddress(const void*);
58 
59  inline void rdBytes(void* buf, OdUInt32 len);
60  inline void wrBytes(const void* buf, OdUInt32 len);
61 
62  inline void rdPoints2d(OdGePoint2d* points, OdUInt32 num);
63  inline void wrPoints2d(const OdGePoint2d* points, OdUInt32 num);
64 
65  inline void rdPoints3d(OdGePoint3d* points, OdUInt32 num);
66  inline void wrPoints3d(const OdGePoint3d* points, OdUInt32 num);
67 
68  inline void wrDoubles(const double* doubles, OdUInt32 num);
69  inline void rdDoubles(double* doubles, OdUInt32 num);
70 
71  inline void rdObjectIds(OdDbStub** pRes, OdUInt32 num);
72  inline OdDbStub* rdObjectId();
73  inline void wrObjectId(const OdDbStub* id);
74 };
75 
76 inline OdBlob::OdBlob(OdUInt32 nPageSize)
77 {
78  setPageDataSize(nPageSize);
79 }
80 
81 #define BLOB_DATA(type, name) \
82 inline type OdBlob::rd##name() \
83 {\
84  type val;\
85  getBytes(&val, sizeof(type));\
86  return val;\
87 }\
88 inline void OdBlob::wr##name(type val)\
89 { putBytes(&val, sizeof(type));}
90 
91 BLOB_DATA(bool, Bool)
92 BLOB_DATA(OdInt8, Int8)
93 BLOB_DATA(OdInt16, Int16)
94 BLOB_DATA(OdInt32, Int32)
95 BLOB_DATA(OdInt64, Int64)
96 BLOB_DATA(double, Double)
97 
98 inline OdGePoint3d OdBlob::rdPoint3d()
99 {
100  OdGePoint3d val;
101  getBytes(&val, sizeof(val));
102  return val;
103 }
104 
105 inline void OdBlob::wrPoint3d(const OdGePoint3d& val)
106 { putBytes(&val, sizeof(OdGePoint3d));}
107 
109 {
110  OdGeVector3d val;
111  getBytes(&val, sizeof(val));
112  return val;
113 }
114 
115 inline void OdBlob::wrVector3d(const OdGeVector3d& val)
116 { putBytes(&val, sizeof(OdGeVector3d));}
117 
118 
119 inline void* OdBlob::rdAddress()
120 {
121  void* val;
122  getBytes(&val, sizeof(void*));
123  return val;
124 }
125 
126 inline void OdBlob::wrAddress(const void* val)
127 { putBytes(&val, sizeof(void*));}
128 
129 
130 
131 inline void OdBlob::rdBytes(void* buf, OdUInt32 len)
132 {
133  getBytes(buf, len);
134 }
135 
136 inline void OdBlob::wrBytes(const void* buf, OdUInt32 len)
137 {
138  putBytes(buf, len);
139 }
140 
141 inline void OdBlob::rdPoints3d(OdGePoint3d* points, OdUInt32 num)
142 {
143  getBytes(points, num * sizeof(OdGePoint3d));
144 }
145 
146 inline void OdBlob::wrPoints3d(const OdGePoint3d* points, OdUInt32 num)
147 {
148  putBytes(points, num * sizeof(OdGePoint3d));
149 }
150 
151 inline void OdBlob::rdPoints2d(OdGePoint2d* points, OdUInt32 num)
152 {
153  getBytes(points, num * sizeof(OdGePoint2d));
154 }
155 
156 inline void OdBlob::wrPoints2d(const OdGePoint2d* points, OdUInt32 num)
157 {
158  putBytes(points, num * sizeof(OdGePoint2d));
159 }
160 
161 inline void OdBlob::wrDoubles(const double* doubles, OdUInt32 num)
162 {
163  putBytes(doubles, num * sizeof(double));
164 }
165 
166 inline void OdBlob::rdDoubles(double* doubles, OdUInt32 num)
167 {
168  getBytes(doubles, num * sizeof(double));
169 }
170 
171 inline void OdBlob::rdObjectIds(OdDbStub** pRes, OdUInt32 num)
172 {
173  getBytes(pRes, num * sizeof(OdDbStub*));
174 }
175 
176 inline OdDbStub* OdBlob::rdObjectId()
177 {
178  OdDbStub* id;
179  getBytes(&id, sizeof(id));
180  return id;
181 }
182 
183 inline void OdBlob::wrObjectId(const OdDbStub* id)
184 {
185  putBytes(&id, sizeof(OdDbStub*));
186 }
187 
188 #endif // #ifndef _ODBLOB_H_INCLUDED_
#define BLOB_DATA(type, name)
Definition: OdBlob.h:81
unsigned int OdUInt32
short OdInt16
signed char OdInt8
int OdInt32
#define FIRSTDLL_EXPORT
Definition: RootExport.h:39
Definition: OdBlob.h:36
void wrDoubles(const double *doubles, OdUInt32 num)
Definition: OdBlob.h:161
void wrInt64(OdInt64)
void wrPoints3d(const OdGePoint3d *points, OdUInt32 num)
Definition: OdBlob.h:146
void wrInt16(OdInt16)
void wrObjectId(const OdDbStub *id)
Definition: OdBlob.h:183
void rdDoubles(double *doubles, OdUInt32 num)
Definition: OdBlob.h:166
OdInt16 rdInt16()
OdGeVector3d rdVector3d()
Definition: OdBlob.h:108
OdInt8 rdInt8()
void wrInt8(OdInt8)
void wrBool(bool)
void wrAddress(const void *)
Definition: OdBlob.h:126
void wrPoint3d(const OdGePoint3d &)
Definition: OdBlob.h:105
OdInt64 rdInt64()
void rdPoints2d(OdGePoint2d *points, OdUInt32 num)
Definition: OdBlob.h:151
OdDbStub * rdObjectId()
Definition: OdBlob.h:176
void * rdAddress()
Definition: OdBlob.h:119
void rdObjectIds(OdDbStub **pRes, OdUInt32 num)
Definition: OdBlob.h:171
double rdDouble()
void wrPoints2d(const OdGePoint2d *points, OdUInt32 num)
Definition: OdBlob.h:156
void wrDouble(double)
OdBlob(OdUInt32 nPageSize=0x1000)
Definition: OdBlob.h:76
void wrInt32(OdInt32)
OdInt32 rdInt32()
void wrVector3d(const OdGeVector3d &)
Definition: OdBlob.h:115
bool rdBool()
void wrBytes(const void *buf, OdUInt32 len)
Definition: OdBlob.h:136
void rdBytes(void *buf, OdUInt32 len)
Definition: OdBlob.h:131
void rdPoints3d(OdGePoint3d *points, OdUInt32 num)
Definition: OdBlob.h:141
Definition: Int64.h:43
void putBytes(const void *buffer, OdUInt32 nLen)
void getBytes(void *buffer, OdUInt32 nLen)
void setPageDataSize(OdUInt32 nPageSize)
@ Double
Definition: Tf.h:400
@ Bool
Definition: Tf.h:392