neuray API Programmer's Manual

mi::neuraylib::IScope Class Reference

[Database Access]

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.

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 const char* get_name() const =0
Returns the name of the scope. More...
virtual IScopeget_parent() const =0
Returns the parent scope. More...
virtual Uint8 get_privacy_level() const =0
Returns the privacy level of the scope. More...

Member Functions

virtual ITransaction* mi::​neuraylib::​IScope::create_transaction() [pure virtual]

Creates a new transaction associated with this scope.

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.

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.