Drawings SDK Developer Guide > Working with .dwg Files > Working with Databases > Working with Database Containers > Working with Predefined Tables of Named Records > Basics of Predefined Tables of Named Records > Collecting Database Objects using Predefined Tables of Named Records
Collecting Database Objects using Predefined Tables of Named Records

Some objects are stored as tables of records in the database. A record stores the definition and properties of a specific non-graphical object. A table stores all records for specific non-graphical objects of the same type and can manipulate them. Each record has a specific type and is declared by the specific class. Each table also has a specific type and is declared by a specific class. A table can store only objects of its own type. To access specific objects of tables, the C++ library declares specific classes for each type of object. The list of specific objects stored as tables of records and specific classes corresponding to them is the following (object – record – table):

  • Block — OdDbBlockTableRecord — OdDbBlockTable
  • Layer — OdDbLayerTableRecord — OdDbLayerTable
  • View — OdDbViewTableRecord — OdDbViewTable
  • Linetype — OdDbLinetypeTableRecord — OdDbLinetypeTable
  • Viewport — OdDbViewportTableRecord — OdDbViewportTable
  • Text style — OdDbTextStyleTableRecord — OdDbTextStyleTable
  • Dimension style — OdDbDimStyleTableRecord — OdDbDimStyleTable
  • Registered application — OdDbRegAppTableRecord — OdDbRegAppTable
  • User coordinate system — OdDbUCSTableRecord — OdDbUCSTable

This list is fixed. You cannot create a new record – table type or use an existing pair (record – table) for custom objects. To work with custom objects, the database uses the dictionary object implemented by the OdDbDictionary class.

The table object associates a unique text keyword with each record object that it stores. The unique keyword is called the record name. The name is an arbitrary non-empty string that can be up to 255 characters long and can contain letters, digits, blank spaces, underscores, and some special characters, but cannot contain inadmissible letters (see Naming objects). The name is used for identifying, searching, and manipulating the stored record objects. The database has a set of fixed collections organized as specific tables of named records. These collections exist in any database initially and cannot be deleted. The specific objects listed above are named record objects, and their specific collections are predefined table objects.

A predefined table object is the owner for named record objects which are stored in it. When a record object is added in the table, it gets a unique ID and the ID of the table object as its Owner ID. To traverse through stored records, tables use specific bidirectional iterators which also are typified for each type of object. Iterators allow processing of records independent from the internal structure of the predefined table and have the semantics and behavior of a pointer while providing additional functionality. Iterators provide a way to traverse through records of tables and access each stored record object.

Each class of specific objects declares typified smart pointers to an instance of its own class for the record object, table object, and iterator object separately. The OdDbBlockTableRecordPtr class is the typified smart pointer to an instance of the block record object; the OdDbBlockTablePtr class is the typified smart pointer to an instance of the block table object. The OdDbLayerTableRecordPtr class is the typified smart pointer to an instance of the layer record object; the OdDbLayerTablePtr class is the typified smart pointer to an instance of the layer table object. The OdDbViewTableRecordPtr class is the typified smart pointer to an instance of the view record object; the OdDbViewTablePtr class is the typified smart pointer to an instance of the view table object. The OdDbLinetypeTableRecordPtr class is the typified smart pointer to an instance of the linetype record object; the OdDbLinetypeTablePtr class is the typified smart pointer to an instance of the linetype table object. The OdDbViewportTableRecordPtr class is the typified smart pointer to an instance of the viewport record object; the OdDbViewportTablePtr class is the typified smart pointer to an instance of the viewport table object. The OdDbTextStyleTableRecordPtr class is the typified smart pointer to an instance of the text style record object; the OdDbTextStyleTablePtr class is the typified smart pointer to an instance of the text style table object. The OdDbDimStyleTableRecordPtr class is the typified smart pointer to an instance of the dimension style record object; the OdDbDimStyleTablePtr class is the typified smart pointer to an instance of the dimension style table object. The OdDbRegAppTableRecordPtr class is the typified smart pointer to an instance of the registered application record object; the OdDbRegAppTablePtr class is the typified smart pointer to an instance of the registered application table object. The OdDbUCSTableRecordPtr class is the typified smart pointer to an instance of the UCS record object; the OdDbUCSTablePtr class is the typified smart pointer to an instance of the UCS table object. These smart pointers are used for storing and passing references to the specific table objects and specific record objects.

To get a specific predefined table object, the database object has specific methods for each table:

  • Block's table — getBlockTableId()
  • Layer's table — getLayerTableId()
  • View's table — getViewTableId()
  • Linetype's table — getLinetypeTableId()
  • Viewport's table — getViewportTableId()
  • Text style's table — getTextStyleTableId()
  • Dimension style's table — getDimStyleTableId()
  • Registered application's table — getRegAppTableId()
  • UCS's table — getUCSTableId()

These predefined tables can have predefined records which exist initially in tables and cannot be deleted.

The table-record functionality includes methods for adding a record in a table, getting a record from a table using the identification information of the record, checking whether the record exists in the table, accessing the specific properties of the record object, and creating iterators for traversing through records. The predefined table object does not have methods for creating or deleting records. Each named record object creates and deletes itself.

When a record object is deleted, the table object marks it as "erased", and this record object continues to be kept in the table until the database is not saved in a file. The record object marked as «erased» can be recovered from the table.

The C++ library declares the OdDbSymbolTable class as the base interface for specific predefined table objects, the OdDbSymbolTableRecord class as the base interface for specific named record objects, and the OdDbSymbolTableIterator class as the base interface for specific iterator objects. These three classes declare the record-table interface for specific non-graphical objects organized as tables of records.

See Also

Working with Predefined Tables of Named Records

Specific Classes of Predefined Table Objects

Specific Classes of Named Record Objects

Example of Selecting a Predefined Table Object

Examples of Using the Record–Table and Dictionary Interfaces

Collecting Database Objects using Dictionaries

Copyright © 2002 – 2021. Open Design Alliance. All rights reserved.