CFx SDK Documentation  2020SP3
DbXrefObjectId.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 #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_
OdDbDatabase
Definition: DbDatabase.h:421
OdDbObjectId::isNull
bool isNull() const
Definition: DbObjectId.h:123
OdDbXrefObjectId::getXrefId
OdDbObjectId getXrefId(OdDbHandle &objectHandle)
Definition: DbXrefObjectId.h:72
OdDbXrefObjectId::serializeToResbuf
void serializeToResbuf(OdResBufPtr &pResBuf, OdResBufPtr &pLastResBuf) const
OdDbObjectId
Definition: DbObjectId.h:99
OdDbXrefObjectId::getLocalId
OdDbObjectId getLocalId() const
Definition: DbXrefObjectId.h:60
OdDbHandle::isNull
bool isNull() const
Definition: DbHandle.h:123
TD_PackPop.h
OdDbXrefObjectId::seekToResbuf
static void seekToResbuf(OdResBufPtr &pResBuf, OdResBufPtr &pLastResBuf)
OdDbXrefObjectId::setXrefId
void setXrefId(const OdDbObjectId &objectId, const OdDbHandle &objectHandle)
Definition: DbXrefObjectId.h:79
OdDbXrefObjectId::isXref
bool isXref() const
Definition: DbXrefObjectId.h:50
OdDbObjectId::isValid
bool isValid() const
OdDbXrefObjectId::setNull
void setNull()
Definition: DbXrefObjectId.h:54
OdDbXrefObjectId::m_objectHandle
OdDbHandle m_objectHandle
Definition: DbXrefObjectId.h:41
OdSmartPtr< OdResBuf >
OdDAI::operator!=
bool DAI_EXPORT operator!=(const OdDAI::OdSelect &left, const OdDAI::OdSelect &right)
DbObjectId.h
OdDbXrefObjectId::isValid
bool isValid() const
Definition: DbXrefObjectId.h:51
OdDbObjectId::kNull
static TOOLKIT_EXPORT_STATIC const OdDbObjectId kNull
Definition: DbObjectId.h:118
TD_PackPush.h
OdDbXrefObjectId::m_objectId
OdDbObjectId m_objectId
Definition: DbXrefObjectId.h:40
OdDbXrefObjectId::resolveObjectId
OdDbObjectId resolveObjectId() const
OdDbXrefObjectId
Definition: DbXrefObjectId.h:38
OdDbHandle
Definition: DbHandle.h:67
OdError
Definition: OdError.h:43
OdDAI::operator==
bool DAI_EXPORT operator==(const OdFileDescriptionAuto &left, const OdFileDescriptionAuto &right)
OdDbXrefObjectId::isNull
bool isNull() const
Definition: DbXrefObjectId.h:53
TOOLKIT_EXPORT
#define TOOLKIT_EXPORT
Definition: DbExport.h:40
OdDbXrefObjectId::setLocalId
void setLocalId(const OdDbObjectId &objectId)
Definition: DbXrefObjectId.h:66
OdDbXrefObjectId::serializeFromResbuf
void serializeFromResbuf(const OdResBufPtr pResBuf, OdResBufPtr &pNextResBuf, const OdDbDatabase *pDb)
OdDbXrefObjectId::OdDbXrefObjectId
OdDbXrefObjectId()
Definition: DbXrefObjectId.h:43