MDL SDK API nvidia_logo_transpbg.gif 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 2022 NVIDIA Corporation. All rights reserved.
3  **************************************************************************************************/
6 
7 #ifndef MI_NEURAYLIB_ITRANSACTION_H
8 #define MI_NEURAYLIB_ITRANSACTION_H
9 
12 
13 namespace mi {
14 
15 class IArray;
16 
17 namespace neuraylib {
18 
19 class IScope;
20 
25 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 
105  virtual void abort() = 0;
106 
111  virtual bool is_open() const = 0;
112 
145  virtual base::IInterface* create(
146  const char* type_name,
147  Uint32 argc = 0,
148  const base::IInterface* argv[] = 0) = 0;
149 
200  template<class T>
201  T* create(
202  const char* type_name,
203  Uint32 argc = 0,
204  const base::IInterface* argv[] = 0)
205  {
206  base::IInterface* ptr_iinterface = create( type_name, argc, argv);
207  if( !ptr_iinterface)
208  return 0;
209  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
210  ptr_iinterface->release();
211  return ptr_T;
212  }
213 
248  template<class T>
249  T* create()
250  {
251  return create<T>( Type_traits<T>::get_type_name());
252  }
253 
259  static const mi::Uint8 LOCAL_SCOPE = 255;
260 
308  virtual Sint32 store(
309  base::IInterface* db_element, const char* name, Uint8 privacy = LOCAL_SCOPE) = 0;
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 
359  virtual base::IInterface* edit( const char* name) = 0;
360 
380  template<class T>
381  T* edit( const char* name)
382  {
383  base::IInterface* ptr_iinterface = edit( name);
384  if( !ptr_iinterface)
385  return 0;
386  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
387  ptr_iinterface->release();
388  return ptr_T;
389  }
390 
418  virtual Sint32 copy( const char* source, const char* target, Uint8 privacy = 0) = 0;
419 
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 
473  virtual const char* get_time_stamp() const = 0;
474 
489  virtual const char* get_time_stamp( const char* element) const = 0;
490 
511  virtual bool has_changed_since_time_stamp(
512  const char* element, const char* time_stamp) const = 0;
513 
520  virtual const char* get_id() const = 0;
521 
523  virtual IScope* get_scope() const = 0;
524 
551  virtual IArray* list_elements(
552  const char* root_element,
553  const char* name_pattern = 0,
554  const IArray* type_names = 0) const = 0;
555 
565  virtual Sint32 get_privacy_level( const char* name) const = 0;
566 };
567  // end group mi_neuray_database_access
569 
570 } // namespace neuraylib
571 
572 } // namespace mi
573 
574 #endif // MI_NEURAYLIB_ITRANSACTION_H