Object Filing

Here’s a piece of code from the FsmState::AssociateData method:

 

prop_holder ph(ar,

PropertyTranslatorParent<FsmState>("FsmState",

property_base::eSimple, GetObjectId()));

 

ar.AssociateAttributeData("EntryPoint",

AssociateDataTranslatorType<bool, 70>(entry_point_),

      PropertyTranslatorClassEnum<FsmState, bool>("Entry Point",

property_base::eSimple, &FsmState::GetEntryPoint,

&FsmState::SetEntryPoint, entry_texts));

 

The ar object is of class AssociateDataManager which handles cloning, reference detection, object filing and property management.

 

The prop_holder class that sets up a connection point for later properties.

 

The ar.AssociateAttributeData call move data to the filer. For the first part remember that we’re filing against an XML file format (there’s also an AssociateNodeData method), so we start out by tagging it with a name (“EntryPoint”). Secondly, we provide the data, tied into an AssociateDataTranslatorType object. The two template parameters are type and DXF code (for DWG/DXF translation).

 

Then there’s the PropertyTranslatorClassEnum object. The class has two template parameters: the class being filed and the data type. Then we have

 

 

Remember the prop_holder object? It provides the caller object for the read/write property methods. When porting to the new property format, I forgot that object and no properties where read or written. Here’s a selected state and its property window:

 

 

There are plenty of PropertyTranslatorXX classes. Check out the FSM Sample for usage. There’s a simple PropertyTranslator that doesn’t provide any information.