ContRap-Core
|
Class Instance represents an instance of a ContRap native class. More...
#include <instance.h>
Public Member Functions | |
Instance (const SPtr< Class > &base_class, const SPtr< Scope > &parent=0) | |
Object constructor. | |
virtual | ~Instance () |
Virtual destructor. | |
virtual const DPtr & | get_value (const std::string &name) const |
Finds a value to the key within the current scope or in one of the parent scopes of the current scope or in the scopes of the super classes. | |
virtual const DPtr & | get_local_value (const std::string &name) const |
Finds a value to the key within the current scope. | |
virtual Object::Type | get_type () const |
Returns the enumerated type of the object. | |
virtual std::string | to_string () const |
Creates an unformatted scope representation as a string. | |
Protected Attributes | |
SPtr< Class > | base_class |
Base class. | |
std::vector< SPtr< Instance > > | super_classes |
Super class instances within the current scope. |
Class Instance represents an instance of a ContRap native class.
An instance is inherited from the Scope but it behaves differently when looking for the values.
The order of the lookup for values is: local, instances of super classes, permanent super class, and parent. Local value search looks besides the local scope inside the children scopes.
To assign the vales of super class instances you have to explicitly write down the super class name.
virtual crp::Instance::~Instance | ( | ) | [inline, virtual] |
Virtual destructor.
virtual const DPtr& crp::Instance::get_local_value | ( | const std::string & | name | ) | const [virtual] |
Finds a value to the key within the current scope.
This function looks in addition to the get_local_value() function of the Scope class inside the children locally.
name | Identifier name |
Reimplemented from crp::Scope.
virtual Object::Type crp::Instance::get_type | ( | ) | const [inline, virtual] |
Returns the enumerated type of the object.
Reimplemented from crp::Scope.
virtual const DPtr& crp::Instance::get_value | ( | const std::string & | name | ) | const [virtual] |
Finds a value to the key within the current scope or in one of the parent scopes of the current scope or in the scopes of the super classes.
For instances additionally the super class instances are searched locally.
name | Identifier name |
Reimplemented from crp::Scope.
virtual std::string crp::Instance::to_string | ( | ) | const [virtual] |
Creates an unformatted scope representation as a string.
Reimplemented from crp::Scope.
SPtr<Class> crp::Instance::base_class [protected] |
Base class.
std::vector<SPtr<Instance> > crp::Instance::super_classes [protected] |
Super class instances within the current scope.