Material Definition Language API nvidia_logo_transpbg.gif Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mi::neuraylib::IScope Class Referenceabstract

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

Inheritance diagram for mi::neuraylib::IScope:
mi::base::Interface_declare< 0x578df0c5, 0xab97, 0x460a, 0xb5, 0x0a, 0x2c, 0xf8, 0x54, 0x22, 0x31, 0xb9 > mi::base::IInterface

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...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0x578df0c5, 0xab97, 0x460a, 0xb5, 0x0a, 0x2c, 0xf8, 0x54, 0x22, 0x31, 0xb9 >
typedef Interface_declare< id1,
id2, id3, id4, id5, id6, id7,
id8, id9, id10, id11,
IInterface
Self
 Own type. More...
 
typedef Uuid_t< id1, id2, id3,
id4, id5, id6, id7, id8, id9,
id10, id11 > 
IID
 Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0x578df0c5, 0xab97, 0x460a, 0xb5, 0x0a, 0x2c, 0xf8, 0x54, 0x22, 0x31, 0xb9 >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. 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 scopes and elements is similar to scopes and the lifetime 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.

Note
The MDL SDK currently supports only one scope, the global scope. It also supports only one transaction at a time.

Member Function Documentation

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

Creates a new transaction associated with this scope.

Note
The MDL SDK currently supports only one transaction at a time.
Returns
A transaction associated with this scope.
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.

Note
The MDL SDK currently supports only one transaction at a time.
Template Parameters
TThe interface type of the transaction to create.
Returns
A transaction associated with this scope.
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.
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.
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.
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.