Skip to content

Entity

INCLUDE FILE
#include "Entity/Entity.h"

class Entity

Represents an entity in the source code, which can be a constant, object, macro, or function.

DEFINITION
class Entity;

constructor Entity

DEFINITION
Entity ( const Location & location,
Symbol  name,
std::shared_ptr< Scope >  containing_scope,
const std::shared_ptr< StructuredValue > & definition );
PARAMETERDESCRIPTION
location
name
containing_scope
definition

constructor Entity

DEFINITION
Entity ( const Location & location,
Symbol  name,
Visibility  visibility,
std::shared_ptr< Scope >  containing_scope,
bool  default_only = false );
PARAMETERDESCRIPTION
location
name
visibility
containing_scope
default_only

destructor ~Entityvirtual

DEFINITION
virtual ~Entity ( );

method as

DEFINITION
template <typename T>
T * as ( );
RETURNSDESCRIPTION
T *

method asconst

DEFINITION
template <typename T>
const T * as ( ) const;
RETURNSDESCRIPTION
const T *

method containing_scopeconst

DEFINITION
std::shared_ptr< Scope >  containing_scope ( ) const;
RETURNSDESCRIPTION
std::shared_ptr< Scope >

method evaluate

DEFINITION
void  evaluate ( );

method evaluate_implementationvirtual protected

DEFINITION
virtual void  evaluate_implementation ( EvaluationContext & context );
PARAMETERDESCRIPTION
context

method evaluate_processvirtual protected

DEFINITION
virtual void  evaluate_process ( EvaluationContext & context );
PARAMETERDESCRIPTION
context

method evaluation_contextvirtual protected

DEFINITION
virtual EvaluationContext  evaluation_context ( );
RETURNSDESCRIPTION
EvaluationContext

method expand_calls

Expand macro and function calls in the entity.

DEFINITION
void  expand_calls ( );

method expand_calls_implementationvirtual protected

Expand macro and function calls in the entity.

The default implementation calls expand_calls() on all sub-body-elements and sub-expressions using traverse().

DEFINITION
virtual void  expand_calls_implementation ( );

method get_locationconst

DEFINITION
Location  get_location ( ) const;
RETURNSDESCRIPTION
Location

method get_nameconst

DEFINITION
Symbol  get_name ( ) const;
RETURNSDESCRIPTION
Symbol

method get_visibilityconst

DEFINITION
Visibility  get_visibility ( ) const;
RETURNSDESCRIPTION
Visibility

method isconst

DEFINITION
template <typename T>
bool  is ( ) const;
RETURNSDESCRIPTION
bool

method is_default_onlyconst

DEFINITION
bool  is_default_only ( ) const;
RETURNSDESCRIPTION
bool

method is_publicconst

DEFINITION
bool  is_public ( ) const;
RETURNSDESCRIPTION
bool

method operator<const

DEFINITION
bool  operator< ( const Entity & other ) const;
PARAMETERDESCRIPTION
other
RETURNSDESCRIPTION
bool

method resolve

Resolve names in the entity.

DEFINITION
void  resolve ( );

method resolve_implementationvirtual protected

Resolve names in the entity.

The default implementation calls resolve() on all sub-body-elements and sub-expressions using traverse().

DEFINITION
virtual void  resolve_implementation ( );

method serializeconst virtual

DEFINITION
virtual void  serialize ( std::ostream & stream ) const;
PARAMETERDESCRIPTION
stream

method serialize_entityconst protected

DEFINITION
void  serialize_entity ( std::ostream & stream ) const;
PARAMETERDESCRIPTION
stream

method traversevirtual protected

Traverse the Entity.

This function is used by the default implementations of resolve_implementation() and expand_calls_implementation(). Unless a subclass overrides both of these methods, it should override traverse().

DEFINITION
virtual void  traverse ( std::function< void(Entity &)>  entity_callable,
std::function< void(Body &)>  body_callable,
std::function< void(Expression &)>  expression_callable );
PARAMETERDESCRIPTION
entity_callable
body_callable

A callable to apply to each sub-body-element.

expression_callable

A callable to apply to each sub-expression.

method uses

DEFINITION
void  uses ( Entity * entity );
PARAMETERDESCRIPTION
entity

member containing_module

DEFINITION
Module * containing_module;

member containing_scope_protected

DEFINITION
std::weak_ptr< Scope >  containing_scope_;

member default_onlyprivate

DEFINITION
bool  default_only;

member location

The location of the entity in the source code.

DEFINITION
Location  location;

member name

The name of the entity.

DEFINITION
Symbol  name;

member referenced_entities

All entities referenced by the entity.

DEFINITION
std::unordered_set< Entity * >  referenced_entities;

member resolvedprivate

DEFINITION
bool  resolved;

member token_default_onlystatic private

DEFINITION
static const Token  token_default_only;

member token_visibilitystatic private

DEFINITION
static const Token  token_visibility;

member visibility

The visibility of the entity, i. e. in which scope it can be used.

DEFINITION
Visibility  visibility;