int main( int , char *[] )
{
SpatialObjectType::Pointer object1 = SpatialObjectType ::New();
object1->GetProperty().SetName("First Object");
SpatialObjectType::Pointer object2 = SpatialObjectType ::New();
object2->GetProperty().SetName("Second Object");
object1->AddChild(object2);
if(object2->HasParent())
{
std::cout << "Name of the parent of the object2: ";
std::cout << object2->GetParent()->GetProperty().GetName() << std::endl;
}
SpatialObjectType::ChildrenListType * childrenList = object1->GetChildren();
std::cout << "object1 has " << childrenList->size() << " child" << std::endl;
SpatialObjectType::ChildrenListType::const_iterator it
= childrenList->begin();
while(it != childrenList->end())
{
std::cout << "Name of the child of the object 1: ";
std::cout << (*it)->GetProperty().GetName() << std::endl;
++it;
}
delete childrenList;
object1->RemoveChild(object2);
std::cout << "Number of children for object1: ";
std::cout << object1->GetNumberOfChildren() << std::endl;
object1->RemoveAllChildren();
return EXIT_SUCCESS;
}