NVIDIA Iray API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ifactory.h
Go to the documentation of this file.
1 //*****************************************************************************
2 // Copyright 1986, 2014 NVIDIA Corporation. All rights reserved.
3 //*****************************************************************************
6 //*****************************************************************************
7 
8 #ifndef MI_NEURAYLIB_IFACTORY_H
9 #define MI_NEURAYLIB_IFACTORY_H
10 
13 
14 namespace mi {
15 
16 class ICall_decl;
17 class IData;
18 class IEnum_decl;
19 class IString;
20 class IStructure_decl;
21 
22 namespace neuraylib {
23 
28 class IFactory : public
34  mi::base::Interface_declare<0x8afad838,0xe597,0x4a81,0x92,0x34,0x51,0xfe,0xa4,0xff,0x04,0x31>
35 {
36 public:
59  virtual base::IInterface* create(
60  const char* type_name,
61  Uint32 argc = 0,
62  const base::IInterface* argv[] = 0) = 0;
63 
103  template<class T>
104  T* create(
105  const char* type_name,
106  Uint32 argc = 0,
107  const base::IInterface* argv[] = 0)
108  {
109  base::IInterface* ptr_iinterface = create( type_name, argc, argv);
110  if ( !ptr_iinterface)
111  return 0;
112  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
113  ptr_iinterface->release();
114  return ptr_T;
115  }
116 
151  template<class T>
152  T* create()
153  {
154  return create<T>( Type_traits<T>::get_type_name());
155  }
156 
162  {
166 
173 
178 
181 
184 
190 
196 
202 
206 
213 
218 
221 
224 
225  // Undocumented, for alignment only
226  FORCE_32_BIT_RESULT = 0xffffffffU
227  };
228 
234  {
241 
242 #ifdef MI_NEURAYLIB_DEPRECATED_5_0
243  ADJUST_LENGTH_OF_DYNAMIC_ARRAYS = 2,
244 #endif // MI_NEURAYLIB_DEPRECATED_5_0
245 
249 
250  // Undocumented, for alignment only
251  FORCE_32_BIT_OPTIONS = 0xffffffffU
252  };
253 
275  virtual Uint32 assign_from_to( const IData* source, IData* target, Uint32 options = 0) = 0;
276 
284  virtual IData* clone( const IData* source, Uint32 options = 0) = 0;
285 
300  template<class T>
301  T* clone( const IData* source, Uint32 options = 0)
302  {
303  mi::base::IInterface* ptr_iinterface = clone( source, options);
304  if ( !ptr_iinterface)
305  return 0;
306  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
307  ptr_iinterface->release();
308  return ptr_T;
309  }
310 
350  virtual Sint32 compare( const IData* lhs, const IData* rhs) = 0;
351 
362  virtual const IString* dump( const IData* data, const char* name = 0, Size depth = 0) = 0;
363 
369  virtual const IStructure_decl* get_structure_decl( const char* structure_name) const = 0;
370 
376  virtual const ICall_decl* get_call_decl( const char* call_name) const = 0;
377 
383  virtual const IEnum_decl* get_enum_decl( const char* enum_name) const = 0;
384 };
385 
386 mi_static_assert( sizeof( IFactory::Assign_result) == sizeof( Uint32));
388  // end group mi_neuray_types
390 
391 } // namespace neuraylib
392 
393 } // namespace mi
394 
395 #endif // MI_NEURAYLIB_IFACTORY_H