MDL SDK API nvidia_logo_transpbg.gif Up
mi::neuraylib::IDatabase Class Referenceabstract

This interface is used to interact with the distributed database. More...

#include <idatabase.h>

Inheritance diagram for mi::neuraylib::IDatabase:

Public Types

enum  Garbage_collection_priority {
  PRIORITY_LOW = 0 ,
  PRIORITY_MEDIUM = 1 ,
  PRIORITY_HIGH = 2 ,
  PRIORITY_FORCE_32_BIT = 0xffffffffU
}
 Priorities for synchronous garbage collection runs. More...
 
- Public Types inherited from mi::base::Interface_declare< 0x814ae637, ... >
using Self = Interface_declare< id1, ... >
 Own type. More...
 
using IID = Uuid_t< id1, ... >
 Declares the interface ID (IID) of this interface. More...
 
- Public Types inherited from mi::base::IInterface
using IID = Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0>
 Declares the interface ID (IID) of this interface. More...
 

Public Member Functions

virtual IScopeget_global_scope () const =0
 Returns the global scope which is the root of a tree of scopes. More...
 
virtual IScopecreate_scope (IScope *parent, Uint8 privacy_level=0, bool temp=false)=0
 Creates a new unnamed scope. More...
 
virtual IScopecreate_or_get_named_scope (const char *name, IScope *parent=nullptr, Uint8 privacy_level=0)=0
 Creates a new named scope (or retrieves an existing one). More...
 
virtual IScopeget_scope (const char *id) const =0
 Looks up a scope by ID. More...
 
virtual IScopeget_named_scope (const char *name) const =0
 Looks up a scope by name. More...
 
virtual Sint32 remove_scope (const char *id) const =0
 Removes a scope with the specified ID. More...
 
virtual void garbage_collection (Garbage_collection_priority priority=PRIORITY_MEDIUM)=0
 Triggers a synchronous garbage collection run. More...
 
virtual void lock (Uint32 lock_id)=0
 This operation is not supported. More...
 
virtual Sint32 unlock (Uint32 lock_id)=0
 This operation is not supported. More...
 
- Public Member Functions inherited from mi::base::IInterface
virtual Uint32 retain () const =0
 Increments the reference count. More...
 
virtual Uint32 release () const =0
 Decrements the reference count. More...
 
virtual const IInterfaceget_interface (const Uuid &interface_id) const =0
 Acquires a const interface from another. More...
 
template<class T>
const T * get_interface () const
 Acquires a const interface from another. More...
 
virtual IInterfaceget_interface (const Uuid &interface_id)=0
 Acquires a mutable interface from another. More...
 
template<class T>
T * get_interface ()
 Acquires a mutable interface from another. More...
 
virtual Uuid get_iid () const =0
 Returns the interface ID of the most derived interface. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from mi::base::Interface_declare< 0x814ae637, ... >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 
- Static Public Member Functions inherited from mi::base::IInterface
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface. More...
 

Detailed Description

This interface is used to interact with the distributed database.

Member Enumeration Documentation

 Garbage_collection_priority

Priorities for synchronous garbage collection runs.

Enumerator
PRIORITY_LOW 

Low priority for synchronous garbage collection runs.

Use this priority if the performance of other concurrent DB operations is more important than a fast synchronous garbage collection.

PRIORITY_MEDIUM 

Medium priority for synchronous garbage collection runs.

This priority attempts to maintain a balance between the synchronous garbage collection and other concurrent DB operations.

PRIORITY_HIGH 

High priority for synchronous garbage collection runs.

Other concurrent DB operations will experience a large performance drop. Therefore, this priority should not be used in multi-user settings.

Member Function Documentation

 create_or_get_named_scope()

virtual IScope * mi::neuraylib::IDatabase::create_or_get_named_scope ( const char *  name,
IScope parent = nullptr,
Uint8  privacy_level = 0 
)
pure virtual

Creates a new named scope (or retrieves an existing one).

Parameters
nameThe name of the new scope. If there is no scope with that name, it will be created with the given parent scope and privacy level. Otherwise, if the given parent scope and privacy level match the properties of an existing scope with that name, then that scope will be returned. If there is a mismatch, neither a scope will be created nor returned, and the method returns nullptr.
parentThe parent scope for this scope. The value nullptr represents the global scope.
privacy_levelThe privacy level of the scope, which must be higher than the privacy level of the parent scope. The privacy level of the global scope is 0 (and the global scope is the only scope with privacy level 0). The default value of 0 indicates the privacy level of the parent scope plus 1.
Returns
The created scope, or nullptr in case of errors.

 create_scope()

virtual IScope * mi::neuraylib::IDatabase::create_scope ( IScope parent,
Uint8  privacy_level = 0,
bool  temp = false 
)
pure virtual

Creates a new unnamed scope.

Note
A scope continues to exist if the pointer returned by this method is released. Use remove_scope() to remove a scope.
Parameters
parentThe parent scope for this scope. The value nullptr represents the global scope.
privacy_levelThe privacy level of the scope, which must be higher than the privacy level of the parent scope. The privacy level of the global scope is 0 (and the global scope is the only scope with privacy level 0). The default value of 0 indicates the privacy level of the parent scope plus 1.
tempUnused.
Returns
The created scope, or nullptr in case of errors.

 garbage_collection()

virtual void mi::neuraylib::IDatabase::garbage_collection ( Garbage_collection_priority  priority = PRIORITY_MEDIUM)
pure virtual

Triggers a synchronous garbage collection run.

The method sweeps through the entire database and removes all database elements which have been marked for removal and are no longer referenced. Note that it is not possible to remove database elements if there are open transactions in which such an element is still referenced.

To mark an element for removal use mi::neuraylib::ITransaction::remove().

Parameters
priorityThe intended priority of the synchronous garbage collection run. The MDL SDK does not support different priorities, and the synchronous garbage collection always runs at highest priority.

 get_global_scope()

virtual IScope * mi::neuraylib::IDatabase::get_global_scope ( ) const
pure virtual

Returns the global scope which is the root of a tree of scopes.

Returns
The global scope which is guaranteed to exist after startup of the system.

 get_named_scope()

virtual IScope * mi::neuraylib::IDatabase::get_named_scope ( const char *  name) const
pure virtual

Looks up a scope by name.

Parameters
nameThe name of the scope
Returns
The found scope or nullptr if no such scope exists.

 get_scope()

virtual IScope * mi::neuraylib::IDatabase::get_scope ( const char *  id) const
pure virtual

Looks up a scope by ID.

Parameters
idThe ID of the scope as returned by mi::neuraylib::IScope::get_id().
Returns
The found scope or nullptr if no such scope exists.

 lock()

virtual void mi::neuraylib::IDatabase::lock ( Uint32  lock_id)
pure virtual

This operation is not supported.

 remove_scope()

virtual Sint32 mi::neuraylib::IDatabase::remove_scope ( const char *  id) const
pure virtual

Removes a scope with the specified ID.

Note that scopes are reference counted. The actual removal will not happen before all elements referencing the scope have been released, e.g., child scopes, transactions, database elements, including handles to the scope itself. Even when all these conditions are met, scope removal might actually happen at a later point in time, depending on the timing of past and current transactions, even in unrelated scopes.

It is not possible to remove the global scope.

Parameters
idThe ID of the scope as returned by mi::neuraylib::IScope::get_id().
Returns
0, in case of success, -1 in case of failure.

 unlock()

virtual Sint32 mi::neuraylib::IDatabase::unlock ( Uint32  lock_id)
pure virtual

This operation is not supported.