MDL SDK API nvidia_logo_transpbg.gif Up
itransaction.h
Go to the documentation of this file.
1/***************************************************************************************************
2 * Copyright 2024 NVIDIA Corporation. All rights reserved.
3 **************************************************************************************************/
6
7#ifndef MI_NEURAYLIB_ITRANSACTION_H
8#define MI_NEURAYLIB_ITRANSACTION_H
9
12
13namespace mi {
14
15class IArray;
16
17namespace neuraylib {
18
19class IScope;
20
79class ITransaction : public
80 mi::base::Interface_declare<0x6ca1f0c2,0xb262,0x4f09,0xa6,0xa5,0x05,0xae,0x14,0x45,0xed,0xfa>
81{
82public:
92 virtual Sint32 commit() = 0;
93
98 virtual void abort() = 0;
99
104 virtual bool is_open() const = 0;
105
139 const char* type_name,
140 Uint32 argc = 0,
141 const base::IInterface* argv[] = 0) = 0;
142
193 template<class T>
195 const char* type_name,
196 Uint32 argc = 0,
197 const base::IInterface* argv[] = 0)
198 {
199 base::IInterface* ptr_iinterface = create( type_name, argc, argv);
200 if( !ptr_iinterface)
201 return 0;
202 T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
203 ptr_iinterface->release();
204 return ptr_T;
205 }
206
241 template<class T>
243 {
244 return create<T>( Type_traits<T>::get_type_name());
245 }
246
252 static const mi::Uint8 LOCAL_SCOPE = 255;
253
298 virtual Sint32 store(
299 base::IInterface* db_element, const char* name, Uint8 privacy = LOCAL_SCOPE) = 0;
300
309 virtual const base::IInterface* access( const char* name) = 0;
310
327 template<class T>
328 const T* access( const char* name)
329 {
330 const base::IInterface* ptr_iinterface = access( name);
331 if( !ptr_iinterface)
332 return 0;
333 const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
334 ptr_iinterface->release();
335 return ptr_T;
336 }
337
349 virtual base::IInterface* edit( const char* name) = 0;
350
370 template<class T>
371 T* edit( const char* name)
372 {
373 base::IInterface* ptr_iinterface = edit( name);
374 if( !ptr_iinterface)
375 return 0;
376 T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
377 ptr_iinterface->release();
378 return ptr_T;
379 }
380
405#ifdef MI_NEURAYLIB_DEPRECATED_ITRANSACTION_COPY_DEFAULT_PRIVACY_LEVEL_ZERO
406 virtual Sint32 copy( const char* source, const char* target, Uint8 privacy = 0) = 0;
407#else
408 virtual Sint32 copy( const char* source, const char* target, Uint8 privacy = LOCAL_SCOPE) = 0;
409#endif
410
440 virtual Sint32 remove( const char* name, bool only_localized = false) = 0;
441
448 virtual const char* name_of( const base::IInterface* db_element) const = 0;
449
464 virtual const char* get_time_stamp() const = 0;
465
480 virtual const char* get_time_stamp( const char* element) const = 0;
481
503 const char* element, const char* time_stamp) const = 0;
504
511 virtual const char* get_id() const = 0;
512
514 virtual IScope* get_scope() const = 0;
515
543 const char* root_element,
544 const char* name_pattern = 0,
545 const IArray* type_names = 0) const = 0;
546
556 virtual Sint32 get_privacy_level( const char* name) const = 0;
557};
558 // end group mi_neuray_database_access
560
561} // namespace neuraylib
562
563} // namespace mi
564
565#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:48
A transaction provides a consistent view on the database.
Definition: itransaction.h:81
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.
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 * create(const char *type_name, Uint32 argc=0, const base::IInterface *argv[]=0)=0
Creates an object of the type type_name.
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 IArray * list_elements(const char *root_element, const char *name_pattern=0, const IArray *type_names=0) const =0
Returns scene elements of a subgraph originating at a given scene element.
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:252
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.
T * create()
Creates an object of the type T.
Definition: itransaction.h:242
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:328
virtual IScope * get_scope() const =0
Returns the scope of this transaction.
T * create(const char *type_name, Uint32 argc=0, const base::IInterface *argv[]=0)
Creates an object of the type type_name.
Definition: itransaction.h:194
T * edit(const char *name)
Retrieves an element from the database and returns it ready for editing.
Definition: itransaction.h:371
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 int Uint32
32-bit unsigned integer.
Definition: types.h:49
unsigned char Uint8
8-bit unsigned integer.
Definition: types.h:47
signed int Sint32
32-bit signed integer.
Definition: types.h:46
Mixin class template for deriving new interface declarations.
Common namespace for APIs of NVIDIA Advanced Rendering Center GmbH.
Definition: example_derivatives.dox:5
Type traits relating interfaces, corresponding primitive types, and their type names.
Definition: type_traits.h:162
Type traits.