FrameUpdateClient.cpp
Go to the documentation of this file.
1 #include "FrameUpdateClient.hpp"
2 #include "TimeSystem.hpp"
3 #include "../Defs.hpp"
4 
5 namespace iv
6 {
7 
9  cm( inst, this, "FrameUpdateClient" ),
10  inst( inst ),
11  ts( inst->getSystemContainer()->getSystem< TimeSystem >() ),
12  active( 1 )
13 {
14  if( this->ts )
15  {
16  this->cm.log( SRC_INFO, Defs::Log::TimeUpdates, "Start frame update." );
17  this->ts->register_frame_update_client( this );
18  }
19 }
20 
22 {
23  if( this->ts )
24  {
25  this->cm.log( SRC_INFO, Defs::Log::TimeUpdates, "Stop frame update." );
26  this->ts->unregister_frame_update_client( this );
27  }
28 }
29 
31 {
32  return this->inst;
33 }
34 
36 {
37  if( !this->ts )
38  return;
39 
40  if( this->active > 0 )
41  {
42  this->cm.log( SRC_INFO, Defs::Log::TimeUpdates, "Stop frame update." );
43  this->ts->unregister_frame_update_client( this );
44  }
45 
46  this->active = 0;
47 }
48 
50 {
51  if( !this->ts )
52  return;
53 
54  if( this->active <= 0 )
55  {
56  this->cm.log( SRC_INFO, Defs::Log::TimeUpdates, "Start frame update." );
57  this->ts->register_frame_update_client( this );
58  }
59 
60  this->active = 1;
61 }
62 
64 {
65  return this->active > 0;
66 }
67 
68 
70 {
71  if( !this->ts )
72  return;
73 
74  if( this->active == 0 )
75  {
76  this->cm.log( SRC_INFO, Defs::Log::TimeUpdates, "Start frame update." );
77  this->ts->register_frame_update_client( this );
78  }
79 
80  this->active++;
81 }
82 
84 {
85  if( !this->ts )
86  return;
87 
88  if( this->active == 1 )
89  {
90  this->cm.log( SRC_INFO, Defs::Log::TimeUpdates, "Stop frame update." );
91  this->ts->unregister_frame_update_client( this );
92  }
93 
94  this->active--;
95 }
96 
97 }