CFx SDK Documentation 2024 SP0
Loading...
Searching...
No Matches
DbObject.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
26
27#ifndef _ODDBXOBJECT_INCLUDED_
28#define _ODDBXOBJECT_INCLUDED_
30#include "TD_PackPush.h"
31
32#include "Gi/GiDrawable.h"
33#include "DbObjectId.h"
34#include "OdString.h"
35#include "DbObjectReactor.h"
36#include "IdArrays.h"
37#include "ResBuf.h"
38#include "DebugStuff.h"
39
40class OdDbFiler;
41class OdDbDwgFiler;
42class OdDbDxfFiler;
44class OdGiWorldDraw;
46class OdGsCache;
47class OdDbObjectImpl;
48class OdDbEntity;
49class OdDbDatabase;
50class OdDbIdMapping;
51class OdDbAuditInfo;
52class OdGeMatrix3d;
53class OdDbObjStorage;
54class OdString;
55class OdGePoint3d;
56class OdBinaryData;
57class OdDbIdPair;
58class OdDbField;
59class OdDbDictionary;
60class OdDbXrecord;
61
69
80#define ODDB_DECLARE_MEMBERS(ClassName)\
81protected: \
82 ClassName(OdDbObjectImpl* pImpl); \
83public: \
84ODRX_DECLARE_MEMBERS (ClassName)
85
94#define DBOBJECT_CONSTR(ClassName) OdSmartPtr<ClassName> (new ClassName, kOdRxObjAttach)
95
96
105{
106public:
110 const OdDbObjectId& objectId);
111};
112
113
118namespace OdDb
119{
128 {
129 kDrcNotApplicable = 0, // Not applicable to the object.
130 kDrcIgnore = 1, // If a duplicate record exists, use the existing record
131 // in the *database*, and ignore the clone.
132 kDrcReplace = 2, // If a duplicate record exists, replace it with the cloned record.
133 kDrcXrefMangleName = 3, // Incoming record names are mangled with <Xref>$0$<name>
134 kDrcMangleName = 4, // Incoming record names are mangled with $0$<name>
135 kDrcUnmangleName = 5, // Unmangle the names mangled by kDrcMangleName, then default to kDrcIgnore.
136 // Typically used by RefEdit when checking records into the original *database*.
137 kDrcMax = kDrcUnmangleName // The maximum value of this enum.
138 };
139
146 {
148 kVisible = 0
149 };
150
152 {
153 kDwg = 0, // Save as .dwg file
154 kDxf = 1, // Save as .dxf file
155 kDxb = 2, // Save as binary .dxf file
156 kUnknown = -1 // Database was created from scratch
157 };
158}
159
160
213{
214public:
216
217protected:
219public:
221
225 void addRef();
226
232 void release();
233
237 long numRefs() const;
238
246
251
256 { return getDbHandle (); }
257
272
288 virtual void setOwnerId(
289 OdDbObjectId ownerId);
290
295
306
315
323
324 // Opens/creates/unerases Xdictionary, and retrieves/creates Xrecord for the given name
325 //
326
341 const OdString& xrecordName,
343
348
356
357 //FELIX_CHANGE_BEGIN
361 void cancel();
362 //FELIX_CHANGE_END
363
394 OdDb::OpenMode mode);
395
396
416 virtual void subClose();
417
429 bool eraseIt = true);
430
462 bool erasing);
463
486 OdDbObject* pNewObject,
487 bool keepXData = true, bool
488 keepExtDict = true);
489
517 virtual void subHandOverTo(
518 OdDbObject* pNewObject);
519
535 OdDbObjectId otherId,
536 bool swapXdata = false,
537 bool swapExtDict = false);
538
562 virtual void subSwapIdWith(
563 const OdDbObjectId& otherId,
564 bool swapXdata = false,
565 bool swapExtDict = false);
566
578 virtual void audit(
579 OdDbAuditInfo* pAuditInfo);
580
590 void dwgIn(
591 OdDbDwgFiler* pFiler);
592
602 void dwgOut(
603 OdDbDwgFiler* pFiler) const;
604
617 OdDbDxfFiler* pFiler);
618
628 virtual void dxfOut(
629 OdDbDxfFiler* pFiler) const;
630
651 OdDbDwgFiler* pFiler);
652
669 virtual void dwgOutFields(
670 OdDbDwgFiler* pFiler) const;
671
692 OdDbDxfFiler* pFiler);
693
710 virtual void dxfOutFields(
711 OdDbDxfFiler* pFiler) const;
712
732 OdDbDxfFiler* pFiler);
733
751 virtual void dxfOutFields_R12(
752 OdDbDxfFiler* pFiler) const;
753
758
774 const OdString& regappName = OdString::kEmpty) const;
775
776
793 virtual void setXData(
794 const OdResBuf* pRb);
795
800
804 bool isErased() const;
805
809 bool isReadEnabled() const;
810
814 bool isWriteEnabled() const;
815
819 bool isNotifyEnabled() const;
820
825 bool isModified() const;
826
829// void setModified (bool bModified);
830
834 bool isModifiedXData() const;
835
848 bool isModifiedGraphics() const;
849
853 bool isNewObject() const;
854
858 bool isNotifying() const;
859
863 bool isUndoing() const;
864
865// bool isCancelling() const;
866
874 bool isReallyClosing() const;
875
879 bool isDBRO() const;
880
894 void assertReadEnabled() const;
895
916 bool autoUndo = true,
917 bool recordModified = true);
918
933
944 bool disable);
945
946 //FELIX_CHANGE_BEGIN
948 //FELIX_CHANGE_END
949
966
994 virtual void applyPartialUndo(
995 OdDbDwgFiler* pUndoFiler,
996 OdRxClass* pClassObj);
997
1007 OdDbObjectReactor* pReactor) const;
1008
1018 OdDbObjectReactor* pReactor) const;
1019
1034 const OdDbObjectId& objId);
1035
1045 const OdDbObjectId& objId);
1046
1053 const OdDbObjectId& objId) const;
1054
1059
1064
1081 const OdDbObject* pSubObj);
1082
1106 virtual void xmitPropagateModify() const;
1107
1134
1158 ODRX_SEALED_VIRTUAL OdDbObjectPtr wblockClone(OdDbIdMapping& idMap, OdDbObject* pOwner, bool bPrimary = true) const ODRX_SEALED;
1159
1183 virtual void appendToOwner(
1184 OdDbIdPair& idPair,
1185 OdDbObject* pOwnerObject,
1186 OdDbIdMapping& idMap);
1187
1194 void setOdDbObjectIdsInFlux();
1195
1200 bool isOdDbObjectIdsInFlux() const;
1201
1212 virtual void copied(
1213 const OdDbObject* pObject,
1214 const OdDbObject* pNewObject);
1215
1216
1227 virtual void erased(
1228 const OdDbObject* pObject,
1229 bool erasing = true);
1230
1242 virtual void goodbye(
1243 const OdDbObject* pObject);
1244
1254 virtual void openedForModify(
1255 const OdDbObject* pObject);
1256
1268 virtual void modified(
1269 const OdDbObject* pObject);
1270
1288 virtual void subObjModified(
1289 const OdDbObject* pObject,
1290 const OdDbObject* pSubObj);
1291
1305 virtual void modifyUndone(
1306 const OdDbObject* pObject);
1307
1322 virtual void modifiedXData(
1323 const OdDbObject* pObject);
1324
1338 virtual void unappended(
1339 const OdDbObject* pObject);
1340
1341
1353 virtual void reappended(
1354 const OdDbObject* pObject);
1355
1359 bool isAProxy() const;
1360
1370 virtual void objectClosed(
1371 const OdDbObjectId& objectId);
1372
1373
1399 virtual void modifiedGraphics(
1400 const OdDbObject* pObject);
1401
1417 virtual void copyFrom(
1418 const OdRxObject* pSource);
1419
1424 bool hasSaveVersionOverride() const;
1425
1435 void setHasSaveVersionOverride(
1436 bool hasSaveVersionOverride);
1437
1450 virtual OdDb::DwgVersion getObjectSaveVersion(
1451 const OdDbFiler* pFiler,
1452 OdDb::MaintReleaseVer* pMaintVer = 0) const;
1453
1476 virtual OdDbObjectPtr decomposeForSave(
1477 OdDb::DwgVersion ver,
1478 OdDbObjectId& replaceId,
1479 bool& exchangeXData);
1480
1504 virtual OdDbObjectPtr decomposeForSave(
1505 OdDb::SaveType format,
1506 OdDb::DwgVersion ver,
1507 OdDbObjectId& replaceId,
1508 bool& exchangeXData);
1509
1519 void convertForSave(OdDb::DwgVersion ver);
1520
1541 virtual void composeForLoad(OdDb::SaveType format, OdDb::DwgVersion version, OdDbAuditInfo* pAuditInfo);
1542
1546 virtual OdGiDrawable* drawable();
1547
1562 virtual OdUInt32 subSetAttributes(
1563 OdGiDrawableTraits* pTraits) const;
1564
1565 virtual bool subWorldDraw(
1566 OdGiWorldDraw* pWd) const;
1567
1568 virtual void subViewportDraw(
1569 OdGiViewportDraw* pVd) const;
1570
1579 virtual bool isPersistent() const;
1580
1583 virtual OdDbStub* id() const;
1584
1593 ODRX_SEALED_VIRTUAL OdResult getClassID(void* pClsid) const ODRX_SEALED;
1594
1595 // Override of OdGiDrawable
1596
1602 void setGsNode(OdGsCache* pNode);
1603
1604 // Override of OdGiDrawable
1605
1609 OdGsCache* gsNode() const;
1610
1611 /*
1612 void upgradeFromNotify (bool& wasWritable);
1613 void downgradeToNotify (bool wasWritable);
1614 OdResult closeAndPage (bool onlyWhenClean = true);
1615 virtual void swapReferences (const OdDbIdMapping& idMap);
1616 virtual OdGiDrawable* drawable ();
1617 OdDbObjPtrArray* reactors ();
1618 virtual OdRxObjectPtr clone (OdDbIdMapping& ownerIdMap) const;
1619 */
1620
1644 void xDataTransformBy(
1645 const OdGeMatrix3d& xfm);
1646
1650 bool hasFields() const;
1651
1658 const OdString& fieldName) const;
1659
1667 const OdString& fieldName,
1668 OdDb::OpenMode mode) const;
1669
1679 virtual OdDbObjectId setField(
1680 const OdString& fieldName,
1681 OdDbField* pField);
1682
1691 virtual OdResult removeField(
1692 OdDbObjectId fieldId);
1693
1702 virtual OdDbObjectId removeField(
1703 const OdString& fieldName);
1704
1708 OdDbObjectId getFieldDictionary() const;
1709
1714 OdDbObjectPtr getFieldDictionary(
1715 OdDb::OpenMode mode) const;
1716
1717
1723 virtual OdRxClass* saveAsClass(
1724 OdRxClass* pClass) const;
1725
1726protected: // overridables
1727 virtual OdResult subGetClassID(void* pClsid) const;
1728 virtual OdDbObjectPtr subDeepClone(OdDbIdMapping& ownerIdMap, OdDbObject* pOwner, bool bPrimary) const;
1729 virtual OdDbObjectPtr subWblockClone(OdDbIdMapping& ownerIdMap, OdDbObject* pOwner, bool bPrimary) const;
1730
1731 friend class OdDbSystemInternals;
1734 friend class OdDbObjectImpl;
1735 OdDbObjectImpl* m_pImpl;
1736};
1737
1746
1747
1768DBIO_EXPORT OdResBufPtr oddbEntGet( const OdDbObject* pObj, const OdString& regapps = OdString::kEmpty );
1769
1770inline OdResBufPtr oddbEntGet( const OdDbObjectId& id, const OdString& regapps = OdString::kEmpty )
1771{
1772 return oddbEntGet(id.safeOpenObject(), regapps);
1773}
1774
1775
1791
1792inline OdResult oddbEntMod( const OdDbObjectId& id, OdResBuf* pRb )
1793{
1794 return oddbEntMod(id.safeOpenObject(OdDb::kForWrite), pRb);
1795}
1796
1799
1802
1803
1804
1805#include "TD_PackPop.h"
1806
1807#endif //_ODDBXOBJECT_INCLUDED_
1808
1809
#define DBIO_EXPORT
Definition: DbExport.h:80
#define TOOLKIT_EXPORT
Definition: DbExport.h:40
OdSmartPtr< OdDbXrecord > OdDbXrecordPtr
Definition: DbObject.h:68
TOOLKIT_EXPORT OdDbObjectId oddbEntLast(OdDbDatabase *db)
DBIO_EXPORT OdResBufPtr oddbEntGet(const OdDbObject *pObj, const OdString &regapps=OdString::kEmpty)
DBIO_EXPORT OdResult oddbEntMod(OdDbObject *pObj, OdResBuf *pRb)
DBIO_EXPORT OdResult oddbEntMakeX(OdDbDatabase *pDb, OdResBuf *pRb, OdDbObjectPtr &pObj)
TOOLKIT_EXPORT OdDbObjectId oddbEntNext(OdDbObjectId id, OdDbDatabase *db)
DBIO_EXPORT OdResult oddbEntMake(OdDbDatabase *pDb, OdResBuf *pRb, OdDbObjectPtr &pObj)
true
Definition: DimVarDefs.h:2046
unsigned int OdUInt32
#define ODRX_SEALED_VIRTUAL
#define ODRX_SEALED
OdResult
Definition: OdResult.h:29
void swapIdWith(OdDbObjectId otherId, bool swapXdata=false, bool swapExtDict=false)
virtual void subSwapIdWith(const OdDbObjectId &otherId, bool swapXdata=false, bool swapExtDict=false)
bool isReallyClosing() const
void disableUndoRecording(bool disable)
virtual void applyPartialUndo(OdDbDwgFiler *pUndoFiler, OdRxClass *pClassObj)
OdDbObjectIdArray getPersistentReactors() const
OdDbObjectId objectId() const
bool isDBRO() const
OdDbHandle handle() const
Definition: DbObject.h:255
virtual void xmitPropagateModify() const
virtual OdResult dxfInFields(OdDbDxfFiler *pFiler)
long numRefs() const
bool isNotifyEnabled() const
void dwgIn(OdDbDwgFiler *pFiler)
bool isModifiedXData() const
OdDbHandle getDbHandle() const
virtual OdResult subOpen(OdDb::OpenMode mode)
bool isUndoing() const
bool isUndoRecordingDisabled() const
bool isEraseStatusToggled() const
virtual void addPersistentReactor(const OdDbObjectId &objId)
void addRef()
OdDbObjectId extensionDictionary() const
void assertWriteEnabled(bool autoUndo=true, bool recordModified=true)
void handOverTo(OdDbObject *pNewObject, bool keepXData=true, bool keepExtDict=true)
bool isNewObject() const
bool isReadEnabled() const
virtual OdResult dwgInFields(OdDbDwgFiler *pFiler)
virtual OdDb::DuplicateRecordCloning mergeStyle() const
ODRX_SEALED_VIRTUAL OdDbObjectPtr deepClone(OdDbIdMapping &idMap, OdDbObject *pOwner, bool bPrimary=true) const ODRX_SEALED
OdDbDatabase * database() const
void addReactor(OdDbObjectReactor *pReactor) const
void cancel()
virtual OdResBufPtr xData(const OdString &regappName=OdString::kEmpty) const
OdDbDwgFiler * undoFiler()
void upgradeOpen()
OdResult erase(bool eraseIt=true)
ODDB_DECLARE_MEMBERS(OdDbObject)
void removeReactor(OdDbObjectReactor *pReactor) const
void dwgOut(OdDbDwgFiler *pFiler) const
bool isNotifying() const
virtual void removePersistentReactor(const OdDbObjectId &objId)
virtual OdResult dxfInFields_R12(OdDbDxfFiler *pFiler)
bool hasPersistentReactor(const OdDbObjectId &objId) const
virtual void dwgOutFields(OdDbDwgFiler *pFiler) const
bool releaseExtensionDictionary()
OdDbXrecordPtr createXrecord(const OdString &xrecordName, OdDb::DuplicateRecordCloning style=OdDb::kDrcIgnore)
virtual void dxfOutFields(OdDbDxfFiler *pFiler) const
virtual void subHandOverTo(OdDbObject *pNewObject)
virtual void recvPropagateModify(const OdDbObject *pSubObj)
virtual OdResult dxfIn(OdDbDxfFiler *pFiler)
virtual void setXData(const OdResBuf *pRb)
OdDbObjectReactorArray getTransientReactors() const
void release()
virtual OdResult subErase(bool erasing)
virtual void dxfOutFields_R12(OdDbDxfFiler *pFiler) const
virtual void audit(OdDbAuditInfo *pAuditInfo)
void downgradeOpen()
virtual void dxfOut(OdDbDxfFiler *pFiler) const
bool isWriteEnabled() const
virtual void subClose()
virtual void setOwnerId(OdDbObjectId ownerId)
bool isModifiedGraphics() const
void assertReadEnabled() const
bool isErased() const
bool isModified() const
OdDbObjectId ownerId() const
void assertNotifyEnabled() const
void createExtensionDictionary()
OdError_XdataSizeExceeded(const OdDbObjectId &objectId)
FIRSTDLL_EXPORT_STATIC static const OdString kEmpty
Definition: OdString.h:98
GLint GLint GLint GLsizei GLsizei GLenum format
Definition: gles2_ext.h:111
DuplicateRecordCloning
Definition: DbObject.h:128
@ kDrcUnmangleName
Definition: DbObject.h:135
@ kDrcIgnore
Definition: DbObject.h:130
@ kDrcXrefMangleName
Definition: DbObject.h:133
@ kDrcReplace
Definition: DbObject.h:132
@ kDrcMangleName
Definition: DbObject.h:134
@ kDrcNotApplicable
Definition: DbObject.h:129
@ kDrcMax
Definition: DbObject.h:137
SaveType
Definition: DbObject.h:152
@ kDwg
Definition: DbObject.h:153
@ kDxb
Definition: DbObject.h:155
@ kUnknown
Definition: DbObject.h:156
@ kDxf
Definition: DbObject.h:154
Visibility
Definition: DbObject.h:146
@ kInvisible
Definition: DbObject.h:147
@ kVisible
Definition: DbObject.h:148
OpenMode
Definition: DbObjectId.h:54
@ kForWrite
Definition: DbObjectId.h:57