18.6 Streaming 813
if it has not already done so. The virtual function that supports this is Register.The
base class registration function is
bool Object::Register (Stream& rkStream) const
{
Object* pkThis = (Object*)this; // conceptual constness
if (rkStream.InsertInMap(pkThis,0))
{
// used to ensure the objects are saved in the order
// corresponding to a depth-first traversal of the scene
rkStream.InsertInOrdered(pkThis);
for(inti=0;i<(int)m_kControllers.size(); i++)
{
if (m_kControllers[i])
{
m_kControllers[i]->Register(rkStream);
}
}
return true;
}
return false;
}
The stream maintains a hash map of registered objects. The base class Object
implements this function to ask the stream if the object has been registered. If so,
the function returns
false. If not, ...