Material Definition Language 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 2020 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
76  mi::base::Interface_declare<0x6ca1f0c2,0xb262,0x4f09,0xa6,0xa5,0x05,0xae,0x14,0x45,0xed,0xfa>
77 {
78 public:
88  virtual Sint32 commit() = 0;
89 
98  virtual void abort() = 0;
99 
104  virtual bool is_open() const = 0;
105 
140  virtual base::IInterface* create(
141  const char* type_name,
142  Uint32 argc = 0,
143  const base::IInterface* argv[] = 0) = 0;
144 
197  template<class T>
198  T* create(
199  const char* type_name,
200  Uint32 argc = 0,
201  const base::IInterface* argv[] = 0)
202  {
203  base::IInterface* ptr_iinterface = create( type_name, argc, argv);
204  if( !ptr_iinterface)
205  return 0;
206  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
207  ptr_iinterface->release();
208  return ptr_T;
209  }
210 
247  template<class T>
248  T* create()
249  {
250  return create<T>( Type_traits<T>::get_type_name());
251  }
252 
258  static const mi::Uint8 LOCAL_SCOPE = 255;
259 
307  virtual Sint32 store(
308  base::IInterface* db_element, const char* name, Uint8 privacy = LOCAL_SCOPE) = 0;
309 
318  virtual const base::IInterface* access( const char* name) = 0;
319 
336  template<class T>
337  const T* access( const char* name)
338  {
339  const base::IInterface* ptr_iinterface = access( name);
340  if( !ptr_iinterface)
341  return 0;
342  const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
343  ptr_iinterface->release();
344  return ptr_T;
345  }
346 
358  virtual base::IInterface* edit( const char* name) = 0;
359 
379  template<class T>
380  T* edit( const char* name)
381  {
382  base::IInterface* ptr_iinterface = edit( name);
383  if( !ptr_iinterface)
384  return 0;
385  T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
386  ptr_iinterface->release();
387  return ptr_T;
388  }
389 
417  virtual Sint32 copy( const char* source, const char* target, Uint8 privacy = 0) = 0;
418 
444  virtual Sint32 remove( const char* name, bool only_localized = false) = 0;
445 
452  virtual const char* name_of( const base::IInterface* db_element) const = 0;
453 
468  virtual const char* get_time_stamp() const = 0;
469 
484  virtual const char* get_time_stamp( const char* element) const = 0;
485 
506  virtual bool has_changed_since_time_stamp(
507  const char* element, const char* time_stamp) const = 0;
508 
515  virtual const char* get_id() const = 0;
516 
518  virtual IScope* get_scope() const = 0;
519 
547  virtual IArray* list_elements(
548  const char* root_element,
549  const char* name_pattern = 0,
550  const IArray* type_names = 0) const = 0;
551 
561  virtual Sint32 get_privacy_level( const char* name) const = 0;
562 };
563  // end group mi_neuray_database_access
565 
566 } // namespace neuraylib
567 
568 } // namespace mi
569 
570 #endif // MI_NEURAYLIB_ITRANSACTION_H