Close

Relief for ODA Team in Ukraine

Learn more
ODA Drawings SDK
Organization of Registered Applications

The database stores all registered applications in the registered application table. A registered application is a record of the registered application table. The registered application table is a predefined object that exists in the database initially and cannot be deleted. The OdDbRegAppTable class is the registered application table object that represents the interface for accessing the registered application table and manipulates the registered applications in it. The OdDbRegAppTableRecord class is the registered application record object that represents the interface for accessing a registered application and manipulating its properties. The registered application table object has the AcDbRegAppTable class name; the registered application record object has the AcDbRegAppTableRecord class name.

The OdDbRegAppTablePtr class is the typified smart pointer to an instance of the registered application table and is used for storing and passing references to the registered application table object. The OdDbRegAppTableRecordPtr class is the typified smart pointer to an instance of the registered application and is used for storing and passing references to the registered application record object. In the following examples, the pDb variable stores the pointer to the database object.

To get the the registered application table, use the getRegAppTableId() method of the database object; it does not have arguments and returns the OdDbObjectId instance associated with the registered application table object. For example:


OdDbObjectId idRegApps = pDb->getRegAppTableId();

To manipulate the registered applications, the program must open the registered application table object and get a smart pointer to it. If the registered application table object is opened in read mode, the program can obtain registered applications and their properties, but it cannot modify them, add a new registered application, or delete an existing registered application from the table. If the registered application table object is opened in write mode, the program can add a new registered application in the table, rename any registered application, modify properties of an existing registered application, or delete the registered application from the table.

To get the smart pointer to the registered application table object, declare a variable of the OdDbRegAppTablePtr type and use the safeOpenObject() method of the obtained OdDbObjectId object. The registered application table is the predefined object and the erase status is not applicable. Therefore, the safeOpenObject() method requires only the open mode as a value of the OdDb::OpenMode enumerator (kForRead, kForWrite, or kForNotify) and returns a smart pointer to the registered application table object. For example:


// Open the registered application table object in the read mode
OdDbRegAppTablePtr pRegApps = idRegApps.safeOpenObject(OdDb::kForRead);

// Open the registered application table object in the write mode
OdDbRegAppTablePtr pRegApps = idRegApps.safeOpenObject(OdDb::kForWrite);

These operations can be combined into one line:


OdDbRegAppTablePtr pRegApps = pDb->getRegAppTableId().safeOpenObject(OdDb::kForWrite);

The registered application table object contains the predefined application, named "ACAD", that defines the Autodesk® AutoCAD® application. To get the predefined application, use the getRegAppAcadId() method of the database object. For example:


OdDbRegAppTableRecordPtr pAcad = pDb->getRegAppAcadId().safeOpenObject();
odPrintConsoleString(L"\nThe predefined application is \"%s\"", pAcad->getName().c_str());

The registered application table object has the following specific methods: add() method for adding a new application to the table, getAt() method for getting an existing application from the table, has() method for checking whether the application exists in the table, and newIterator() method for iterating through applications of the table.

See Also

Working with Registered Applications

Manipulating Registered Applications

Working with Predefined Tables of Named Records

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