ifactory.h File Reference
Description
API component for creation, assignment, and cloning of instances of types.
Code Example
ifactory.h
/***************************************************************************************************
* Copyright 2024 NVIDIA Corporation. All rights reserved.
**************************************************************************************************/
#ifndef MI_NEURAYLIB_IFACTORY_H
#define MI_NEURAYLIB_IFACTORY_H
#include <mi/base/interface_declare.h>
#include <mi/neuraylib/idata.h>
#include <mi/neuraylib/type_traits.h>
namespace mi {
class IEnum_decl;
class IString;
class IStructure_decl;
namespace neuraylib {
class ITransaction;
class IFactory : public
mi::base::Interface_declare<0x8afad838,0xe597,0x4a81,0x92,0x34,0x51,0xfe,0xa4,0xff,0x04,0x31>
{
public:
virtual base::IInterface* create(
const char* type_name,
Uint32 argc = 0,
const base::IInterface* argv[] = 0) = 0;
template<class T>
T* create(
const char* type_name,
Uint32 argc = 0,
const base::IInterface* argv[] = 0)
{
base::IInterface* ptr_iinterface = create( type_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;
}
template<class T>
T* create()
{
return create<T>( Type_traits< T>::get_type_name());
}
enum Assign_result
{
NULL_POINTER = 1,
STRUCTURAL_MISMATCH = 2,
NO_CONVERSION = 4,
TARGET_KEY_MISSING = 8,
SOURCE_KEY_MISSING = 16,
DIFFERENT_COLLECTIONS = 32,
NON_IDATA_VALUES = 64,
INCOMPATIBLE_POINTER_TYPES = 128,
DEEP_ASSIGNMENT_TO_CONST_POINTER = 256,
INCOMPATIBLE_PRIVACY_LEVELS = 1024,
INCOMPATIBLE_ENUM_TYPES = 2048,
INCOMPATIBLE_OPTIONS = 4096,
// Undocumented, for alignment only
FORCE_32_BIT_RESULT = 0xffffffffU
};
enum Assign_clone_options
{
DEEP_ASSIGNMENT_OR_CLONE = 1,
FIX_SET_OF_TARGET_KEYS = 4,
// Undocumented, for alignment only
FORCE_32_BIT_OPTIONS = 0xffffffffU
};
virtual Uint32
assign_from_to( const IData* source, IData* target, Uint32 options = 0) = 0;
virtual IData* clone( const IData* source, Uint32 options = 0) = 0;
template<class T>
T* clone( const IData* source, Uint32 options = 0)
{
mi::base::IInterface* ptr_iinterface = clone( source, options);
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 Sint32
compare( const IData* lhs, const IData* rhs) = 0;
virtual const IString* dump( const IData* data, const char* name = 0, Size depth = 0) = 0;
virtual const IString* dump(
neuraylib::ITransaction* transaction,
const IData* data,
const char* name = 0,
Size depth = 0) = 0;
virtual const IStructure_decl* get_structure_decl( const char* structure_name) const = 0;
virtual const IEnum_decl* get_enum_decl( const char* enum_name) const = 0;
};
mi_static_assert( sizeof( IFactory::Assign_result) == sizeof( Uint32));
mi_static_assert( sizeof( IFactory::Assign_clone_options) == sizeof( Uint32));
// end group mi_neuray_types
} // namespace neuraylib
} // namespace mi
#endif // MI_NEURAYLIB_IFACTORY_H
Namespaces
- namespace
- Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH. More...
- namespace
- Namespace for the neuray API. More...
Classes
- class
- This API component allows the creation, assignment, and cloning of instances of types. More...