neuray Services API Programmer's Manual

ifactory.h File Reference

Description

base data types used by the neuray services API

Code Example

ifactory.h

‎//*****************************************************************************
// Copyright 1986-2011 by mental images GmbH, Fasanenstr. 81, D-10623 Berlin,
// Germany. All rights reserved.
//*****************************************************************************
//*****************************************************************************
#ifndef MI_NSERVICES_IFACTORY_H
#define MI_NSERVICES_IFACTORY_H

#include <mi/base/interface_declare.h>
namespace mi {
namespace neuraylib {
class ITransaction;
}
namespace nservices {





class IFactory : public
    mi::base::Interface_declare<0x504af436,0x573c,0x47c8,0xb3,0x33,0xc4,0x86,0xab,0x3b,0x17,0x63>
{
public:

    virtual base::IInterface *create(
        const char *class_name,
        Uint32 argc = 0,
        const base::IInterface *argv[] = 0) const = 0;

    template<class T>
    T *create(
        const char *class_name,
        Uint32 argc = 0,
        const base::IInterface *argv[] = 0) const
    {
        base::IInterface* ptr_iinterface = create( class_name,argc,argv );
        if ( !ptr_iinterface)
            return 0;
        T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
        ptr_iinterface->release();
        return ptr_T;
    };

    virtual base::IInterface *get_element(neuraylib::ITransaction *transaction,
                                            const char *name,
                                            const char *type_name) const = 0;

    template<class T>
    T *get_element(
        neuraylib::ITransaction *transaction,
        const char *name,
        const char *type_name) const
    {
        base::IInterface* ptr_iinterface = get_element( transaction,name,type_name );
        if ( !ptr_iinterface)
            return 0;
        T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
        ptr_iinterface->release();
        return ptr_T;
    };
}; // end group mi_nservices_factory
} // namespace nservices
} // namespace mi

#endif // MI_NSERVICES_IFACTORY_H

Namespaces

namespace mi
namespace mi::neuraylib
namespace 
Namespace for the neuray Services API. More...

Classes

class 
Factory class for managing neuray services objects. More...