CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
DbXrefObjectId.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#ifndef _ODDBXREFOBJECTID_H_INCLUDED_
25#define _ODDBXREFOBJECTID_H_INCLUDED_
26
27#include "TD_PackPush.h"
28
29#include "DbObjectId.h"
30
38{
39 protected:
42 public:
44
45 bool operator ==(const OdDbXrefObjectId& xrefId) const
46 { return (xrefId.m_objectId == m_objectId) && (xrefId.m_objectHandle == m_objectHandle); }
47 bool operator !=(const OdDbXrefObjectId& xrefId) const
48 { return (xrefId.m_objectId != m_objectId) || (xrefId.m_objectHandle != m_objectHandle); }
49
50 bool isXref() const { return !m_objectHandle.isNull(); }
51 bool isValid() const { return m_objectId.isValid(); }
52
53 bool isNull() const { return m_objectId.isNull(); }
54 void setNull()
55 {
56 m_objectId = OdDbObjectId::kNull;
57 m_objectHandle = OdDbHandle();
58 }
59
61 {
62 if (isXref())
63 throw OdError(eInvalidXrefObjectId);
64 return m_objectId;
65 }
66 void setLocalId(const OdDbObjectId &objectId)
67 {
68 m_objectId = objectId;
69 m_objectHandle = OdDbHandle();
70 }
71
73 {
74 if (!isXref())
75 throw OdError(eInvalidXrefObjectId);
76 objectHandle = m_objectHandle;
77 return m_objectId;
78 }
79 void setXrefId(const OdDbObjectId &objectId, const OdDbHandle &objectHandle)
80 {
81 if (objectId.isNull())
82 throw OdError(eNullObjectId);
83 if (objectHandle.isNull())
84 throw OdError(eNullHandle);
85 m_objectId = objectId;
86 m_objectHandle = objectHandle;
87 }
88
90
91 void serializeToResbuf(OdResBufPtr &pResBuf, OdResBufPtr &pLastResBuf) const;
92 void serializeFromResbuf(const OdResBufPtr pResBuf, OdResBufPtr &pNextResBuf, const OdDbDatabase* pDb);
93
94 // Helpers
95 static void seekToResbuf(OdResBufPtr &pResBuf, OdResBufPtr &pLastResBuf);
96};
97
98#include "TD_PackPop.h"
99
100#endif // _ODDBXREFOBJECTID_H_INCLUDED_
#define DBENT_EXPORT
Definition: DbExport.h:67
bool operator!=(T left, const OdGiVariant::EnumType right)
Definition: GiVariant.h:403
bool operator==(T left, const OdGiVariant::EnumType right)
Definition: GiVariant.h:397
bool isNull() const
Definition: DbHandle.h:123
bool isValid() const
static TOOLKIT_EXPORT_STATIC const OdDbObjectId kNull
Definition: DbObjectId.h:110
bool isNull() const
Definition: DbObjectId.h:115
OdDbObjectId getLocalId() const
void setLocalId(const OdDbObjectId &objectId)
bool isXref() const
void setXrefId(const OdDbObjectId &objectId, const OdDbHandle &objectHandle)
OdDbHandle m_objectHandle
OdDbObjectId resolveObjectId() const
bool isNull() const
void serializeFromResbuf(const OdResBufPtr pResBuf, OdResBufPtr &pNextResBuf, const OdDbDatabase *pDb)
OdDbObjectId getXrefId(OdDbHandle &objectHandle)
bool isValid() const
OdDbObjectId m_objectId
static void seekToResbuf(OdResBufPtr &pResBuf, OdResBufPtr &pLastResBuf)
void serializeToResbuf(OdResBufPtr &pResBuf, OdResBufPtr &pLastResBuf) const