MDL SDK API nvidia_logo_transpbg.gif Up
ifactory.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2025 NVIDIA Corporation. All rights reserved.
3 **************************************************************************************************/
6
7#ifndef MI_NEURAYLIB_IFACTORY_H
8#define MI_NEURAYLIB_IFACTORY_H
9
11#include <mi/neuraylib/idata.h>
13#include <mi/neuraylib/version.h> // for MI_NEURAYLIB_DEPRECATED_ENUM_VALUE
14
15namespace mi {
16
17class IEnum_decl;
18class IString;
19class IStructure_decl;
20
21namespace neuraylib {
22
23class ITransaction;
24
34class IFactory : public
35 mi::base::Interface_declare<0x8afad838,0xe597,0x4a81,0x92,0x34,0x51,0xfe,0xa4,0xff,0x04,0x31>
36{
37public:
62 const char* type_name,
63 Uint32 argc = 0,
64 const base::IInterface* argv[] = nullptr) = 0;
65
105 template<class T>
107 const char* type_name,
108 Uint32 argc = 0,
109 const base::IInterface* argv[] = nullptr)
110 {
111 base::IInterface* ptr_iinterface = create( type_name, argc, argv);
112 if ( !ptr_iinterface)
113 return 0;
114 T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
115 ptr_iinterface->release();
116 return ptr_T;
117 }
118
153 template<class T>
155 {
156 return create<T>( Type_traits<T>::get_type_name());
157 }
158
164 {
168
175
180
183
186
192
198
204
208
212
215
218 MI_NEURAYLIB_DEPRECATED_ENUM_VALUE(FORCE_32_BIT_RESULT, 0xffffffffU)
219 };
220
226 {
233
237 MI_NEURAYLIB_DEPRECATED_ENUM_VALUE(FORCE_32_BIT_OPTIONS, 0xffffffffU)
238 };
239
261 virtual Uint32 assign_from_to( const IData* source, IData* target, Uint32 options = 0) = 0;
262
270 virtual IData* clone( const IData* source, Uint32 options = 0) = 0;
271
286 template<class T>
287 T* clone( const IData* source, Uint32 options = 0)
288 {
289 mi::base::IInterface* ptr_iinterface = clone( source, options);
290 if ( !ptr_iinterface)
291 return 0;
292 T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
293 ptr_iinterface->release();
294 return ptr_T;
295 }
296
330 virtual Sint32 compare( const IData* lhs, const IData* rhs) = 0;
331
343 virtual const IString* dump( const IData* data, const char* name = nullptr, Size depth = 0) = 0;
344
350 virtual const IString* dump(
351 neuraylib::ITransaction* transaction,
352 const IData* data,
353 const char* name = nullptr,
354 Size depth = 0) = 0;
355
361 virtual const IStructure_decl* get_structure_decl( const char* structure_name) const = 0;
362
368 virtual const IEnum_decl* get_enum_decl( const char* enum_name) const = 0;
369};
370 // end group mi_neuray_types
372
373} // namespace neuraylib
374
375} // namespace mi
376
377#endif // MI_NEURAYLIB_IFACTORY_H
This interface is the base interface of all types.
Definition: idata.h:297
An enum declaration is used to describe enum types.
Definition: ienum_decl.h:36
A simple string class.
Definition: istring.h:22
A structure declaration is used to describe structure types.
Definition: istructure_decl.h:34
The basic extensible interface.
Definition: iinterface.h:103
Mixin class template for deriving new interface declarations.
Definition: interface_declare.h:43
This API component allows the creation, assignment, and cloning of instances of types.
Definition: ifactory.h:36
T * clone(const IData *source, Uint32 options=0)
Creates a clone of a type.
Definition: ifactory.h:287
virtual const IEnum_decl * get_enum_decl(const char *enum_name) const =0
Returns a registered enum declaration.
virtual IData * clone(const IData *source, Uint32 options=0)=0
Creates a clone of a type.
virtual Sint32 compare(const IData *lhs, const IData *rhs)=0
Compares two instances of mi::IData.
virtual const IString * dump(neuraylib::ITransaction *transaction, const IData *data, const char *name=nullptr, Size depth=0)=0
Returns a textual representation of a type.
T * create()
Creates an object of the type T.
Definition: ifactory.h:154
T * create(const char *type_name, Uint32 argc=0, const base::IInterface *argv[]=nullptr)
Creates an object of the type type_name.
Definition: ifactory.h:106
virtual Uint32 assign_from_to(const IData *source, IData *target, Uint32 options=0)=0
Assigns the value(s) of source to target.
virtual base::IInterface * create(const char *type_name, Uint32 argc=0, const base::IInterface *argv[]=nullptr)=0
Creates an object of the type type_name.
virtual const IStructure_decl * get_structure_decl(const char *structure_name) const =0
Returns a registered structure declaration.
Assign_result
This enum represents possible events that can happen during assignment of types.
Definition: ifactory.h:164
@ DIFFERENT_COLLECTIONS
Both arguments source and target (or the types of at least one key thereof) are collections,...
Definition: ifactory.h:191
@ NULL_POINTER
One of the arguments source or target is nullptr.
Definition: ifactory.h:167
@ INCOMPATIBLE_ENUM_TYPES
The assignment failed due to incompatible enum types.
Definition: ifactory.h:214
@ STRUCTURAL_MISMATCH
There is a structural mismatch between source and target.
Definition: ifactory.h:174
@ DEEP_ASSIGNMENT_TO_CONST_POINTER
Deep assignment was requested and target is an instance of mi::IConst_pointer (or a key of target is ...
Definition: ifactory.h:207
@ NO_CONVERSION
Both arguments (or at least one key thereof) are of different interfaces derived from mi::IData_simpl...
Definition: ifactory.h:179
@ INCOMPATIBLE_POINTER_TYPES
Shallow assignment (the default) was requested and the assignment failed due to incompatible pointer ...
Definition: ifactory.h:203
@ SOURCE_KEY_MISSING
There is at least one key in target which does not exist in source.
Definition: ifactory.h:185
@ TARGET_KEY_MISSING
There is at least one key in source which does not exist in target.
Definition: ifactory.h:182
@ INCOMPATIBLE_PRIVACY_LEVELS
The assignment failed due to incompatible privacy levels, i.e., mi::IRef::set_reference() returned er...
Definition: ifactory.h:211
@ NON_IDATA_VALUES
The argument source is a collection and contains at least one key which is not of type mi::IData,...
Definition: ifactory.h:197
@ INCOMPATIBLE_OPTIONS
The assignment failed due to incompatible options.
Definition: ifactory.h:217
Assign_clone_options
This enum represents various options for the assignment or cloning of types.
Definition: ifactory.h:226
@ DEEP_ASSIGNMENT_OR_CLONE
By default, assignment or cloning of instances of mi::IPointer and mi::IConst_pointer is shallow,...
Definition: ifactory.h:232
@ FIX_SET_OF_TARGET_KEYS
By default, assignment might change the set of keys if the for target is a dynamic array or map.
Definition: ifactory.h:236
virtual const IString * dump(const IData *data, const char *name=nullptr, Size depth=0)=0
Returns a textual representation of a type.
A transaction provides a consistent view on the database.
Definition: itransaction.h:82
virtual const IInterface * get_interface(const Uuid &interface_id) const =0
Acquires a const interface from another.
virtual Uint32 release() const =0
Decrements the reference count.
int Sint32
32-bit signed integer.
Definition: types.h:46
Uint64 Size
Unsigned integral type that is large enough to hold the size of all types.
Definition: types.h:112
unsigned int Uint32
32-bit unsigned integer.
Definition: types.h:49
Types.
Mixin class template for deriving new interface declarations.
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
Definition: example_derivatives.dox:5
Major and minor version number and an optional qualifier.
Type traits relating interfaces, corresponding primitive types, and their type names.
Definition: type_traits.h:162
Type traits.