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

A scope is the context which determines the visibility of database elements. More...

#include <iscope.h>

Inheritance diagram for mi::neuraylib::IScope:

Public Member Functions

virtual ITransactioncreate_transaction ()=0
 Creates a new transaction associated with this scope. More...
 
template<class T>
T * create_transaction ()
 Creates a new transaction associated with this scope. More...
 
virtual const char * get_id () const =0
 Returns the ID of the scope. More...
 
virtual Uint8 get_privacy_level () const =0
 Returns the privacy level of the scope. More...
 
virtual const char * get_name () const =0
 Returns the name of the scope. More...
 
virtual IScopeget_parent () const =0
 Returns the parent scope. 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

- Public Types inherited from mi::base::Interface_declare< 0x578df0c5, ... >
typedef Interface_declare< id1, ... > Self
 Own type. More...
 
typedef Uuid_t< id1, ... > IID
 Declares the interface ID (IID) of this interface. More...
 
- Public Types inherited from mi::base::IInterface
typedef Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> IID
 Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0x578df0c5, ... >
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

A scope is the context which determines the visibility of database elements.

Scopes are organized in a tree-like fashion and have a so-called privacy level. The root of the tree is called global scope and has privacy level 0. On each path from the global scope to one of the leafs of the tree the privacy levels are strictly increasing. Scopes are identified with a cluster-unique ID which can be used to access a scope on any host in the cluster.

A database element stored in a given scope is only visible in this scope and all child scopes. For example, a database element stored in the global scope is visible in all scopes. This visibility concept for database elements is similar to visibility of stack variables in programming languages.

Any database element can exist in multiple versions (at most one version per scope). In this case the scope at hand does not just determine the visibility itself but also determines which version is visible. The version from the current scope has highest priority, next is the version from the parent scope, etc., until the global scope is reached. Again, this is similar to shadowing of variables with the same name in programming languages.

For scope management see the methods on mi::neuraylib::IDatabase.

Member Function Documentation

 create_transaction() [1/2]

template<class T>
T * mi::neuraylib::IScope::create_transaction ( )
inline

Creates a new transaction associated with this scope.

This templated member function is a wrapper of the non-template variant for the user's convenience. It eliminates the need to call mi::base::IInterface::get_interface(const Uuid&) on the returned pointer, since the return type already is a pointer to the type T specified as template parameter.

Template Parameters
TThe interface type of the transaction to create.
Returns
A transaction associated with this scope.

 create_transaction() [2/2]

virtual ITransaction * mi::neuraylib::IScope::create_transaction ( )
pure virtual

Creates a new transaction associated with this scope.

Returns
A transaction associated with this scope.

 get_id()

virtual const char * mi::neuraylib::IScope::get_id ( ) const
pure virtual

Returns the ID of the scope.

Can be used to retrieve the scope from the database later.

Returns
The ID of the scope.

 get_name()

virtual const char * mi::neuraylib::IScope::get_name ( ) const
pure virtual

Returns the name of the scope.

Returns
The name of the scope, or NULL if the scope has no name.

 get_parent()

virtual IScope * mi::neuraylib::IScope::get_parent ( ) const
pure virtual

Returns the parent scope.

Returns
The parent scope or NULL if the scope is the global scope.

 get_privacy_level()

virtual Uint8 mi::neuraylib::IScope::get_privacy_level ( ) const
pure virtual

Returns the privacy level of the scope.

The global scope has privacy level 0, all other scopes have higher privacy levels. On each path from the global scope to any other scope in the scope tree the privacy levels are strictly increasing.

Returns
The privacy level of the scope.