ancestor.cc
Go to the documentation of this file.
1 #include "stage.hh"
2 using namespace Stg;
3 
4 
6  child_type_counts(),
7  children(),
8  debug( false ),
9  props(),
10  token()
11 {
12  /* nothing to do */
13 }
14 
16 {
17  FOR_EACH( it, children )
18  delete (*it);
19 }
20 
22 {
23  // if the child is already there, this is a serious error
24  if( std::find( children.begin(), children.end(), mod ) != children.end() )
25  {
26  PRINT_ERR2( "Attempting to add child %s to %s - child already exists",
27  mod->Token(), this->Token() );
28  exit( -1 );
29  }
30 
31  children.push_back( mod );
32  child_type_counts[mod->type]++;
33 }
34 
36 {
37  child_type_counts[mod->type]--;
38  EraseAll( mod, children );
39 }
40 
42 {
43  return Pose();
44 }
45 
47 {
48  FOR_EACH( it, children )
49  {
50  Model* mod = (*it);
51  func( mod, arg );
52  mod->ForEachDescendant( func, arg );
53  }
54 }
55 
56 Ancestor& Ancestor::Load( Worldfile* wf, int section )
57 {
58  return *this;
59 }
60 
61 void Ancestor::Save( Worldfile* wf, int section )
62 {
63 }
Model class
Definition: stage.hh:1742
The Stage library uses its own namespace.
Definition: canvas.hh:8
void Save(Worldfile *wf, int section)
Definition: ancestor.cc:61
virtual void AddChild(Model *mod)
Definition: ancestor.cc:21
const std::string type
Definition: stage.hh:1999
int(* model_callback_t)(Model *mod, void *user)
Definition: stage.hh:568
void EraseAll(T thing, C &cont)
Definition: stage.hh:621
Ancestor & Load(Worldfile *wf, int section)
Definition: ancestor.cc:56
virtual void RemoveChild(Model *mod)
Definition: ancestor.cc:35
std::map< std::string, unsigned int > child_type_counts
Definition: stage.hh:687
void ForEachDescendant(model_callback_t func, void *arg)
Definition: ancestor.cc:46
std::vector< Model * > children
Definition: stage.hh:689
virtual Pose GetGlobalPose() const
Definition: ancestor.cc:41
#define PRINT_ERR2(m, a, b)
Definition: stage.hh:627
#define FOR_EACH(I, C)
Definition: stage.hh:616
virtual ~Ancestor()
Definition: ancestor.cc:15
const char * Token() const
Definition: stage.hh:715


stage
Author(s): Richard Vaughan , Brian Gerkey , Reed Hedges , Andrew Howard , Toby Collett , Pooya Karimian , Jeremy Asher , Alex Couture-Beil , Geoff Biggs , Rich Mattes , Abbas Sadat
autogenerated on Mon Jun 10 2019 15:06:09