NVIDIA Iray API Home  Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
itransaction.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_ITRANSACTION_H
9 #define MI_NEURAYLIB_ITRANSACTION_H
10 
13 
14 namespace mi {
15 
16 class IArray;
17 
18 namespace neuraylib {
19 
20 class IScope;
21 
26 class ITransaction : public
73  mi::base::Interface_declare<0x6ca1f0c2,0xb262,0x4f09,0xa6,0xa5,0x05,0xae,0x14,0x45,0xed,0xfa>
74 {
75 public:
85  virtual Sint32 commit() = 0;
86 
91  virtual void abort() = 0;
92 
97  virtual bool is_open() const = 0;
98 
132  virtual base::IInterface* create(
133  const char* type_name,
134  Uint32 argc = 0,
135  const base::IInterface* argv[] = 0) = 0;
136 
189  template<class T>
190  T* create(
191  const char* type_name,
192  Uint32 argc = 0,
193  const base::IInterface* argv[] = 0)
194  {
195  base::IInterface* ptr_iinterface = create( type_name, argc, argv);
196  if( !ptr_iinterface)
197  return 0;
198  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
199  ptr_iinterface->release();
200  return ptr_T;
201  }
202 
233  template<class T>
234  T* create()
235  {
236  return create<T>( Type_traits<T>::get_type_name());
237  }
238 
244  static const mi::Uint8 LOCAL_SCOPE = 255;
245 
291 #ifdef MI_NEURAYLIB_DEPRECATED_ITRANSACTION_STORE_DEFAULT_PRIVACY_LEVEL_ZERO
292  virtual Sint32 store(
293  base::IInterface* db_element, const char* name, Uint8 privacy = 0) = 0;
294 #else
295  virtual Sint32 store(
296  base::IInterface* db_element, const char* name, Uint8 privacy = LOCAL_SCOPE) = 0;
297 #endif
298 
307  virtual const base::IInterface* access( const char* name) = 0;
308 
325  template<class T>
326  const T* access( const char* name)
327  {
328  const base::IInterface* ptr_iinterface = access( name);
329  if( !ptr_iinterface)
330  return 0;
331  const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
332  ptr_iinterface->release();
333  return ptr_T;
334  }
335 
347  virtual base::IInterface* edit( const char* name) = 0;
348 
368  template<class T>
369  T* edit( const char* name)
370  {
371  base::IInterface* ptr_iinterface = edit( name);
372  if( !ptr_iinterface)
373  return 0;
374  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
375  ptr_iinterface->release();
376  return ptr_T;
377  }
378 
404  virtual Sint32 copy( const char* source, const char* target, Uint8 privacy = 0) = 0;
405 
432  virtual Sint32 remove( const char* name, bool only_localized = false) = 0;
433 
440  virtual const char* name_of( const base::IInterface* db_element) const = 0;
441 
456  virtual const char* get_time_stamp() const = 0;
457 
472  virtual const char* get_time_stamp( const char* element) const = 0;
473 
494  virtual bool has_changed_since_time_stamp(
495  const char* element, const char* time_stamp) const = 0;
496 
503  virtual const char* get_id() const = 0;
504 
506  virtual IScope* get_scope() const = 0;
507 
532  virtual IArray* list_elements(
533  const char* root_element,
534  const char* name_pattern = 0,
535  const IArray* type_names = 0) const = 0;
536 
546  virtual Sint32 get_privacy_level( const char* name) const = 0;
547 };
548  // end group mi_neuray_database_access
550 
551 } // namespace neuraylib
552 
553 } // namespace mi
554 
555 #endif // MI_NEURAYLIB_ITRANSACTION_H