MDL SDK API nvidia_logo_transpbg.gif Up
itransaction.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2025 NVIDIA Corporation. All rights reserved.
3 **************************************************************************************************/
6
7#ifndef MI_NEURAYLIB_ITRANSACTION_H
8#define MI_NEURAYLIB_ITRANSACTION_H
9
13
14namespace mi {
15
16class IArray;
17
18namespace neuraylib {
19
20class IScope;
21
80class ITransaction : public
81 mi::base::Interface_declare<0x6ca1f0c2,0xb262,0x4f09,0xa6,0xa5,0x05,0xae,0x14,0x45,0xed,0xfa>
82{
83public:
89 static const mi::Uint8 LOCAL_SCOPE = 255;
90
92
93
100 virtual const char* get_id() const = 0;
101
103 virtual IScope* get_scope() const = 0;
104
106
108
113 virtual bool is_open() const = 0;
114
124 virtual Sint32 commit() = 0;
125
130 virtual void abort() = 0;
131
133
135
169 const char* type_name,
170 Uint32 argc = 0,
171 const base::IInterface* argv[] = nullptr) = 0;
172
223 template<class T>
225 const char* type_name,
226 Uint32 argc = 0,
227 const base::IInterface* argv[] = nullptr)
228 {
229 base::IInterface* ptr_iinterface = create( type_name, argc, argv);
230 if( !ptr_iinterface)
231 return 0;
232 T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
233 ptr_iinterface->release();
234 return ptr_T;
235 }
236
271 template<class T>
273 {
274 return create<T>( Type_traits<T>::get_type_name());
275 }
276
278
280
281
326 virtual Sint32 store(
327 base::IInterface* db_element, const char* name, Uint8 privacy = LOCAL_SCOPE) = 0;
328
330
332
341 virtual const base::IInterface* access( const char* name) = 0;
342
359 template<class T>
360 const T* access( const char* name)
361 {
362 const base::IInterface* ptr_iinterface = access( name);
363 if( !ptr_iinterface)
364 return nullptr;
365 const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
366 ptr_iinterface->release();
367 return ptr_T;
368 }
369
381 virtual base::IInterface* edit( const char* name) = 0;
382
401 template<class T>
402 T* edit( const char* name)
403 {
404 base::IInterface* ptr_iinterface = edit( name);
405 if( !ptr_iinterface)
406 return nullptr;
407 T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
408 ptr_iinterface->release();
409 return ptr_T;
410 }
411
413
415
440#ifdef MI_NEURAYLIB_DEPRECATED_ITRANSACTION_COPY_DEFAULT_PRIVACY_LEVEL_ZERO
441 virtual Sint32 copy( const char* source, const char* target, Uint8 privacy = 0) = 0;
442#else
443 virtual Sint32 copy( const char* source, const char* target, Uint8 privacy = LOCAL_SCOPE) = 0;
444#endif
445
491 virtual Sint32 remove( const char* name, bool only_localized = false) = 0;
492
499 virtual const char* name_of( const base::IInterface* db_element) const = 0;
500
510 virtual Sint32 get_privacy_level( const char* name) const = 0;
511
513
515
530 virtual const char* get_time_stamp() const = 0;
531
546 virtual const char* get_time_stamp( const char* element) const = 0;
547
569 const char* element, const char* time_stamp) const = 0;
570
572
574
602 const char* root_element,
603 const char* name_pattern = nullptr,
604 const IArray* type_names = nullptr) const = 0;
605
607};
608 // end group mi_neuray_database_access
610
611} // namespace neuraylib
612
613} // namespace mi
614
615#endif // MI_NEURAYLIB_ITRANSACTION_H
This interface represents static arrays, i.e., arrays with a fixed number of elements.
Definition: iarray.h:37
The basic extensible interface.
Definition: iinterface.h:103
Mixin class template for deriving new interface declarations.
Definition: interface_declare.h:43
A scope is the context which determines the visibility of database elements.
Definition: iscope.h:44
A transaction provides a consistent view on the database.
Definition: itransaction.h:82
virtual base::IInterface * create(const char *type_name, Uint32 argc=0, const base::IInterface *argv[]=nullptr)=0
Creates an object of the type type_name.
virtual const base::IInterface * access(const char *name)=0
Retrieves an element from the database.
virtual const char * get_time_stamp(const char *element) const =0
Returns the time stamp of the last change of a database element.
virtual const char * get_id() const =0
Returns the ID of this transaction.
virtual bool is_open() const =0
Indicates whether the transaction is open.
T * create(const char *type_name, Uint32 argc=0, const base::IInterface *argv[]=nullptr)
Creates an object of the type type_name.
Definition: itransaction.h:224
virtual const char * get_time_stamp() const =0
Returns the time stamp describing the current "time".
virtual Sint32 copy(const char *source, const char *target, Uint8 privacy=LOCAL_SCOPE)=0
Creates a copy of a database element.
virtual base::IInterface * edit(const char *name)=0
Retrieves an element from the database and returns it ready for editing.
virtual void abort()=0
Aborts the transaction.
virtual const char * name_of(const base::IInterface *db_element) const =0
Returns the name of a database element.
static const mi::Uint8 LOCAL_SCOPE
Symbolic privacy level for the privacy level of the scope of this transaction.
Definition: itransaction.h:89
virtual bool has_changed_since_time_stamp(const char *element, const char *time_stamp) const =0
Checks whether an element has been stored or changed in the database since a given time stamp.
virtual IArray * list_elements(const char *root_element, const char *name_pattern=nullptr, const IArray *type_names=nullptr) const =0
Returns scene elements of a subgraph originating at a given scene element.
T * create()
Creates an object of the type T.
Definition: itransaction.h:272
virtual Sint32 remove(const char *name, bool only_localized=false)=0
Marks the element with the name name for removal from the database.
virtual Sint32 commit()=0
Commits the transaction.
const T * access(const char *name)
Retrieves an element from the database.
Definition: itransaction.h:360
virtual IScope * get_scope() const =0
Returns the scope of this transaction.
T * edit(const char *name)
Retrieves an element from the database and returns it ready for editing.
Definition: itransaction.h:402
virtual Sint32 store(base::IInterface *db_element, const char *name, Uint8 privacy=LOCAL_SCOPE)=0
Stores the element db_element in the database under the name name and with the privacy level privacy.
virtual Sint32 get_privacy_level(const char *name) const =0
Returns the privacy level of the element with the name name.
virtual const IInterface * get_interface(const Uuid &interface_id) const =0
Acquires a const interface from another.
virtual Uint32 release() const =0
Decrements the reference count.
unsigned char Uint8
8-bit unsigned integer.
Definition: types.h:47
int Sint32
32-bit signed integer.
Definition: types.h:46
unsigned int Uint32
32-bit unsigned integer.
Definition: types.h:49
Mixin class template for deriving new interface declarations.
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
Definition: example_derivatives.dox:5
Major and minor version number and an optional qualifier.
Type traits relating interfaces, corresponding primitive types, and their type names.
Definition: type_traits.h:162
Type traits.