Go to the documentation of this file.00001 #include "stage.hh"
00002 using namespace Stg;
00003
00004
00005 Ancestor::Ancestor() :
00006 child_type_counts(),
00007 children(),
00008 debug( false ),
00009 props(),
00010 token()
00011 {
00012
00013 }
00014
00015 Ancestor::~Ancestor()
00016 {
00017 FOR_EACH( it, children )
00018 delete (*it);
00019 }
00020
00021 void Ancestor::AddChild( Model* mod )
00022 {
00023
00024 if( std::find( children.begin(), children.end(), mod ) != children.end() )
00025 {
00026 PRINT_ERR2( "Attempting to add child %s to %s - child already exists",
00027 mod->Token(), this->Token() );
00028 exit( -1 );
00029 }
00030
00031 children.push_back( mod );
00032 child_type_counts[mod->type]++;
00033 }
00034
00035 void Ancestor::RemoveChild( Model* mod )
00036 {
00037 child_type_counts[mod->type]--;
00038 EraseAll( mod, children );
00039 }
00040
00041 Pose Ancestor::GetGlobalPose() const
00042 {
00043 return Pose();
00044 }
00045
00046 void Ancestor::ForEachDescendant( model_callback_t func, void* arg )
00047 {
00048 FOR_EACH( it, children )
00049 {
00050 Model* mod = (*it);
00051 func( mod, arg );
00052 mod->ForEachDescendant( func, arg );
00053 }
00054 }
00055
00056 Ancestor& Ancestor::Load( Worldfile* wf, int section )
00057 {
00058 return *this;
00059 }
00060
00061 void Ancestor::Save( Worldfile* wf, int section )
00062 {
00063 }