1 #ifndef __DIADES__ALTARICA__ALTARICAMODEL__HH 2 #define __DIADES__ALTARICA__ALTARICAMODEL__HH 163 static string typeName() {
return "Diades::Altarica::AltaricaModel"; }
186 ConstantDictionary::const_iterator it = _constantDictionary.find(name);
187 if(it != _constantDictionary.end())
259 return this == &model;
271 return !(model==(*this));
336 throw(
Exception(
"getStructureType failure",e));
359 throw(
Exception(
"getArrayType failure",e));
396 return _valueFactory.
getValue(value);
400 throw(
Exception(
"getValue (identifier) failure",e));
414 return _valueFactory.
getValue(value);
426 return _valueFactory.
getValue(value);
441 return _valueFactory.
getValue(array);
445 throw(
Exception(
"getValue (array) failure",e));
464 return _valueFactory.
getValue(structure);
468 throw(
Exception(
"getValue (structure) failure",e));
598 const vector<Domain::ConstReference> &
domains()
const 626 const set<Identifier> & attributes,
635 throw(
Exception(
"getVariableDecl failure",e));
656 const set<Identifier> & attributes,
662 return _varDeclFactory.
getVariableDecl(label,domain,type,attributes,scope);
666 throw(
Exception(
"getVariableDecl failure",e));
714 _mainNodeDecl.clear();
727 _mainNodeDecl.clear();
729 _eventFactory.
init();
730 _expressionFactory.
init();
784 return _nodeDecls.size();
794 return _nodeDecls.begin();
803 return _nodeDecls.end();
896 const ExprVector & expressions)
972 always_require(Exception,owner.
owner() == *
this,
"getEventDecl: the node declaration does belong to this model.");
984 always_require(Exception,owner.
owner() == *
this,
"getEventDecl: the node declaration does belong to this model.");
1033 return _mainVariableDecl[0];
1044 return _mainVariableDecl[0];
1058 return _mainNodeDecl[0];
1068 return _mainNodeDecl[0];
1090 always_require(Exception,!name.
str().empty(),
"getParameterDecl: the name is empty.");
NodeDeclFactory _nodeDeclFactory
const Domain & getIntegers() const
const Expression & getIdentifierExpression(const NodeDecl &node, const Identifier &id)
const Identifier & name() const
const Domain & nullDomain() const
NodeDecl & nullNodeDecl()
const Type & getIdentifier() const
An Identifier is a reference to a string (IdentifierData) that only contains alpha-numeric characters...
const AltaricaModel & owner() const
const Expression & getBinaryExpression(const NodeDecl &node, Expression::Category category, const Expression &left, const Expression &right)
#define always_require(Exception, expr, message)
const VariableDeclFactory & variableDeclFactory() const
vector< Domain::ConstReference > _globalDomains
const Expression & getListExpression(const NodeDecl &node, Cat category, const ExprVector &expressions)
const ParameterDecl & nullParameterDecl() const
NodeDeclDictionary _nodeDeclOfLabel
const Domain & nullDomain() const
const Value & getConstant(const Identifier &name) const
const Expression & getListExpression(const NodeDecl &node, Expression::Category category, const ExprVector &expressions)
void setMainNodeDecl(const Identifier &name)
NodeDeclIterator nodeDeclBegin() const
const VariableDecl & nullVariableDecl() const
const Domain & getIntegers() const
unordered_map< Identifier, Domain::ConstReference > DomainDictionary
const Expression & getIdentifierExpression(const NodeDecl &node, const Identifier &id)
const Expression & getBooleanExpression(Expression::Category category)
reference_wrapper< AltaricaModel const > ConstReference
const Type & getBoolean() const
const Type & getInteger() const
const ParameterDecl & getParameterDecl(const Identifier &name, const Domain &domain, NodeDecl &nodeDecl)
DomainFactory _domainFactory
bool containsNodeDecl(const Identifier &nodeName) const
VariableDecl & getNodeVariableDecl(const Identifier &label, set< Identifier > &attributes, VariableDecl &scope)
VariableDecl & nullVariableDecl()
const Value & getValue(const Identifier &value)
This class represents the declaration of an Event in a node declaration.
const string & str() const
const vector< Domain::ConstReference > & domains() const
const Expression & getIntegerExpression(int value)
const Type & getInteger() const
vector< NodeDecl::Reference > _mainNodeDecl
NodeDecl & mainNodeDecl()
ConstantDictionary _constantDictionary
const AltaricaModel * ConstPointer
const Value & getValue(const Value::StructureFields &structure) const
const EventDecl & nullEventDecl() const
const Value & getValue(const Value::ArrayFields &array) const
const Value & nullValue() const
const Expression & getIntegerExpression(int value)
const Type & getArrayType(const Type &itemType, unsigned size)
bool operator==(const AltaricaModel &model) const
vector< ConstReference > ArrayFields
Expression::ExprVector ExprVector
const Type & nullType() const
const Type & getBoolean() const
map< Identifier, ConstReference > StructureFields
const Type & getArrayType(const Type &type, unsigned size) const
ExpressionFactory _expressionFactory
const Expression & getUnaryExpression(const NodeDecl &node, Cat category, const Expression &expr)
ValueFactory _valueFactory
NodeDeclIterator nodeDeclEnd() const
VariableDecl & getVariableDecl(const Diades::Utils::Identifier &label, NodeDecl::VarType type, const Domain &domain, const set< Identifier > &attributes, VariableDecl &scope)
Utils::Exception< AltaricaModel > Exception
const Value & getValue(int value) const
reference_wrapper< Value const > ConstReference
const Expression & getVarExpression(const NodeDecl &node, const VariableDecl &var)
const EventDecl & nullEventDecl() const
NodeDecl & nullNodeDecl()
unsigned numberOfNodeDecls() const
const VariableDecl & mainVariableDecl() const
const Expression & getIteExpression(const NodeDecl &node, const Expression &ifE, const Expression &thenE, const Expression &elseE)
EventDecl & nullEventDecl()
File that declares an ExpressionFactory.
const VariableDecl & nullVariableDecl() const
const Type & getIdentifier() const
const Domain & getDomain(const Identifier &name, NodeDecl &node)
const Expression & getBooleanExpression(Cat category)
map< Identifier, ConstReference > StructureFields
const Expression & getIteExpression(const NodeDecl &node, const Expression &ifE, const Expression &thenE, const Expression &elseE)
const Expression & getBinaryExpression(const NodeDecl &node, Cat category, const Expression &left, const Expression &right)
Namespace of the Diades project.
bool operator!=(const AltaricaModel &model) const
const Domain & getBooleans() const
const Expression & getStructExpression(const NodeDecl &node, const vector< Identifier > &identifiers, const ExprVector &expressions)
void addConstant(const Identifier &name, const Value &value)
const Domain & newDomain(const Identifier &name, const Domain &associatedDomain, NodeDecl &node)
EventDecl & getEventDecl(const NodeDecl &node, const Identifier &label)
vector< NodeDecl::Reference > NodeDecls
VariableDeclFactory _varDeclFactory
const NodeDecl & mainNodeDecl() const
ExpressionFactory::ExprVector ExprVector
VariableDecl & getNodeVariableDecl(const Identifier &id, NodeDecl &node, const set< Identifier > &attributes, VariableDecl &scope)
VariableDecl & getVariableDecl(const Identifier &label, const Domain &domain, const VariableDecl::VarType &type, const set< Identifier > &attributes, VariableDecl &scope)
const ParameterDecl & getParameterDecl(const Identifier &name, const Domain &domain, NodeDecl &node)
vector< Value::ConstReference > ValueEnumeration
enumeration of Value elements (unicity and sorting is in charge of the user)
const ParameterDecl & nullParameterDecl() const
const EventDecl & getEventDecl(const Identifier &id, const NodeDecl &owner) const
DomainDictionary _domainDictionary
NodeDecls::const_iterator NodeDeclIterator
reference_wrapper< AltaricaModel > Reference
const Value & nullValue() const
const NodeDecl & nullNodeDecl() const
VariableDecl & mainVariableDecl()
const Expression & getVarExpression(const NodeDecl &node, const VariableDecl &var)
const Domain & getBooleans() const
EventDecl & getEventDecl(const Identifier &id, NodeDecl &owner)
unordered_map< Identifier, Value::ConstReference > ConstantDictionary
const ConstantDictionary & constants() const
ParameterDeclFactory _paramDeclFactory
const Value & getValue(const Identifier &value) const
const Expression & getUnaryExpression(const NodeDecl &node, Expression::Category category, const Expression &expr)
vector< VariableDecl::Reference > _mainVariableDecl
NodeDecl & getNodeDecl(const Identifier &nodeName)
unordered_map< Identifier, NodeDecl::Reference > NodeDeclDictionary
const Expression & getStructExpression(const NodeDecl &node, const vector< Identifier > &identifiers, const ExprVector &expressions)
const Value & getValue(bool value) const
unsigned typeIndex(Domain::DomainType type) const
const Type & nullType() const
const Type & getStructureType(const Type::StructureFields &fields)
const Type & getStructureType(const Type::StructureFields &fields) const
const Expression & getCaseExpression(const NodeDecl &node, const ExprVector &choices, const ExprVector &expressions)
EventDeclFactory _eventFactory
const Expression & getCaseExpression(const NodeDecl &node, const ExprVector &choices, const ExprVector &expressions)
AltaricaModel(const Identifier &name)