CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
DbObjectId.h
Go to the documentation of this file.
1
2// Copyright (C) 2002-2022, 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-2022 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
25#ifndef _ODDBOBJECTID_INCLUDED_
26#define _ODDBOBJECTID_INCLUDED_ /* {Secret } */
27
28#include "DbExport.h"
29#include "DbHandle.h"
30#include "OdError.h"
31#include "TD_PackPush.h"
32
33class OdDbDatabase;
34class OdDbObject;
35class OdRxClass;
36
37template <class T> class OdSmartPtr;
38
43
44class OdDbStub;
45class OdDbStubExt;
46
51namespace OdDb
52{
54 {
55 kNotOpen = -1, // Object is not open.
56 kForRead = 0, // Object is open for reading.
57 kForWrite = 1, // Object is open for reading and/or writing.
58 kForNotify = 2 // Object is open for notify.
59 };
60}
61
91{
92public:
97 OdDbObjectId () : m_Id (0) { }
98
105 OdDbStub* objectId) : m_Id (objectId) { }
106
111
115 bool isNull () const { return m_Id == 0; }
116
120 void setNull () { m_Id = 0; }
121
125 bool isValid () const;
126
127 // VS2015 requires to create copy constructor explicity
128#if defined(_MSC_VER) && (_MSC_VER > 1800)
129 OdDbObjectId(const OdDbObjectId& objectId) = default;
130 OdDbObjectId& operator = (const OdDbObjectId& objectId) = default;
131#endif
132
135 OdDbObjectId& operator = (
136 OdDbStub* objectId) { m_Id = objectId; return *this; }
137
139 const OdDbObjectId& objectId) const;
140
142 const OdDbObjectId& objectId) const;
143
145 const OdDbObjectId& objectId) const;
146
148 const OdDbObjectId& objectId) const;
149
151 const OdDbObjectId& objectId) const;
152
154 const OdDbObjectId& objectId) const;
155
156 bool operator ! () const { return isNull(); }
157
163 inline operator OdDbStub* () const { return (OdDbStub*)m_Id; }
164
170 inline OdDbStubExt* operator -> () const { return (OdDbStubExt*)m_Id; }
171
179
191
197
201 bool isErased () const;
202
207 bool isEffectivelyErased () const;
208
214 bool objectLeftOnDisk () const;
215
225 const OdDbHandle& getHandle () const;
226
237
259 OdDbObjectPtr& pObj,
260 OdDb::OpenMode openMode = OdDb::kForRead,
261 bool openErasedOne = false) const;
283 OdDb::OpenMode openMode = OdDb::kForRead,
284 bool openErasedOne = false) const;
315 OdDb::OpenMode openMode = OdDb::kForRead,
316 bool openErasedOne = false) const;
317
324 OdDbObject* pObj);
325
327
328protected:
329 friend class OdDbStub;
330 OdDbStub* m_Id;
331};
332
333//FELIX_CHANGE_BEGIN
335{
336 size_t operator()( const OdDbObjectId& key ) const
337 {
338 return std::hash<const OdDbStub*>()( key.operator OdDbStub * ( ) );
339 }
340};
341//FELIX_CHANGE_END
342
358{
359public:
360
362
364 const OdDbObjectId& objectId) : OdDbObjectId (objectId) {}
365
368 OdDbStub* objectId) : OdDbObjectId (objectId) {}
369
371 const OdDbObjectId& objectId) { OdDbObjectId::operator= (objectId); return *this; }
372
373
376 OdDbStub* objectId) { m_Id = objectId; return *this; }
377
379 const OdDbObjectId& objectId) const { return OdDbObjectId::operator!= (objectId); }
380
383 OdDbStub* objectId) const { return OdDbObjectId::operator!= (objectId); }
384
386 const OdDbObjectId& objectId) const { return OdDbObjectId::operator== (objectId); }
387
390 OdDbStub* objectId) const { return OdDbObjectId::operator== (objectId); }
391};
392
408{
409public:
410
412
414 const OdDbObjectId& objectId) : OdDbObjectId (objectId) {}
415
418 OdDbStub* objectId) : OdDbObjectId (objectId) {}
419
421 const OdDbObjectId& objectId) { OdDbObjectId::operator= (objectId); return *this; }
422
425 OdDbStub* objectId) { m_Id = objectId; return *this; }
426
428 const OdDbObjectId& objectId) const { return OdDbObjectId::operator!= (objectId); }
429
432 OdDbStub* objectId) const { return OdDbObjectId::operator!= (objectId); }
433
435 const OdDbObjectId& objectId) const { return OdDbObjectId::operator== (objectId); }
436
439 OdDbStub* objectId) const { return OdDbObjectId::operator== (objectId); }
440
441};
442
455{
456public:
457
459
461 const OdDbObjectId& objectId) : OdDbObjectId (objectId) {}
462
465 OdDbStub* objectId) : OdDbObjectId (objectId) {}
466
467 OdDbHardPointerId& operator = (
468 const OdDbHardPointerId& objectId) { OdDbObjectId::operator= (objectId); return *this; }
469
470 OdDbHardPointerId& operator = (
471 const OdDbObjectId& objectId) { OdDbObjectId::operator= (objectId); return *this; }
472
474 OdDbHardPointerId& operator = (
475 OdDbStub* objectId) { m_Id = objectId; return *this; }
476
478 const OdDbObjectId& objectId) const { return OdDbObjectId::operator!= (objectId); }
479
482 OdDbStub* objectId) const { return OdDbObjectId::operator!= (objectId); }
483
485 const OdDbObjectId& objectId) const { return OdDbObjectId::operator== (objectId); }
486
489 OdDbStub* objectId) const { return OdDbObjectId::operator== (objectId); }
490};
491
503{
504public:
506
508 const OdDbObjectId& objectId) : OdDbObjectId (objectId) {}
509
512 OdDbStub* objectId) : OdDbObjectId (objectId) {}
513
514 OdDbSoftPointerId& operator = (
515 const OdDbSoftPointerId& objectId) { OdDbObjectId::operator= (objectId); return *this; }
516
517 OdDbSoftPointerId& operator = (
518 const OdDbObjectId& objectId) { OdDbObjectId::operator= (objectId); return *this; }
519
521 OdDbSoftPointerId& operator = (
522 OdDbStub* objectId) { m_Id = (OdDbStub*)objectId; return *this; }
523
525 const OdDbObjectId& objectId) const { return OdDbObjectId::operator!= (objectId); }
526
529 OdDbStub* objectId) const { return OdDbObjectId::operator!= (objectId); }
530
532 const OdDbObjectId& objectId) const { return OdDbObjectId::operator== (objectId); }
535 OdDbStub* objectId) const { return OdDbObjectId::operator== (objectId); }
536
537};
538
539#include "TD_PackPop.h"
540
541#endif //_ODDBOBJECTID_INCLUDED_
542
543
#define TOOLKIT_EXPORT
Definition: DbExport.h:40
#define TOOLKIT_EXPORT_STATIC
Definition: DbExport.h:42
OdSmartPtr< OdDbObject > OdDbObjectPtr
Definition: DbObjectId.h:42
bool operator!=(T left, const OdGiVariant::EnumType right)
Definition: GiVariant.h:403
bool operator==(T left, const OdGiVariant::EnumType right)
Definition: GiVariant.h:397
OdResult
Definition: OdResult.h:29
bool operator>=(const OdString &s1, const OdString &s2)
Definition: OdString.h:1376
bool operator<=(const OdString &s1, const OdString &s2)
Definition: OdString.h:1354
bool operator<(const OdString &s1, const OdString &s2)
Definition: OdString.h:1309
bool operator>(const OdString &s1, const OdString &s2)
Definition: OdString.h:1332
OdDbHardOwnershipId(const OdDbObjectId &objectId)
Definition: DbObjectId.h:363
OdDbHardOwnershipId(OdDbStub *objectId)
Definition: DbObjectId.h:367
OdDbHardPointerId(OdDbStub *objectId)
Definition: DbObjectId.h:464
OdDbHardPointerId(const OdDbObjectId &objectId)
Definition: DbObjectId.h:460
OdDbDatabase * originalDatabase() const
bool isValid() const
bool operator==(const OdDbObjectId &objectId) const
static TOOLKIT_EXPORT_STATIC const OdDbObjectId kNull
Definition: DbObjectId.h:110
OdDbDatabase * database() const
OdRxClass * objectClass() const
const OdDbHandle & getHandle() const
bool isEffectivelyErased() const
const OdDbHandle & getNonForwardedHandle() const
void setNull()
Definition: DbObjectId.h:120
OdDbObjectPtr safeOpenObject(OdDb::OpenMode openMode=OdDb::kForRead, bool openErasedOne=false) const
OdDbObjectId & operator=(OdDbStub *objectId)
Definition: DbObjectId.h:135
OdDbObjectPtr openObject(OdDb::OpenMode openMode=OdDb::kForRead, bool openErasedOne=false) const
OdDbStub * m_Id
Definition: DbObjectId.h:330
bool objectLeftOnDisk() const
bool operator!=(const OdDbObjectId &objectId) const
bool isErased() const
OdDbObjectId(OdDbStub *objectId)
Definition: DbObjectId.h:104
void bindObject(OdDbObject *pObj)
bool isNull() const
Definition: DbObjectId.h:115
OdResult openObject(OdDbObjectPtr &pObj, OdDb::OpenMode openMode=OdDb::kForRead, bool openErasedOne=false) const
void convertToRedirectedId()
OdDbSoftOwnershipId(const OdDbObjectId &objectId)
Definition: DbObjectId.h:413
OdDbSoftOwnershipId(OdDbStub *objectId)
Definition: DbObjectId.h:417
OdDbSoftPointerId(const OdDbObjectId &objectId)
Definition: DbObjectId.h:507
OdDbSoftPointerId(OdDbStub *objectId)
Definition: DbObjectId.h:511
OpenMode
Definition: DbObjectId.h:54
@ kNotOpen
Definition: DbObjectId.h:55
@ kForRead
Definition: DbObjectId.h:56
@ kForWrite
Definition: DbObjectId.h:57
@ kForNotify
Definition: DbObjectId.h:58
size_t operator()(const OdDbObjectId &key) const
Definition: DbObjectId.h:336