DiCE API nvidia_logo_transpbg.gif Up
mi::neuraylib::ITimer_configuration Class Referenceabstract

This class is used to start and stop timers. More...

#include <itimer_configuration.h>

Inheritance diagram for mi::neuraylib::ITimer_configuration:

Public Member Functions

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...
 
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...
 
- Public Member Functions inherited from mi::base::IInterface
virtual Uint32 retain () const =0
 Increments the reference count. More...
 
virtual Uint32 release () const =0
 Decrements the reference count. More...
 
virtual const IInterfaceget_interface (const Uuid &interface_id) const =0
 Acquires a const interface from another. More...
 
template<class T>
const T * get_interface () const
 Acquires a const interface from another. More...
 
virtual IInterfaceget_interface (const Uuid &interface_id)=0
 Acquires a mutable interface from another. More...
 
template<class T>
T * get_interface ()
 Acquires a mutable interface from another. More...
 
virtual Uuid get_iid () const =0
 Returns the interface ID of the most derived interface. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0xedad8937, ... >
typedef Interface_declare< id1, ... > Self
 Own type. More...
 
typedef Uuid_t< id1, ... > IID
 Declares the interface ID (IID) of this interface. More...
 
- Public Types inherited from mi::base::IInterface
typedef Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> IID
 Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0xedad8937, ... >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 
- Static Public Member Functions inherited from mi::base::IInterface
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface. More...
 

Detailed Description

This class is used to start and stop timers.

Member Function Documentation

 register_timer_class() [1/2]

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.

 register_timer_class() [2/2]

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_idThe class ID of the class that shall be registered for serialization.
factoryThe class factory.
Returns
true if the class of was successfully registered for serialization, and false otherwise.

 start_timer()

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 DiCE is running.

Parameters
nameThe name of the timer, used to identify the timer in the cluster.
timerThe timer which holds the callback to be called when the timer elapses.
delayTime in seconds after which mi::neuraylib::ITimer::timer_callback() will be called.
localSpecifies 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.

 stop_timer()

virtual Sint32 mi::neuraylib::ITimer_configuration::stop_timer ( const char *  name)
pure virtual

Stops a timer.

Parameters
nameThe name of the timer to be stopped.
Returns
  • 0: Success.
  • -1: Invalid parameters (e.g. unknown name).