-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathPyDbObjectId.h
More file actions
200 lines (184 loc) · 6.21 KB
/
PyDbObjectId.h
File metadata and controls
200 lines (184 loc) · 6.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
#pragma once
#include "PyDbDatabase.h"
#pragma pack (push, 8)
class PyAcadObject;
//-----------------------------------------------------------------------------------------
//PyDbObjectId
void makePyDbObjectIdWrapper();
class PyDbObjectId
{
public:
PyDbObjectId();
PyDbObjectId(const AcDbObjectId& id);
bool operator==(const PyDbObjectId& rhs) const;
bool operator!=(const PyDbObjectId& rhs) const;
bool operator<(const PyDbObjectId& rhs) const;
bool operator>(const PyDbObjectId& rhs) const;
bool operator<=(const PyDbObjectId& rhs) const;
bool operator>=(const PyDbObjectId& rhs) const;
INT_PTR asOldId() const;
void setFromOldId(INT_PTR oldId);
bool isNull() const;
bool isResident() const;
bool isValid() const;
bool isWellBehaved() const;
bool convertToRedirectedId();
bool isErased() const;
bool isEffectivelyErased() const;
bool objectLeftOnDisk() const;
PyDbHandle handle() const;
PyDbHandle nonForwardedHandle() const;
std::string repr() const;
std::string str() const;
PyDbDatabase database() const;
PyDbDatabase originalDatabase() const;
PyRxClass objectClass() const;
bool isDerivedFrom(const PyRxClass& other) const;
std::size_t hash() const;
PyAcadObject acadObject() const;
static PyDbObjectId fromOldId(INT_PTR oldId);
public:
AcDbObjectId m_id;
};
typedef std::vector<PyDbObjectId> PyDbObjectIdArray;
inline boost::python::list ObjectIdArrayToPyList(const AcDbObjectIdArray& arr)
{
PyAutoLockGIL lock;
boost::python::list pyList;
for (const auto& id : arr)
pyList.append(PyDbObjectId(id));
return pyList;
}
inline AcDbObjectIdArray PyListToObjectIdArray(const boost::python::object& iterable)
{
auto vec{ py_list_to_std_vector<PyDbObjectId>(iterable) };
AcDbObjectIdArray arr;
arr.setPhysicalLength(vec.size());
for (auto& item : vec)
arr.append(item.m_id);
return arr;
}
template<typename T>
inline T* openAcDbObject(const PyDbObjectId& id, AcDb::OpenMode mode = AcDb::kForRead, bool erased = false)
{
T* pobj = nullptr;
PyThrowBadEs(acdbOpenObject<T>(pobj, id.m_id, mode, erased));
return pobj;
}
//-----------------------------------------------------------------------------------------
//AdsName
void makePyAdsNameWrapper();
class AdsName
{
public:
PyDbObjectId toObjectId() const;
void fromObjectId(const PyDbObjectId& id);
public:
std::array<int64_t, 2> m_data = { 0 };
};
//-----------------------------------------------------------------------------------------
//PyDbHardPointerId
void makePyDbHardPointerIdWrapper();
class PyDbHardPointerId : public PyDbObjectId
{
public:
PyDbHardPointerId();
PyDbHardPointerId(const PyDbObjectId& id);
PyDbHardPointerId& operator =(const PyDbHardPointerId& rhs);
PyDbHardPointerId& operator =(const PyDbObjectId& rhs);
public:
AcDbHardPointerId m_id;
};
//-----------------------------------------------------------------------------------------
//PyDbHardOwnershipId
void makePyDbAcDbHardOwnershipIdWrapper();
class PyDbHardOwnershipId : public PyDbObjectId
{
public:
PyDbHardOwnershipId();
PyDbHardOwnershipId(const PyDbObjectId& id);
PyDbHardOwnershipId& operator =(const PyDbHardOwnershipId& rhs);
PyDbHardOwnershipId& operator =(const PyDbObjectId& rhs);
public:
AcDbHardOwnershipId m_id;
};
//-----------------------------------------------------------------------------------------
//PyDbSoftPointerId
void makePySoftPointerIdWrapper();
class PyDbSoftPointerId : public PyDbObjectId
{
public:
PyDbSoftPointerId();
PyDbSoftPointerId(const PyDbObjectId& id);
PyDbSoftPointerId& operator =(const PyDbSoftPointerId& rhs);
PyDbSoftPointerId& operator =(const PyDbObjectId& rhs);
public:
AcDbSoftPointerId m_id;
};
//-----------------------------------------------------------------------------------------
//PyDbSoftOwnershipId
void makePyDbSoftOwnershipIdWrapper();
class PyDbSoftOwnershipId : public PyDbObjectId
{
public:
PyDbSoftOwnershipId();
PyDbSoftOwnershipId(const PyDbObjectId& id);
PyDbSoftOwnershipId& operator =(const PyDbSoftOwnershipId& rhs);
PyDbSoftOwnershipId& operator =(const PyDbObjectId& rhs);
public:
AcDbSoftOwnershipId m_id;
};
//-----------------------------------------------------------------------------------------
//PyDbHandle
void makePyDbHandleWrapper();
class PyDbHandle
{
public:
PyDbHandle();
PyDbHandle(int lo, int hi);
PyDbHandle(const std::string& src);
PyDbHandle(const Adesk::UInt64 src);
bool isNull() const;
void setNull();
Adesk::UInt32 low() const;
Adesk::UInt32 high() const;
void setLow(Adesk::UInt32 low);
void setHigh(Adesk::UInt32 high);
void setValue(Adesk::UInt64);
bool isOne(void) const;
Adesk::UInt64 value() const;
std::string toString() const;
std::string repr() const;
std::size_t hash() const;
void increment(void);
void decrement(void);
bool operator==(const PyDbHandle& rhs) const;
bool operator!=(const PyDbHandle& rhs) const;
public:
AcDbHandle m_hnd;
};
//-----------------------------------------------------------------------------------------
//PyDbXrefObjectId
void makePyDbXrefObjectIdWrapper();
class PyDbXrefObjectId
{
#if !defined(_BRXTARGET250)
public:
PyDbXrefObjectId();
PyDbXrefObjectId(const AcDbXrefObjectId& id);
bool operator== (const PyDbXrefObjectId& other) const;
bool operator!= (const PyDbXrefObjectId& other) const;
bool isValid(void) const;
bool isXref(void) const;
bool isNull(void) const;
void setNull(void);
void setXrefId(PyDbObjectId& xrefBlkId, const PyDbHandle& hObject);
void getXrefId(PyDbObjectId& xrefBlkId, PyDbHandle& hObject) const;
void setLocalId(PyDbObjectId& objId);
void getLocalId(PyDbObjectId& objId) const;
void resolveObjectId(PyDbObjectId& id) const;
public:
AcDbXrefObjectId m_imp;
#endif
};
#pragma pack (pop)