6 cm( inst, this,
"DVar" ),
8 dvs( inst->getSystemContainer()->getSystem<
DVarSystem >() ),
13 template<
class Type >
16 if( this->dvs && this->_on_changed )
17 this->dvs->remove_listener(
this, this->
id );
20 template<
class Type >
26 template<
class Type >
29 if( this->dvs && this->
id.valid() && this->_on_changed )
30 this->dvs->remove_listener(
this, this->
id );
34 if( this->dvs && this->
id.valid() && this->_on_changed )
35 this->dvs->add_listener(
this, this->
id );
37 if( this->_on_changed )
39 this->cached = this->get_uncached();
40 this->_on_changed( this->get() );
44 template<
class Type >
50 template<
class Type >
53 if( !this->
id.valid() )
57 return this->dvs->get( this->
id );
59 return this->
id.initial();
62 template<
class Type >
65 if( !this->
id.valid() )
68 if( this->_on_changed )
71 return this->get_uncached();
74 template<
class Type >
77 if( this->dvs && this->
id.valid() )
79 if( this->_on_changed && !fun )
80 this->dvs->remove_listener(
this, this->
id );
82 if( fun && !this->_on_changed )
83 this->dvs->add_listener(
this, this->
id );
87 this->cached = this->get_uncached();
89 this->cached = Type();
91 this->_on_changed = fun;
93 if( call_immediately && this->
id.valid() && this->_on_changed )
94 this->_on_changed( this->get() );
97 template<
class Type >
100 if( this->_on_changed )
102 if( type !=
typeid( Type ) )
104 this->cm.warning(
SRC_INFO,
"Unexpected DVar type." );
108 this->cached = *
reinterpret_cast< Type *
>( value );
109 this->_on_changed( this->get() );