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
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:
93 virtual Sint32 commit() = 0;
94
99 virtual void abort() = 0;
100
105 virtual bool is_open() const = 0;
106
140 const char* type_name,
141 Uint32 argc = 0,
142 const base::IInterface* argv[] = 0) = 0;
143
194 template<class T>
196 const char* type_name,
197 Uint32 argc = 0,
198 const base::IInterface* argv[] = 0)
199 {
200 base::IInterface* ptr_iinterface = create( type_name, argc, argv);
201 if( !ptr_iinterface)
202 return 0;
203 T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
204 ptr_iinterface->release();
205 return ptr_T;
206 }
207
242 template<class T>
244 {
245 return create<T>( Type_traits<T>::get_type_name());
246 }
247
253 static const mi::Uint8 LOCAL_SCOPE = 255;
254
299 virtual Sint32 store(
300 base::IInterface* db_element, const char* name, Uint8 privacy = LOCAL_SCOPE) = 0;
301
310 virtual const base::IInterface* access( const char* name) = 0;
311
328 template<class T>
329 const T* access( const char* name)
330 {
331 const base::IInterface* ptr_iinterface = access( name);
332 if( !ptr_iinterface)
333 return 0;
334 const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
335 ptr_iinterface->release();
336 return ptr_T;
337 }
338
350 virtual base::IInterface* edit( const char* name) = 0;
351
371 template<class T>
372 T* edit( const char* name)
373 {
374 base::IInterface* ptr_iinterface = edit( name);
375 if( !ptr_iinterface)
376 return 0;
377 T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
378 ptr_iinterface->release();
379 return ptr_T;
380 }
381
406#ifdef MI_NEURAYLIB_DEPRECATED_ITRANSACTION_COPY_DEFAULT_PRIVACY_LEVEL_ZERO
407 virtual Sint32 copy( const char* source, const char* target, Uint8 privacy = 0) = 0;
408#else
409 virtual Sint32 copy( const char* source, const char* target, Uint8 privacy = LOCAL_SCOPE) = 0;
410#endif
411
457 virtual Sint32 remove( const char* name, bool only_localized = false) = 0;
458
465 virtual const char* name_of( const base::IInterface* db_element) const = 0;
466
481 virtual const char* get_time_stamp() const = 0;
482
497 virtual const char* get_time_stamp( const char* element) const = 0;
498
520 const char* element, const char* time_stamp) const = 0;
521
528 virtual const char* get_id() const = 0;
529
531 virtual IScope* get_scope() const = 0;
532
560 const char* root_element,
561 const char* name_pattern = 0,
562 const IArray* type_names = 0) const = 0;
563
573 virtual Sint32 get_privacy_level( const char* name) const = 0;
574};
575 // end group mi_neuray_database_access
577
578} // namespace neuraylib
579
580} // namespace mi
581
582#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 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:253
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:243
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:329
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:195
T * edit(const char *name)
Retrieves an element from the database and returns it ready for editing.
Definition: itransaction.h:372
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
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.