ElementSystem.cpp
Go to the documentation of this file.
1 #include "ElementSystem.hpp"
2 #include "../Defs.hpp"
3 
4 namespace iv
5 {
6 
8  System( sc )
9 {
10 }
11 
13 {
15  {
16  unsigned frame_id = this->system_container()->frame_id();
17  if( this->last_check_frame_id != frame_id )
18  {
19  this->last_check_frame_id = frame_id;
20 
21  std::unordered_set< Elem * > roots = this->elems;
22 
23  for( Elem * elem : this->elems )
24  {
25  elem->elem_eachChild(
26  [&]( Elem * child )
27  {
28  roots.erase( child );
29  }
30  );
31  }
32 
33  for( Elem * root : roots )
34  {
35  if( !root->quiet() && root->first_pass_frame_id() != frame_id )
36  {
37  this->log( SRC_INFO, iv::Defs::Log::ConsistencyChecks_Frame, "Element ", root->cm, " is disconnected." );
38  }
39  }
40  }
41  }
42 
43  return false;
44 }
45 
47 {
48  this->elems.insert( elem );
49 }
50 
52 {
53  this->elems.erase( elem );
54 }
55 
56 void ElementSystem::print_elem_children( TreeDebugView * tree, Elem * elem, std::unordered_set< Elem * > & printed )
57 {
58  elem->elem_eachChild(
59  [&]( Elem * child )
60  {
61  if( !printed.count( child ) )
62  {
63  printed.insert( child );
64 
65  tree->Push( child->cm.instance()->instance_name().c_str() );
66  child->cm.inheritance_root()->print_status_with_inherited( (TextDebugView*)tree, &child->cm );
67  this->print_elem_children( tree, child, printed );
68  tree->Pop();
69  }
70  }
71  );
72 }
73 
75 {
76  std::unordered_set< Elem * > printed;
77 
78  TreeDebugView tree( view->context() );
79 
80  for( Camera * camera : this->cameras )
81  {
82  tree.Push( camera->cm.instance()->instance_name().c_str() );
83  camera->cm.print_status_with_inherited( (TextDebugView*)&tree, &camera->cm );
84  this->print_elem_children( &tree, camera, printed );
85  tree.Pop();
86  }
87 
89 }
90 
92 {
93  this->cameras.insert( camera );
94 }
95 
97 {
98  this->cameras.erase( camera );
99 }
100 
101 }