ContRap-Core
Public Member Functions | Protected Attributes

crp::Instance Class Reference

Class Instance represents an instance of a ContRap native class. More...

#include <instance.h>

Inheritance diagram for crp::Instance:
crp::Scope crp::Object

Public Member Functions

 Instance (const SPtr< Class > &base_class, const SPtr< Scope > &parent=0)
 Object constructor.
virtual ~Instance ()
 Virtual destructor.
virtual const DPtrget_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 DPtrget_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< Classbase_class
 Base class.
std::vector< SPtr< Instance > > super_classes
 Super class instances within the current scope.

Detailed Description

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.


Constructor & Destructor Documentation

crp::Instance::Instance ( const SPtr< Class > &  base_class,
const SPtr< Scope > &  parent = 0 
)

Object constructor.

Parameters:
base_classBase class
parentInstance scope
virtual crp::Instance::~Instance ( ) [inline, virtual]

Virtual destructor.


Member Function Documentation

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.

Parameters:
nameIdentifier name
Returns:
Value of the name

Reimplemented from crp::Scope.

virtual Object::Type crp::Instance::get_type ( ) const [inline, virtual]

Returns the enumerated type of the object.

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

Parameters:
nameIdentifier name
Returns:
Value of the name

Reimplemented from crp::Scope.

virtual std::string crp::Instance::to_string ( ) const [virtual]

Creates an unformatted scope representation as a string.

Returns:
String representation of the scope

Reimplemented from crp::Scope.


Field Documentation

Base class.

std::vector<SPtr<Instance> > crp::Instance::super_classes [protected]

Super class instances within the current scope.


The documentation for this class was generated from the following file: