int
main(int, char *[])
{
 
  
  
  
  
  
  
 
  
 
  auto object1 = SpatialObjectType::New();
  object1->GetProperty().SetName("First Object");
 
  auto object2 = SpatialObjectType::New();
  object2->GetProperty().SetName("Second Object");
  
 
  
  
  
  
  
  
  
 
  
  object1->AddChild(object2);
  
 
  
  
  
  
  
  
  
  
  
  
  
  
  object1->Update();
  
  
  
  
  
  
  
  
 
  
  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;
 
 
  for (auto & currentChild : *childrenList)
  {
    std::cout << "Name of the child of the object 1: ";
    std::cout << currentChild->GetProperty().GetName() << std::endl;
  }
  
 
  
  
  
  
  
  
 
  
  delete childrenList;
  
 
  
  
  
  
  
  
 
  
  object1->RemoveChild(object2);
  object2->Update();
  
 
  
  
  
  
  
  
 
  
  std::cout << "Number of children for object1: ";
  std::cout << object1->GetNumberOfChildren() << std::endl;
  
 
  
  
  
  
  
  
  
  
  
  
  
  
 
  
  object1->Clear();
  object1->RemoveAllChildren();
  
 
  
  
  
  
  
  
  
  
  
  
  
  
 
  return EXIT_SUCCESS;
}
Implementation of the composite pattern.