MicroModelicaCCompiler  4.5.3
MicroModelica::Util::Variable Class Reference

#include <symbol_table.hpp>

Public Types

enum  RealType { State, Algebraic, NotAssigned }
 

Public Member Functions

 Variable ()
 
 Variable (Type t, AST_TypePrefix tp, AST_Modification m, AST_Comment c)
 
 Variable (Type t, AST_TypePrefix tp, AST_Modification m, AST_Comment c, const vector< int > &s, bool array)
 
Variableoperator= (const Variable &other)
 
bool operator== (const Variable &other)
 
bool operator!= (const Variable &other)
 
void setRealType (RealType type)
 
AST_TypePrefix typePrefix () const
 
AST_Comment comment ()
 
void setComment (AST_Comment c)
 
AST_Modification modification ()
 
void setModification (AST_Modification m)
 
Type type ()
 
void setType (Type t)
 
void setParameter ()
 
bool isParameter () const
 
bool isDiscrete () const
 
bool builtIn () const
 
void setBuiltIn ()
 
bool isConstant () const
 
bool isInput () const
 
bool isOutput () const
 
bool isForType () const
 
bool isEqType () const
 
bool isLocal () const
 
bool isState () const
 
bool isString () const
 
void setState ()
 
bool isUnknown () const
 
void setUnknown ()
 
bool isTime () const
 
bool isAlgebraic () const
 
void setValue (int val)
 
int value () const
 
unsigned int size ()
 
bool hasAssignment () const
 
bool hasStartModifier () const
 
bool hasEachModifier () const
 
void setEachModifier (bool each)
 
string name () const
 
void setName (string name)
 
AST_Expression exp ()
 
bool isArray () const
 
bool isScalar () const
 
unsigned int size (int dim) const
 
unsigned int rowSize (unsigned int dim) const
 
unsigned long dimensions () const
 
std::string declaration (std::string prefix="")
 
std::string initialization ()
 
bool hasOffset () const
 
void setOffset (int offset)
 
int offset () const
 
bool isModelVar () const
 
std::string print () const
 
std::string castOperator () const
 

Protected Member Functions

void processModification ()
 Process the argument modification to determine the variable modifiers if any. More...
 
void unsetAssignment ()
 
void unsetStartEach ()
 
bool isDiscreteInteger () const
 

Protected Attributes

bool _unknown
 
Type _t
 
AST_TypePrefix _tp
 
AST_Modification _m
 
AST_Comment _comm
 
bool _builtin
 
vector< int > _size
 
int _value
 
AST_Expression _exp
 
bool _hasStart
 
bool _hasEach
 
bool _hasAssigment
 
string _name
 
bool _isArray
 
bool _hasOffset
 
int _offset
 
RealType _realType
 

Friends

ostream & operator<< (ostream &os, const Variable &e)
 
std::ostream & operator<< (std::ostream &out, const Variable &v)
 

Detailed Description

Definition at line 75 of file symbol_table.hpp.

Member Enumeration Documentation

◆ RealType

Enumerator
State 
Algebraic 
NotAssigned 

Definition at line 84 of file symbol_table.hpp.

Constructor & Destructor Documentation

◆ Variable() [1/3]

MicroModelica::Util::Variable::Variable ( )

Definition at line 55 of file symbol_table.cpp.

◆ Variable() [2/3]

MicroModelica::Util::Variable::Variable ( Type  t,
AST_TypePrefix  tp,
AST_Modification  m,
AST_Comment  c 
)

Definition at line 76 of file symbol_table.cpp.

◆ Variable() [3/3]

MicroModelica::Util::Variable::Variable ( Type  t,
AST_TypePrefix  tp,
AST_Modification  m,
AST_Comment  c,
const vector< int > &  s,
bool  array 
)

Definition at line 98 of file symbol_table.cpp.

Member Function Documentation

◆ builtIn()

bool MicroModelica::Util::Variable::builtIn ( ) const
inline

Definition at line 105 of file symbol_table.hpp.

◆ castOperator()

std::string MicroModelica::Util::Variable::castOperator ( ) const

Definition at line 225 of file symbol_table.cpp.

◆ comment()

AST_Comment MicroModelica::Util::Variable::comment ( )
inline

Definition at line 88 of file symbol_table.hpp.

◆ declaration()

string MicroModelica::Util::Variable::declaration ( std::string  prefix = "")

Definition at line 240 of file symbol_table.cpp.

References MicroModelica::Util::Utils::instance(), TAB, and MicroModelica::Util::Utils::variableExpression().

Here is the call graph for this function:

◆ dimensions()

◆ exp()

AST_Expression MicroModelica::Util::Variable::exp ( )
inline

Definition at line 129 of file symbol_table.hpp.

◆ hasAssignment()

bool MicroModelica::Util::Variable::hasAssignment ( ) const
inline

Definition at line 123 of file symbol_table.hpp.

◆ hasEachModifier()

bool MicroModelica::Util::Variable::hasEachModifier ( ) const
inline

Definition at line 125 of file symbol_table.hpp.

◆ hasOffset()

bool MicroModelica::Util::Variable::hasOffset ( ) const
inline

Definition at line 138 of file symbol_table.hpp.

Referenced by MicroModelica::IR::Model::insert().

◆ hasStartModifier()

bool MicroModelica::Util::Variable::hasStartModifier ( ) const
inline

Definition at line 124 of file symbol_table.hpp.

◆ initialization()

string MicroModelica::Util::Variable::initialization ( )

Definition at line 256 of file symbol_table.cpp.

◆ isAlgebraic()

bool MicroModelica::Util::Variable::isAlgebraic ( ) const
inline

◆ isArray()

bool MicroModelica::Util::Variable::isArray ( ) const
inline

Definition at line 130 of file symbol_table.hpp.

Referenced by setType().

◆ isConstant()

bool MicroModelica::Util::Variable::isConstant ( ) const
inline

Definition at line 107 of file symbol_table.hpp.

◆ isDiscrete()

bool MicroModelica::Util::Variable::isDiscrete ( ) const
inline

◆ isDiscreteInteger()

bool MicroModelica::Util::Variable::isDiscreteInteger ( ) const
protected

Definition at line 223 of file symbol_table.cpp.

◆ isEqType()

bool MicroModelica::Util::Variable::isEqType ( ) const
inline

◆ isForType()

bool MicroModelica::Util::Variable::isForType ( ) const
inline

Definition at line 110 of file symbol_table.hpp.

References _offset.

◆ isInput()

bool MicroModelica::Util::Variable::isInput ( ) const
inline

Definition at line 108 of file symbol_table.hpp.

◆ isLocal()

bool MicroModelica::Util::Variable::isLocal ( ) const
inline

Definition at line 112 of file symbol_table.hpp.

◆ isModelVar()

bool MicroModelica::Util::Variable::isModelVar ( ) const
inline

Definition at line 145 of file symbol_table.hpp.

References MicroModelica::Util::TypeSymbolTable::TypeSymbolTable().

Here is the call graph for this function:

◆ isOutput()

bool MicroModelica::Util::Variable::isOutput ( ) const
inline

◆ isParameter()

bool MicroModelica::Util::Variable::isParameter ( ) const
inline

Definition at line 103 of file symbol_table.hpp.

Referenced by MicroModelica::Generator::Macros::initialize(), and isEqType().

◆ isScalar()

bool MicroModelica::Util::Variable::isScalar ( ) const
inline

Definition at line 131 of file symbol_table.hpp.

◆ isState()

bool MicroModelica::Util::Variable::isState ( ) const
inline

◆ isString()

bool MicroModelica::Util::Variable::isString ( ) const
inline

Definition at line 114 of file symbol_table.hpp.

◆ isTime()

bool MicroModelica::Util::Variable::isTime ( ) const
inline

Definition at line 118 of file symbol_table.hpp.

References _hasAssigment.

◆ isUnknown()

bool MicroModelica::Util::Variable::isUnknown ( ) const
inline

Definition at line 116 of file symbol_table.hpp.

◆ modification()

AST_Modification MicroModelica::Util::Variable::modification ( )
inline

Definition at line 90 of file symbol_table.hpp.

References _hasStart.

◆ name()

string MicroModelica::Util::Variable::name ( ) const
inline

Definition at line 127 of file symbol_table.hpp.

Referenced by MicroModelica::Generator::Macros::initialize().

◆ offset()

int MicroModelica::Util::Variable::offset ( ) const
inline

◆ operator!=()

bool MicroModelica::Util::Variable::operator!= ( const Variable other)

Definition at line 143 of file symbol_table.cpp.

◆ operator=()

Variable & MicroModelica::Util::Variable::operator= ( const Variable other)

Definition at line 120 of file symbol_table.cpp.

◆ operator==()

bool MicroModelica::Util::Variable::operator== ( const Variable other)

Definition at line 141 of file symbol_table.cpp.

◆ print()

string MicroModelica::Util::Variable::print ( ) const

Definition at line 210 of file symbol_table.cpp.

Referenced by MicroModelica::Generator::Macros::initialize().

◆ processModification()

void MicroModelica::Util::Variable::processModification ( )
protected

Process the argument modification to determine the variable modifiers if any.

Note
{We don't look for errors here, if there's an error in the code, it should be detected in an earlier stage (the model checker and the intermediate code generation.}

Definition at line 151 of file symbol_table.cpp.

◆ rowSize()

unsigned int MicroModelica::Util::Variable::rowSize ( unsigned int  dim) const

◆ setBuiltIn()

void MicroModelica::Util::Variable::setBuiltIn ( )
inline

Definition at line 106 of file symbol_table.hpp.

◆ setComment()

void MicroModelica::Util::Variable::setComment ( AST_Comment  c)
inline

Definition at line 89 of file symbol_table.hpp.

References _hasAssigment.

◆ setEachModifier()

void MicroModelica::Util::Variable::setEachModifier ( bool  each)
inline

Definition at line 126 of file symbol_table.hpp.

◆ setModification()

void MicroModelica::Util::Variable::setModification ( AST_Modification  m)
inline

Definition at line 91 of file symbol_table.hpp.

References _hasEach.

◆ setName()

void MicroModelica::Util::Variable::setName ( string  name)

Definition at line 190 of file symbol_table.cpp.

◆ setOffset()

void MicroModelica::Util::Variable::setOffset ( int  offset)
inline

Definition at line 139 of file symbol_table.hpp.

◆ setParameter()

void MicroModelica::Util::Variable::setParameter ( )
inline

Definition at line 98 of file symbol_table.hpp.

◆ setRealType()

void MicroModelica::Util::Variable::setRealType ( RealType  type)
inline

Definition at line 86 of file symbol_table.hpp.

References _value.

◆ setState()

void MicroModelica::Util::Variable::setState ( )
inline

Definition at line 115 of file symbol_table.hpp.

◆ setType()

void MicroModelica::Util::Variable::setType ( Type  t)
inline

Definition at line 97 of file symbol_table.hpp.

References isArray().

Here is the call graph for this function:

◆ setUnknown()

void MicroModelica::Util::Variable::setUnknown ( )
inline

Definition at line 117 of file symbol_table.hpp.

◆ setValue()

void MicroModelica::Util::Variable::setValue ( int  val)
inline

Definition at line 120 of file symbol_table.hpp.

◆ size() [1/2]

unsigned int MicroModelica::Util::Variable::size ( )

◆ size() [2/2]

unsigned int MicroModelica::Util::Variable::size ( int  dim) const
inline

Definition at line 133 of file symbol_table.hpp.

◆ type()

Type MicroModelica::Util::Variable::type ( )
inline

Definition at line 96 of file symbol_table.hpp.

References _isArray.

◆ typePrefix()

AST_TypePrefix MicroModelica::Util::Variable::typePrefix ( ) const
inline

Definition at line 87 of file symbol_table.hpp.

References _value.

◆ unsetAssignment()

void MicroModelica::Util::Variable::unsetAssignment ( )
inlineprotected

Definition at line 152 of file symbol_table.hpp.

◆ unsetStartEach()

void MicroModelica::Util::Variable::unsetStartEach ( )
inlineprotected

Definition at line 153 of file symbol_table.hpp.

◆ value()

int MicroModelica::Util::Variable::value ( ) const
inline

Definition at line 121 of file symbol_table.hpp.

Friends And Related Function Documentation

◆ operator<< [1/2]

ostream& operator<< ( ostream &  os,
const Variable e 
)
friend

Definition at line 234 of file symbol_table.cpp.

◆ operator<< [2/2]

std::ostream& operator<< ( std::ostream &  out,
const Variable v 
)
friend

Member Data Documentation

◆ _builtin

bool MicroModelica::Util::Variable::_builtin
protected

Definition at line 165 of file symbol_table.hpp.

◆ _comm

AST_Comment MicroModelica::Util::Variable::_comm
protected

Definition at line 164 of file symbol_table.hpp.

◆ _exp

AST_Expression MicroModelica::Util::Variable::_exp
protected

Definition at line 168 of file symbol_table.hpp.

◆ _hasAssigment

bool MicroModelica::Util::Variable::_hasAssigment
protected

Definition at line 171 of file symbol_table.hpp.

Referenced by isTime(), and setComment().

◆ _hasEach

bool MicroModelica::Util::Variable::_hasEach
protected

Definition at line 170 of file symbol_table.hpp.

Referenced by setModification().

◆ _hasOffset

bool MicroModelica::Util::Variable::_hasOffset
protected

Definition at line 174 of file symbol_table.hpp.

Referenced by isDiscrete().

◆ _hasStart

bool MicroModelica::Util::Variable::_hasStart
protected

Definition at line 169 of file symbol_table.hpp.

Referenced by modification().

◆ _isArray

bool MicroModelica::Util::Variable::_isArray
protected

Definition at line 173 of file symbol_table.hpp.

Referenced by type().

◆ _m

AST_Modification MicroModelica::Util::Variable::_m
protected

Definition at line 163 of file symbol_table.hpp.

◆ _name

string MicroModelica::Util::Variable::_name
protected

Definition at line 172 of file symbol_table.hpp.

◆ _offset

int MicroModelica::Util::Variable::_offset
protected

Definition at line 175 of file symbol_table.hpp.

Referenced by isForType().

◆ _realType

RealType MicroModelica::Util::Variable::_realType
protected

Definition at line 176 of file symbol_table.hpp.

◆ _size

vector<int> MicroModelica::Util::Variable::_size
protected

Definition at line 166 of file symbol_table.hpp.

◆ _t

Type MicroModelica::Util::Variable::_t
protected

Definition at line 161 of file symbol_table.hpp.

◆ _tp

AST_TypePrefix MicroModelica::Util::Variable::_tp
protected

Definition at line 162 of file symbol_table.hpp.

◆ _unknown

bool MicroModelica::Util::Variable::_unknown
protected

Definition at line 160 of file symbol_table.hpp.

◆ _value

int MicroModelica::Util::Variable::_value
protected

Definition at line 167 of file symbol_table.hpp.

Referenced by setRealType(), and typePrefix().


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