Parent Topic: JTREGISTRY
JOLTObject *RecreateSerializedObjects( poTree, poParent );
PTNSubTree *poTree;
A parse tree containing the definition of a hierarchy of
JOLTObjects. It will be used to create the objects.
JOLTObject *poParent;
A JOLTObject to to which the created object(s) should be
attached as a child tree. This may be NULL.
The RecreateSerializedObjects() method on the JOLTRegistry is used
to create a set of objects from the contents of a parse tree.
Normally the parse tree would be read from an ASCII file using the
PTNSubTree::BuildFromFile() method. The PTNSubTree is not altered by
RecreateSerializedObjects. All object classes to be recreated from
the PTNSubTree must have been registered, with Create functions (see
the RegisterClass() method) before calling
RecreateSerializedObjects().A trappable IMP error will be generated if object deserialization fails for some reason.
FILE *fp; PTNSubTreeNode *poPTNRoot = HNew PTNSubTree( "Root" ); PCLIter oIter;
fp = DKOpen( pszFilename, FL_TXT, "r" );
poPTNRoot->BuildFromFile( fp );
DKClose( fp );
for( oIter.Start(poPTNRoot->GetChildren());
oIter.Current() != NULL;
oIter.Next() )
{
JOLTObject *poObject;
poObject = GetJOLTRegistry()->RecreateSerializedObjects( poPTNRoot,
NULL );
Debug( "<Recreated `%s'>\n", poObject->GetName() );
}
HDelete poPTNRoot;
See Also: JOLTObject::SerializeTree(), PCLParseTreeNode, Implementing Serializable Classes