neuray API Programmer's Manual

itimer_configuration.h File Reference

Description

API component that allows to start timers to elapse at configured timer times triggering callbacks.

Code Example

itimer_configuration.h

‎/***************************************************************************************************
 * Copyright 2024 NVIDIA Corporation. All rights reserved.
 **************************************************************************************************/

#ifndef MI_NEURAYLIB_ITIMER_CONFIGURATION_H
#define MI_NEURAYLIB_ITIMER_CONFIGURATION_H

#include <mi/base/interface_declare.h>
#include <mi/base/interface_implement.h>
#include <mi/base/handle.h>
#include <mi/neuraylib/iserializer.h>

namespace mi {

namespace neuraylib {

class ISerializable;












class ITimer : public
    mi::base::Interface_declare<0x654218a4,0xc9af,0x4c4c,0xba,0x9a,0x3a,0x16,0x8a,0xdd,0x8a,0x0f,
    neuraylib::ISerializable>
{
public:
    virtual void timer_callback() = 0;
};

class ITimer_class_factory : public
    mi::base::Interface_declare<0xed2c17d1,0xdaf0,0x4aa2,0x95,0xaf,0xfc,0x1b,0x6f,0x6a,0xf6,0x2b>
{
public:
    virtual ITimer* create() = 0;
};

template <class T>
class Timer_class_factory : public
    mi::base::Interface_implement<neuraylib::ITimer_class_factory>
{
public:
    ITimer* create() { return new T; }
};

class ITimer_configuration : public
    mi::base::Interface_declare<0xedad8937,0x015e,0x4ee7,0x9e,0x49,0x6a,0x22,0x83,0xbd,0xc4,0x41>
{
public:
    virtual Sint32 
               start_timer(
        const char* name, ITimer* timer, Float64 delay, bool local = false) = 0;

    virtual Sint32 
               stop_timer( const char* name) = 0;

    //
    virtual bool register_timer_class( base::Uuid class_id, ITimer_class_factory* factory) = 0;

    //
    template <class T>
    bool register_timer_class()
    {
        mi::base::Handle< ITimer_class_factory> factory( new Timer_class_factory< T>());
        return register_timer_class( typename T::IID(), factory.get());
    }
};
 // end group mi_neuray_configuration

} // namespace neuraylib

} // namespace mi

#endif // MI_NEURAYLIB_ITIMER_CONFIGURATION_H

Namespaces

namespace 
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH. More...
namespace 
Namespace for the neuray API. More...

Classes

class 
This is an abstract interface class for a timer. More...
class 
The registration of a timer class requires a factory which constructs an instance during deserialization. More...
class 
This class is used to start and stop timers. More...
class 
This mixin class provides a default implementation of the mi::neuraylib::ITimer_class_factory interface. More...