mi::neuraylib::ITimer_configuration Class Reference
[Configuration Interfaces]
Description
This class is used to start and stop timers.
Public Member Functions
- virtual bool register_timer_class( base::Uuid class_id, ITimer_class_factory* factory) =0
- Registers a timer class with the timer configuration. More...
- template< class T>bool register_timer_class()
- Registers a timer class with the timer configuration. More...
- virtual Sint32 start_timer( const char* name, ITimer* timer, Float64 delay, bool local = false) =0
- Starts a cluster timer to elapse once. More...
- virtual Sint32 stop_timer( const char* name) =0
- Stops a timer. More...
Member Functions
- virtual bool mi::neuraylib::ITimer_configuration::register_timer_class( base::Uuid class_id, ITimer_class_factory* factory) [pure virtual]
-
Registers a timer class with the timer configuration. Registration is strictly necessary for non-local timers.
Parameters
- class_id
- The class ID of the class that shall be registered for serialization.
- factory
- The class factory.
Returns
true if the class of was successfully registered for serialization, and false otherwise.
-
template< class T>
bool mi::neuraylib::ITimer_configuration::register_timer_class() [inline] -
Registers a timer class with the timer configuration. Registration is strictly necessary for non-local timers.
This templated member function is a wrapper of the non-template variant for the user's convenience. It uses T::IID() as UUID and the default class factory mi::neuraylib::Timer_class_factory specialized for T.
Returns
true if the class of was successfully registered for serialization, and false otherwise.
- virtual Sint32 mi::neuraylib::ITimer_configuration::start_timer( const char* name, ITimer* timer, Float64 delay, bool local = false) [pure virtual]
-
Starts a cluster timer to elapse once. The timer is either executed locally only or scheduled to be executed on one host in the cluster chosen by the timer system. In the latter case the timer system will guarantee that the timer will be executed even if the host starting it left the cluster before the timer elapsed.
If a named timer is started which is already running then the later time of the running and newly started timer will prevail. That is if a timer is running and would elapse after two seconds and a new start_timer() call would set it to elapse after one second, then it will elapse after two seconds. If that is not the desired behavior the timer must be stopped before starting it with a new value.
If timers are not running locally then the execution of the timer will be delayed by the time necessary to transport the timer to the remote host.
If a timer is to be executed remotely then it must be registered with the register_timer_class() function before starting it.
This method can only be used while is running.
Parameters
- name
- The name of the timer, used to identify the timer in the cluster.
- timer
- The timer which holds the callback to be called when the timer elapses.
- delay
- Time in seconds after which mi::neuraylib::ITimer::timer_callback() will be called.
- local
- Specifies if this is a timer which is running in the cluster (default) or only on the local node.
Returns
- 0: Success.
- -1: Invalid parameters (NULL pointer).
- -2: The timer class is not registered.
- -3: The method cannot be called at this point of time.
- virtual Sint32 mi::neuraylib::ITimer_configuration::stop_timer( const char* name) [pure virtual]
-
Stops a timer.
Parameters
- name
- The name of the timer to be stopped.
Returns
- 0: Success.
- -1: Invalid parameters (e.g. unknown name).