Material Definition Language API nvidia_logo_transpbg.gif 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 2020 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 
14 namespace mi {
15 
16 class IEnum_decl;
17 class IString;
18 class IStructure_decl;
19 
20 namespace neuraylib {
21 
22 class ITransaction;
23 
28 class IFactory : public
34  mi::base::Interface_declare<0x8afad838,0xe597,0x4a81,0x92,0x34,0x51,0xfe,0xa4,0xff,0x04,0x31>
35 {
36 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 
211 
214 
217 
218  // Undocumented, for alignment only
219  FORCE_32_BIT_RESULT = 0xffffffffU
220  };
221 
227  {
234 
238 
239  // Undocumented, for alignment only
240  FORCE_32_BIT_OPTIONS = 0xffffffffU
241  };
242 
264  virtual Uint32 assign_from_to( const IData* source, IData* target, Uint32 options = 0) = 0;
265 
273  virtual IData* clone( const IData* source, Uint32 options = 0) = 0;
274 
289  template<class T>
290  T* clone( const IData* source, Uint32 options = 0)
291  {
292  mi::base::IInterface* ptr_iinterface = clone( source, options);
293  if ( !ptr_iinterface)
294  return 0;
295  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
296  ptr_iinterface->release();
297  return ptr_T;
298  }
299 
332  virtual Sint32 compare( const IData* lhs, const IData* rhs) = 0;
333 
345  virtual const IString* dump( const IData* data, const char* name = 0, Size depth = 0) = 0;
346 
352  virtual const IString* dump(
353  neuraylib::ITransaction* transaction,
354  const IData* data,
355  const char* name = 0,
356  Size depth = 0) = 0;
357 
363  virtual const IStructure_decl* get_structure_decl( const char* structure_name) const = 0;
364 
370  virtual const IEnum_decl* get_enum_decl( const char* enum_name) const = 0;
371 };
372 
373 mi_static_assert( sizeof( IFactory::Assign_result) == sizeof( Uint32));
375  // end group mi_neuray_types
377 
378 } // namespace neuraylib
379 
380 } // namespace mi
381 
382 #endif // MI_NEURAYLIB_IFACTORY_H