NVIDIA Iray API Home  Up
 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, 2016 NVIDIA Corporation. All rights reserved.
3 //*****************************************************************************
6 //*****************************************************************************
7 
8 #ifndef MI_NEURAYLIB_IFACTORY_H
9 #define MI_NEURAYLIB_IFACTORY_H
10 
13 #include <mi/neuraylib/version.h>
14 
15 namespace mi {
16 
17 class ICall_decl;
18 class IData;
19 class IEnum_decl;
20 class IString;
21 class IStructure_decl;
22 
23 namespace neuraylib {
24 
29 class IFactory : public
35  mi::base::Interface_declare<0x8afad838,0xe597,0x4a81,0x92,0x34,0x51,0xfe,0xa4,0xff,0x04,0x31>
36 {
37 public:
60  virtual base::IInterface* create(
61  const char* type_name,
62  Uint32 argc = 0,
63  const base::IInterface* argv[] = 0) = 0;
64 
104  template<class T>
105  T* create(
106  const char* type_name,
107  Uint32 argc = 0,
108  const base::IInterface* argv[] = 0)
109  {
110  base::IInterface* ptr_iinterface = create( type_name, argc, argv);
111  if ( !ptr_iinterface)
112  return 0;
113  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
114  ptr_iinterface->release();
115  return ptr_T;
116  }
117 
152  template<class T>
153  T* create()
154  {
155  return create<T>( Type_traits<T>::get_type_name());
156  }
157 
163  {
167 
174 
179 
182 
185 
191 
197 
203 
207 
214 
219 
222 
225 
226  // Undocumented, for alignment only
227  FORCE_32_BIT_RESULT = 0xffffffffU
228  };
229 
235  {
242 
246 
247  // Undocumented, for alignment only
248  FORCE_32_BIT_OPTIONS = 0xffffffffU
249  };
250 
272  virtual Uint32 assign_from_to( const IData* source, IData* target, Uint32 options = 0) = 0;
273 
281  virtual IData* clone( const IData* source, Uint32 options = 0) = 0;
282 
297  template<class T>
298  T* clone( const IData* source, Uint32 options = 0)
299  {
300  mi::base::IInterface* ptr_iinterface = clone( source, options);
301  if ( !ptr_iinterface)
302  return 0;
303  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
304  ptr_iinterface->release();
305  return ptr_T;
306  }
307 
347  virtual Sint32 compare( const IData* lhs, const IData* rhs) = 0;
348 
359  virtual const IString* dump( const IData* data, const char* name = 0, Size depth = 0) = 0;
360 
366  virtual const IStructure_decl* get_structure_decl( const char* structure_name) const = 0;
367 
373  virtual const ICall_decl* get_call_decl( const char* call_name) const = 0;
374 
380  virtual const IEnum_decl* get_enum_decl( const char* enum_name) const = 0;
381 };
382 
383 mi_static_assert( sizeof( IFactory::Assign_result) == sizeof( Uint32));
385  // end group mi_neuray_types
387 
388 } // namespace neuraylib
389 
390 } // namespace mi
391 
392 #endif // MI_NEURAYLIB_IFACTORY_H