root/trunk/compiler/cppAst/ast/Containers.hpp @ 2
2 | krennw | /**
|
|
*
|
|||
* OOAS Compiler - C++ AST
|
|||
*
|
|||
* Copyright 2015, AIT Austrian Institute of Technology.
|
|||
* All rights reserved.
|
|||
*
|
|||
* SEE THE "LICENSE" FILE FOR THE TERMS UNDER WHICH THIS FILE IS PROVIDED.
|
|||
*
|
|||
* If you modify the file please update the list of contributors below to in-
|
|||
* clude your name. Please also stick to the coding convention of using TABs
|
|||
* to do the basic (block-level) indentation and spaces for anything after
|
|||
* that. (Enable the display of special chars and it should be pretty obvious
|
|||
* what this means.) Also, remove all trailing whitespace.
|
|||
*
|
|||
* Contributors:
|
|||
* Willibald Krenn (AIT)
|
|||
* Stephan Zimmerer (AIT)
|
|||
* Christoph Czurda (AIT)
|
|||
*
|
|||
*/
|
|||
#pragma once
|
|||
#include <ast/identifiers/ParameterIdentifier.hpp>
|
|||
#include <ast/SymbolTable.hpp>
|
|||
#include <base/TiresiasObject.hpp>
|
|||
#include <ast/types/Type.hpp>
|
|||
#include <ast/statements/Statement.hpp>
|
|||
#include <deque>
|
|||
namespace Ast {
|
|||
/*
|
|||
* General list based on std::deque, also inherits from
|
|||
* TireaisObject.
|
|||
*/
|
|||
template<class T>
|
|||
class TiresiasList
|
|||
: public std::deque<T>
|
|||
, public Base::TiresiasObject
|
|||
{
|
|||
protected:
|
|||
// define a default constructor
|
|||
TiresiasList<T>() {}
|
|||
// define a copy constructor that really makes a copy
|
|||
TiresiasList<T>(const TiresiasList<T>& toCopy) {
|
|||
this->insert(this->begin(), toCopy.begin(), toCopy.end());
|
|||
}
|
|||
public:
|
|||
// define a move assignment operator that moves the lists contents
|
|||
TiresiasList<T>* operator= (TiresiasList<T>&& move) {
|
|||
this->insert(this->begin(), std::make_move_iterator(move.begin()), std::make_move_iterator(move.end()));
|
|||
return this;
|
|||
}
|
|||
};
|
|||
/*
|
|||
* ParameterList class.
|
|||
*/
|
|||
class ParameterList
|
|||
: public TiresiasList<ParameterIdentifier*>
|
|||
{
|
|||
protected:
|
|||
using TiresiasList<ParameterIdentifier*>::TiresiasList;
|
|||
friend class Ast;
|
|||
};
|
|||
/*
|
|||
* TypeList class
|
|||
*/
|
|||
class TypeList
|
|||
: public TiresiasList<Type*>
|
|||
{
|
|||
protected:
|
|||
using TiresiasList<Type*>::TiresiasList;
|
|||
friend class Ast;
|
|||
};
|
|||
/*
|
|||
* ExpressionList class
|
|||
*/
|
|||
class Expression; // forward
|
|||
class ExpressionList
|
|||
: public TiresiasList<Expression*>
|
|||
{
|
|||
protected:
|
|||
using TiresiasList<Expression*>::TiresiasList;
|
|||
friend class Ast;
|
|||
};
|
|||
/*
|
|||
* StatementList class
|
|||
*/
|
|||
class StatementList
|
|||
: public TiresiasList<Statement*>
|
|||
{
|
|||
protected:
|
|||
using TiresiasList<Statement*>::TiresiasList;
|
|||
friend class Ast;
|
|||
};
|
|||
/*
|
|||
* IdentifierList class
|
|||
*/
|
|||
class IdentifierList
|
|||
: public TiresiasList<Identifier*>
|
|||
{
|
|||
protected:
|
|||
using TiresiasList<Identifier*>::TiresiasList;
|
|||
friend class Ast;
|
|||
};
|
|||
/*
|
|||
* FunctionIdentifierList class
|
|||
*/
|
|||
class FunctionIdentifier; // forward
|
|||
class FunctionIdentifierList
|
|||
: public TiresiasList<FunctionIdentifier*>
|
|||
{
|
|||
protected:
|
|||
using TiresiasList<FunctionIdentifier*>::TiresiasList;
|
|||
friend class Ast;
|
|||
};
|
|||
/*
|
|||
* ActionSystemInstanceList class
|
|||
*/
|
|||
class ActionSystemInstance; // forward
|
|||
class ActionSystemInstanceList
|
|||
: public TiresiasList<ActionSystemInstance*>
|
|||
{
|
|||
protected:
|
|||
using TiresiasList<ActionSystemInstance*>::TiresiasList;
|
|||
friend class Ast;
|
|||
};
|
|||
}
|
|||
#include <ast/types/ActionSystemType.hpp>
|
|||
#include <ast/expressions/Expression.hpp>
|
|||
#include <ast/identifiers/FunctionIdentifier.hpp>
|