CFx SDK Documentation  2023 SP0
daiObjectId.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2019, 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 Open Design Alliance software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Open Design Alliance Copyright (C) 2002-2019 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 #ifndef _DAI_OBJECT_ID_H_
25 #define _DAI_OBJECT_ID_H_
26 
27 #include "RxObject.h"
28 #include "DbHandle.h"
29 #include "daiBuildOptions.h"
30 #include "daiEntityInstance.h"
31 
32 template <class T> class OdSmartPtr;
33 
37 namespace OdDAI {
38  class EntityInstanceWrapper;
40 }
41 
42 class OdDbStub;
43 
47 namespace OdDAI {
48 
52  enum OpenMode {
53  //kForInitializing = -2,
54  kNotOpen = -1, // Object is not open.
55  kForRead = 0//, // Object is open for reading.
56  //kForWrite = 1, // Object is open for reading and/or writing.
57  //kForNotify = 2 // Object is open for notifying.
58  };
59 
60 }
61 
63 
68  public:
69 
71 
72  DAI_EXPORT_STATIC static const OdDAIObjectId kNull; // A NULL object identifier.
73  DAI_EXPORT_STATIC static const handle_type kNullHandle; // A NULL object database handle.
74 
79 
84  OdDAIObjectId(OdDbStub* objectId);
85 
90  bool isNull() const;
91 
95  void setNull();
96 
101  bool isValid() const;
102 
109 
115  OdDAIObjectId& operator=(OdDbStub* objectId);
116 
122  bool operator<(const OdDAIObjectId& objectId) const;
123 
129  bool operator>(const OdDAIObjectId& objectId) const;
130 
136  bool operator>=(const OdDAIObjectId& objectId) const;
137 
143  bool operator<=(const OdDAIObjectId& objectId) const;
144 
150  bool operator==(const OdDAIObjectId& objectId) const;
151 
157  bool operator!=(const OdDAIObjectId& objectId) const;
158 
159 
164  bool operator!() const { return isNull(); }
165 
171  inline operator OdDbStub*() const { return m_Id; }
172 
178  inline OdDbStub* operator->() const {
179  return reinterpret_cast<OdDbStub*>(m_Id);
180  }
181 
190 
194  void erase() const;
195 
200  bool isErased() const;
201 
208  const OdDbHandle& getHandle() const;
209 
225  bool openErasedOne = false) const;
226 
232 
233 //DOM-IGNORE-BEGIN
234  protected:
235 
236  OdDbStub* id() const;
237  friend class OdDbStub;
238  OdDbStub* m_Id;
239 //DOM-IGNORE-END
240  };
241 
246 
247 #endif // _DAI_OBJECT_ID_H_
OdDAI::EntityInstancePtr get() const
OdDAIObjectId & operator=(const OdDAIObjectId &objectId)
OdDAIObjectId(OdDbStub *objectId)
bool operator!() const
Definition: daiObjectId.h:164
OdDAI::EntityInstancePtr openObject(OdDAI::OpenMode openMode=OdDAI::kForRead, bool openErasedOne=false) const
void erase() const
OdDbBaseDatabase * model() const
bool isNull() const
bool operator<(const OdDAIObjectId &objectId) const
static DAI_EXPORT_STATIC const OdDAIObjectId kNull
Definition: daiObjectId.h:72
OdDbStub * operator->() const
Definition: daiObjectId.h:178
bool isErased() const
static DAI_EXPORT_STATIC const handle_type kNullHandle
Definition: daiObjectId.h:73
const OdDbHandle & getHandle() const
bool operator!=(const OdDAIObjectId &objectId) const
bool operator>(const OdDAIObjectId &objectId) const
OdDbStub * id() const
OdDbHandle handle_type
Definition: daiObjectId.h:70
bool operator==(const OdDAIObjectId &objectId) const
OdDbStub * m_Id
Definition: daiObjectId.h:238
bool operator>=(const OdDAIObjectId &objectId) const
bool operator<=(const OdDAIObjectId &objectId) const
bool isValid() const
OdDAIObjectId & operator=(OdDbStub *objectId)
#define DAI_EXPORT
#define DAI_EXPORT_STATIC
OdRxObject OdDbBaseDatabase
Definition: daiObjectId.h:62
OdArray< OdDAIObjectId > OdDAIObjectIds
Definition: daiObjectId.h:245
@ kForRead
Definition: daiObjectId.h:55
@ kNotOpen
Definition: daiObjectId.h:54
OdSmartPtr< EntityInstanceWrapper > EntityInstanceWrapperPtr
Definition: daiObjectId.h:38