NVIDIA Iray API
 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, 2014 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
83  mi::base::Interface_declare<0x6ca1f0c2,0xb262,0x4f09,0xa6,0xa5,0x05,0xae,0x14,0x45,0xed,0xfa>
84 {
85 public:
95  virtual Sint32 commit() = 0;
96 
101  virtual void abort() = 0;
102 
107  virtual bool is_open() const = 0;
108 
147  virtual base::IInterface* create(
148  const char* type_name,
149  Uint32 argc = 0,
150  const base::IInterface* argv[] = 0) = 0;
151 
209  template<class T>
210  T* create(
211  const char* type_name,
212  Uint32 argc = 0,
213  const base::IInterface* argv[] = 0)
214  {
215  base::IInterface* ptr_iinterface = create( type_name, argc, argv);
216  if( !ptr_iinterface)
217  return 0;
218  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
219  ptr_iinterface->release();
220  return ptr_T;
221  }
222 
253  template<class T>
254  T* create()
255  {
256  return create<T>( Type_traits<T>::get_type_name());
257  }
258 
264  static const mi::Uint8 LOCAL_SCOPE = 255;
265 
303 #ifdef MI_NEURAYLIB_DEPRECATED_ITRANSACTION_STORE_DEFAULT_PRIVACY_LEVEL_ZERO
304  virtual Sint32 store(
305  base::IInterface* db_element, const char* name, Uint8 privacy = 0) = 0;
306 #else
307  virtual Sint32 store(
308  base::IInterface* db_element, const char* name, Uint8 privacy = LOCAL_SCOPE) = 0;
309 #endif
310 
319  virtual const base::IInterface* access( const char* name) = 0;
320 
337  template<class T>
338  const T* access( const char* name)
339  {
340  const base::IInterface* ptr_iinterface = access( name);
341  if( !ptr_iinterface)
342  return 0;
343  const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
344  ptr_iinterface->release();
345  return ptr_T;
346  }
347 
362  virtual base::IInterface* edit( const char* name) = 0;
363 
386  template<class T>
387  T* edit( const char* name)
388  {
389  base::IInterface* ptr_iinterface = edit( name);
390  if( !ptr_iinterface)
391  return 0;
392  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
393  ptr_iinterface->release();
394  return ptr_T;
395  }
396 
422  virtual Sint32 copy( const char* source, const char* target, Uint8 privacy = 0) = 0;
423 
449  virtual Sint32 remove( const char* name, bool only_localized = false) = 0;
450 
457  virtual const char* name_of( const base::IInterface* db_element) const = 0;
458 
470  virtual const char* get_time_stamp() const = 0;
471 
483  virtual const char* get_time_stamp( const char* element) const = 0;
484 
500  virtual bool has_changed_since_time_stamp(
501  const char* element, const char* time_stamp) const = 0;
502 
509  virtual const char* get_id() const = 0;
510 
512  virtual IScope* get_scope() const = 0;
513 
538  virtual IArray* list_elements(
539  const char* root_element,
540  const char* name_pattern = 0,
541  const IArray* type_names = 0) const = 0;
542 
552  virtual Sint32 get_privacy_level( const char* name) const = 0;
553 };
554  // end group mi_neuray_database_access
556 
557 } // namespace neuraylib
558 
559 } // namespace mi
560 
561 #endif // MI_NEURAYLIB_ITRANSACTION_H