neuray API Programmer's Manual

iuser_class_factory.h File Reference

Description

Abstract interface for factories for user-defined class.

Code Example

iuser_class_factory.h

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

#ifndef MI_NEURAYLIB_IUSER_CLASS_FACTORY_H
#define MI_NEURAYLIB_IUSER_CLASS_FACTORY_H

#include <mi/base/interface_declare.h>
#include <mi/base/interface_implement.h>

namespace mi {

namespace neuraylib {

class ITransaction;

class IUser_class_factory : public
    mi::base::Interface_declare<0x37355ece,0x2ed7,0x4158,0x88,0x35,0xb8,0x60,0xaf,0x75,0x6a,0x64>
{
public:
    virtual base::IInterface* create(
        ITransaction* transaction,
        Uint32 argc,
        const base::IInterface* argv[]) = 0;
};

template <class T>
class User_class_factory : public
    mi::base::Interface_implement<neuraylib::IUser_class_factory>
{
public:
    base::IInterface* create(
        ITransaction* transaction,
        Uint32 argc,
        const base::IInterface* argv[])
    {
        // avoid warnings
        (void) transaction;
        (void) argc;
        (void) argv;

        if( argc != 0)
            return 0;
        return new T;
    }
};
 // end group mi_neuray_plugins

} // namespace neuraylib

} // namespace mi

#endif // MI_NEURAYLIB_IUSER_CLASS_FACTORY_H

Namespaces

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

Classes

class 
Abstract interface for user class factories. More...
class 
This mixin class provides a default implementation of the IUser_class_factory interface. More...