Implementing the DWG Filing Functions

If you are implementing dwgOutFields() and dwgInFields() for a new class, you must first call assertReadEnabled() or assertWrite-Enabled() to ensure that the object is open in the correct state.

The next thing your derived class must do is to call the same function (for example, dwgOutFields()) on the parent class. This process is referred to as super messaging. The following is an example:

AcDbDerivedClass::dwgOutFields( ... );
{ 
   assertReadEnabled()
   myParent::dwgOutFields();
   // Perform class-specific operations after super-messaging.
}

If you forget to call the corresponding message of the parent class, you'll receive a runtime error.

After super-messaging, you write or read fields. You may improve performance by checking the filer type. For example, if the filer type is kIdXlateFiler and your class doesn't define any reference connections, you can simply return.

With DWG files, you need to write and read calls in the same order. If calls are mismatched, derived classes will be confused. If you have any variable-sized data, put the count first.