zjf
2023-03-13 881f0da670f20c401c1e1d08b36253abb28f72d2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
/////////////////////////////////////////////////////////////////////////////// 
// Copyright (C) 2002-2016, Open Design Alliance (the "Alliance"). 
// All rights reserved. 
// 
// This software and its documentation and related materials are owned by 
// the Alliance. The software may only be incorporated into application 
// programs owned by members of the Alliance, subject to a signed 
// Membership Agreement and Supplemental Software License Agreement with the
// Alliance. The structure and organization of this software are the valuable  
// trade secrets of the Alliance and its suppliers. The software is also 
// protected by copyright law and international treaty provisions. Application  
// programs incorporating this software must include the following statement 
// with their copyright notices:
//   
//   This application incorporates Teigha(R) software pursuant to a license 
//   agreement with Open Design Alliance.
//   Teigha(R) Copyright (C) 2002-2016 by Open Design Alliance. 
//   All rights reserved.
//
// By use of this software, its documentation or related materials, you 
// acknowledge and accept the above terms.
///////////////////////////////////////////////////////////////////////////////
 
 
 
 
#ifndef _ODDBBLOCKTABLE_INCLUDED
#define _ODDBBLOCKTABLE_INCLUDED
 
#include "TD_PackPush.h"
 
#include "DbSymbolTable.h"
 
class OdDbBlockTableRecord;
 
/** \details
    This class implements bidirectional Iterator objects that traverse entries in OdDbBlockTable objects in an OdDbDatabase instance.
 
    Library: TD_Db
 
    <group OdDb_Classes>
*/
class TOOLKIT_EXPORT OdDbBlockTableIterator : public OdDbSymbolTableIterator
{
public:
  
  ODRX_DECLARE_MEMBERS(OdDbBlockTableIterator);
  
protected:
 
  OdDbBlockTableIterator();
    
  OdDbBlockTableIterator(
    OdDbSymbolTableIteratorImpl* pImpl);
};
 
/** \details
    This template class is a specialization of the OdSmartPtr class for OdDbBlockTableIterator object pointers.
*/
typedef OdSmartPtr<OdDbBlockTableIterator> OdDbBlockTableIteratorPtr;
 
 
/** \details
    This class implements the BlockTable, which represents block definitions in an OdDbDatabase instance.
 
    \sa
    TD_Db
    
    <group OdDb_Classes>
*/
class TOOLKIT_EXPORT OdDbBlockTable : public OdDbSymbolTable
{
public:
  ODDB_DECLARE_MEMBERS(OdDbBlockTable);
 
  /** \note
    Teigha applications typically will not use this constructor, insofar as 
    the OdDbDatabase class creates its own instance.
  */
  OdDbBlockTable();
 
  /** \details
    Searches the named record object in the predefined table object using the 
    specified name and opens it in the specified mode.
    
    \param recordName [in] Record name. 
    \param openMode [in] Mode in which to open the record. 
    \param getErasedRecord [in] If and only if true, erased records will be opened or retrieved. 
    
    \returns 
    A smart pointer to the object if successful, otherwise a null smart pointer
  */
  virtual OdDbSymbolTableRecordPtr getAt(
    const OdString& recordName,
    OdDb::OpenMode openMode, 
    bool getErasedRecord = false) const;
 
  /** \details
    Searches the named record object in the predefined table object using the 
    specified name and opens it in the specified mode.
    
    \param recordName [in] Record name. 
    \param openMode [in] Mode in which to open the record. 
    \param getErasedRecord [in] If and only if true, erased records will be opened or retrieved. 
    
    \returns 
    A smart pointer to the object if successful, otherwise a null smart pointer
  */
  virtual OdDbObjectId getAt(
    const OdString& recordName, 
    bool getErasedRecord = false) const;
 
  /** \details
    Determines whether the named record object exists in the predefined table object 
    using the specified name.
    
    \param recordName [in] Record name. 
    
    \returns 
    Returns true if and only if the predefined table object contains the specified named record object.
  */
  virtual bool has(const OdString& recordName) const;
 
  /** \details
    Determines whether the named record object exists in the predefined table object 
    using the specified object ID.
      
    \param objectId [in] Object ID. 
    
    \returns 
    Returns true if and only if the predefined table object contains the specified record object.
  */  
  virtual bool has(const OdDbObjectId& objectId) const;
 
  /** \details
    Returns an Iterator object that can be used to traverse through record objects in the 
    predefined table object.
      
    \param atBeginning [in] true - to start at the beginning, or false - to start at the end.
    \param skipDeleted [in] true - to iterate only unerased records, or false - to iterate through 
    unerased and erased records.   
  */
  OdDbSymbolTableIteratorPtr newIterator( 
    bool atBeginning = true, 
    bool skipDeleted = true) const;
 
    /** \details
    Adds the specified named record object to the predefined table object.
      
    \param pRecord [in] Pointer to the existing named record object to be added.  
 
    \returns 
    Returns the Object ID of the added record object.
    
    \remarks
    The record object must be created and must be named before adding. Use the static 
    pseudo-constructor createObject() for creating an instance of the specific record. 
    The predefined table object excludes duplicates of records.
  */
  virtual OdDbObjectId add(OdDbSymbolTableRecord* pRecord);
 
  /** \details
    Returns the Object ID of the Model Space record within this BlockTable object.
  */
  const OdDbObjectId& getModelSpaceId() const;
 
  /** \details
    Returns the Object ID of the Paper Space record within this BlockTable object.
  */
  const OdDbObjectId& getPaperSpaceId() const;
 
  /** \details
    Reads the .dwg file data of this object.
    
    \param pFiler [in]  Filer object from which data are read.
    
    \remarks 
    Returns the filer status. 
    This function is called by dwgIn() to allow the object to read its data. 
    When overriding this function: 
    1) Call assertWriteEnabled(). 2) Call the parent class's dwgInFields(pFiler). 
    3) If it returns eOK, continue; otherwise return whatever the parent's dwgInFields(pFiler) returned. 
    4) Call the OdDbDwgFiler(pFiler) methods to read each of the object's data items in
    the order they were written. 
    5) Return pFiler->filerStatus().
  */
  virtual OdResult dwgInFields(OdDbDwgFiler* pFiler);
 
  /** \details
    Writes the .dwg file data of this object.
    
    \param pFiler [in]  Pointer to the filer to which data are written.
    
    \remarks 
    This function is called by dwgIn() to allow the object to write its data. 
    When overriding this function: 
    1) Call assertReadEnabled(). 2) Call the parent class's dwgOutFields(pFiler). 
    3) Call the OdDbDwgFiler(pFiler) methods to write each of the object's data items 
    in the order they were written.
  */
  virtual void dwgOutFields(OdDbDwgFiler* pFiler) const;
 
  /** \details
    Reads the DXF format data of this object from the specified filer.    
    
    \param pFiler [in] Pointer to the filer from which the data are to be read.      
    
    \remarks
    Returns the filer status. 
    This function calls this object's dxfInFields(pFiler), then loads any Xdata 
    associated with this object.
  */ 
  virtual OdResult dxfIn(OdDbDxfFiler* pFiler);
 
  /** \details
    Overridables
  */
  virtual OdResult subGetClassID(void* pClsid) const;
 
  /** \details
    Notification function called each time an Undo operation is performed this object
    is using partial Undo.
 
    \param pFiler [in] A pointer to the *undo* filer with the partial *undo* information. 
    \param pClass [in] A pointer to the OdRxClass object for the class that will *handle* the Undo.      
    
    \remarks
    An object indicates it's using the partial *undo* mechanism, if and only if it has set 
    autoUndo false in all calls to assertWriteEnabled(). 
    This member function must know which types of fields to scan, and must stop after reading 
    what it needs. 
    If the class type specified by pClassObj does not matches the class of this object, 
    this member function must call the parent class's applyPartialUndo() and return whatever it returns. 
    If it does match the class of this object, this member function must use pUndoFiler to 
    read the *undo* data, then typically use this object's set() method.
  */ 
  virtual void applyPartialUndo(OdDbDwgFiler* pFiler, OdRxClass* pClass);
};
 
/** \details
    This template class is a specialization of the OdSmartPtr class for OdDbBlockTable object pointers.
*/
typedef OdSmartPtr<OdDbBlockTable> OdDbBlockTablePtr;
 
#include "TD_PackPop.h"
 
#endif