MDL SDK API nvidia_logo_transpbg.gif Up
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
13namespace mi {
14
15class IArray;
16
17namespace neuraylib {
18
19class IScope;
20
82class ITransaction : public
83 mi::base::Interface_declare<0x6ca1f0c2,0xb262,0x4f09,0xa6,0xa5,0x05,0xae,0x14,0x45,0xed,0xfa>
84{
85public:
95 virtual Sint32 commit() = 0;
96
105 virtual void abort() = 0;
106
111 virtual bool is_open() const = 0;
112
146 const char* type_name,
147 Uint32 argc = 0,
148 const base::IInterface* argv[] = 0) = 0;
149
200 template<class T>
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>
250 {
251 return create<T>( Type_traits<T>::get_type_name());
252 }
253
259 static const mi::Uint8 LOCAL_SCOPE = 255;
260
305 virtual Sint32 store(
306 base::IInterface* db_element, const char* name, Uint8 privacy = LOCAL_SCOPE) = 0;
307
316 virtual const base::IInterface* access( const char* name) = 0;
317
334 template<class T>
335 const T* access( const char* name)
336 {
337 const base::IInterface* ptr_iinterface = access( name);
338 if( !ptr_iinterface)
339 return 0;
340 const T* ptr_T = static_cast<const T*>( ptr_iinterface->get_interface( typename T::IID()));
341 ptr_iinterface->release();
342 return ptr_T;
343 }
344
356 virtual base::IInterface* edit( const char* name) = 0;
357
377 template<class T>
378 T* edit( const char* name)
379 {
380 base::IInterface* ptr_iinterface = edit( name);
381 if( !ptr_iinterface)
382 return 0;
383 T* ptr_T = static_cast<T*>( ptr_iinterface->get_interface( typename T::IID()));
384 ptr_iinterface->release();
385 return ptr_T;
386 }
387
412 virtual Sint32 copy( const char* source, const char* target, Uint8 privacy = 0) = 0;
413
443 virtual Sint32 remove( const char* name, bool only_localized = false) = 0;
444
451 virtual const char* name_of( const base::IInterface* db_element) const = 0;
452
467 virtual const char* get_time_stamp() const = 0;
468
483 virtual const char* get_time_stamp( const char* element) const = 0;
484
506 const char* element, const char* time_stamp) const = 0;
507
514 virtual const char* get_id() const = 0;
515
517 virtual IScope* get_scope() const = 0;
518
546 const char* root_element,
547 const char* name_pattern = 0,
548 const IArray* type_names = 0) const = 0;
549
559 virtual Sint32 get_privacy_level( const char* name) const = 0;
560};
561 // end group mi_neuray_database_access
563
564} // namespace neuraylib
565
566} // namespace mi
567
568#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:49
A transaction provides a consistent view on the database.
Definition: itransaction.h:84
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 Sint32 copy(const char *source, const char *target, Uint8 privacy=0)=0
Creates a copy 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 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
This operation is not supported.
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:259
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:249
virtual Sint32 remove(const char *name, bool only_localized=false)=0
Removes the element with the name name 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:335
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:201
T * edit(const char *name)
Retrieves an element from the database and returns it ready for editing.
Definition: itransaction.h:378
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:47
unsigned char Uint8
8-bit unsigned integer.
Definition: types.h:45
signed int Sint32
32-bit signed integer.
Definition: types.h:44
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.