Introduced consistent aliases for vector types.

This commit is contained in:
Patrick Lühne 2016-05-22 14:24:38 +02:00
parent 90dfa302a9
commit c13e3539f2
18 changed files with 75 additions and 35 deletions

View File

@ -2,6 +2,7 @@
#define __SAS__ASSIGNED_VARIABLE_H #define __SAS__ASSIGNED_VARIABLE_H
#include <iosfwd> #include <iosfwd>
#include <vector>
#include <plasp/sas/Value.h> #include <plasp/sas/Value.h>
#include <plasp/sas/Variable.h> #include <plasp/sas/Variable.h>
@ -17,10 +18,15 @@ namespace sas
// //
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
class AssignedVariable;
using AssignedVariables = std::vector<AssignedVariable>;
////////////////////////////////////////////////////////////////////////////////////////////////////
class AssignedVariable class AssignedVariable
{ {
public: public:
static AssignedVariable fromSAS(std::istream &istream, const std::vector<Variable> &variables); static AssignedVariable fromSAS(std::istream &istream, const Variables &variables);
static AssignedVariable fromSAS(std::istream &istream, const Variable &variable); static AssignedVariable fromSAS(std::istream &istream, const Variable &variable);
public: public:

View File

@ -17,10 +17,15 @@ namespace sas
// //
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
struct AxiomRule;
using AxiomRules = std::vector<AxiomRule>;
////////////////////////////////////////////////////////////////////////////////////////////////////
struct AxiomRule struct AxiomRule
{ {
using Condition = AssignedVariable; using Condition = AssignedVariable;
using Conditions = std::vector<Condition>; using Conditions = AssignedVariables;
Conditions conditions; Conditions conditions;
Condition postcondition; Condition postcondition;

View File

@ -33,12 +33,12 @@ class Description
public: public:
bool usesActionCosts() const; bool usesActionCosts() const;
const std::vector<Variable> &variables() const; const Variables &variables() const;
const std::vector<MutexGroup> &mutexGroups() const; const MutexGroups &mutexGroups() const;
const InitialState &initialState() const; const InitialState &initialState() const;
const Goal &goal() const; const Goal &goal() const;
const std::vector<Operator> &operators() const; const Operators &operators() const;
const std::vector<AxiomRule> &axiomRules() const; const AxiomRules &axiomRules() const;
void print(std::ostream &ostream) const; void print(std::ostream &ostream) const;
@ -56,12 +56,12 @@ class Description
bool m_usesActionCosts; bool m_usesActionCosts;
std::vector<Variable> m_variables; Variables m_variables;
std::vector<MutexGroup> m_mutexGroups; MutexGroups m_mutexGroups;
std::unique_ptr<InitialState> m_initialState; std::unique_ptr<InitialState> m_initialState;
std::unique_ptr<Goal> m_goal; std::unique_ptr<Goal> m_goal;
std::vector<Operator> m_operators; Operators m_operators;
std::vector<AxiomRule> m_axiomRules; AxiomRules m_axiomRules;
}; };
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -3,6 +3,7 @@
#include <vector> #include <vector>
#include <plasp/sas/AssignedVariable.h>
#include <plasp/sas/Variable.h> #include <plasp/sas/Variable.h>
namespace plasp namespace plasp
@ -16,10 +17,15 @@ namespace sas
// //
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
struct Effect;
using Effects = std::vector<Effect>;
////////////////////////////////////////////////////////////////////////////////////////////////////
struct Effect struct Effect
{ {
using Condition = AssignedVariable; using Condition = AssignedVariable;
using Conditions = std::vector<Condition>; using Conditions = AssignedVariables;
Conditions conditions; Conditions conditions;
Condition postcondition; Condition postcondition;

View File

@ -18,9 +18,9 @@ class Goal
{ {
public: public:
using Fact = AssignedVariable; using Fact = AssignedVariable;
using Facts = std::vector<Fact>; using Facts = AssignedVariables;
static Goal fromSAS(std::istream &istream, const std::vector<Variable> &variables); static Goal fromSAS(std::istream &istream, const Variables &variables);
public: public:
const Facts &facts() const; const Facts &facts() const;

View File

@ -18,9 +18,9 @@ class InitialState
{ {
public: public:
using Fact = AssignedVariable; using Fact = AssignedVariable;
using Facts = std::vector<Fact>; using Facts = AssignedVariables;
static InitialState fromSAS(std::istream &istream, const std::vector<Variable> &variables); static InitialState fromSAS(std::istream &istream, const Variables &variables);
public: public:
const Facts &facts() const; const Facts &facts() const;

View File

@ -1,6 +1,8 @@
#ifndef __SAS__MUTEX_GROUP_H #ifndef __SAS__MUTEX_GROUP_H
#define __SAS__MUTEX_GROUP_H #define __SAS__MUTEX_GROUP_H
#include <vector>
#include <plasp/sas/AssignedVariable.h> #include <plasp/sas/AssignedVariable.h>
namespace plasp namespace plasp
@ -14,13 +16,18 @@ namespace sas
// //
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
class MutexGroup;
using MutexGroups = std::vector<MutexGroup>;
////////////////////////////////////////////////////////////////////////////////////////////////////
class MutexGroup class MutexGroup
{ {
public: public:
using Fact = AssignedVariable; using Fact = AssignedVariable;
using Facts = std::vector<Fact>; using Facts = AssignedVariables;
static MutexGroup fromSAS(std::istream &istream, const std::vector<Variable> &variables); static MutexGroup fromSAS(std::istream &istream, const Variables &variables);
public: public:
const Facts &facts() const; const Facts &facts() const;

View File

@ -4,6 +4,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <plasp/sas/AssignedVariable.h>
#include <plasp/sas/Effect.h> #include <plasp/sas/Effect.h>
#include <plasp/sas/Predicate.h> #include <plasp/sas/Predicate.h>
#include <plasp/sas/Variable.h> #include <plasp/sas/Variable.h>
@ -19,11 +20,15 @@ namespace sas
// //
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
struct Operator;
using Operators = std::vector<Operator>;
////////////////////////////////////////////////////////////////////////////////////////////////////
struct Operator struct Operator
{ {
using Condition = AssignedVariable; using Condition = AssignedVariable;
using Conditions = std::vector<Condition>; using Conditions = AssignedVariables;
using Effects = std::vector<Effect>;
Predicate predicate; Predicate predicate;
Conditions preconditions; Conditions preconditions;

View File

@ -19,6 +19,11 @@ class Variable;
// //
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
struct Value;
using Values = std::vector<Value>;
////////////////////////////////////////////////////////////////////////////////////////////////////
struct Value struct Value
{ {
public: public:
@ -53,10 +58,6 @@ struct Value
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
using Values = std::vector<Value>;
////////////////////////////////////////////////////////////////////////////////////////////////////
} }
} }

View File

@ -18,11 +18,16 @@ namespace sas
// //
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
class Variable;
using Variables = std::vector<Variable>;
////////////////////////////////////////////////////////////////////////////////////////////////////
class Variable class Variable
{ {
public: public:
static Variable fromSAS(std::istream &istream); static Variable fromSAS(std::istream &istream);
static const Variable &referenceFromSAS(std::istream &istream, const std::vector<Variable> &variables); static const Variable &referenceFromSAS(std::istream &istream, const Variables &variables);
public: public:
const std::string &name() const; const std::string &name() const;

View File

@ -17,10 +17,15 @@ namespace sas
// //
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
class VariableTransition;
using VariableTransitions = std::vector<VariableTransition>;
////////////////////////////////////////////////////////////////////////////////////////////////////
class VariableTransition class VariableTransition
{ {
public: public:
static VariableTransition fromSAS(std::istream &istream, const std::vector<Variable> &variables); static VariableTransition fromSAS(std::istream &istream, const Variables &variables);
public: public:
const Variable &variable() const; const Variable &variable() const;

View File

@ -33,7 +33,7 @@ AssignedVariable::AssignedVariable(const Variable &variable, const Value &value)
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
AssignedVariable AssignedVariable::fromSAS(std::istream &istream, const std::vector<Variable> &variables) AssignedVariable AssignedVariable::fromSAS(std::istream &istream, const Variables &variables)
{ {
AssignedVariable assignedVariable; AssignedVariable assignedVariable;

View File

@ -69,14 +69,14 @@ bool Description::usesActionCosts() const
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
const std::vector<Variable> &Description::variables() const const Variables &Description::variables() const
{ {
return m_variables; return m_variables;
} }
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
const std::vector<MutexGroup> &Description::mutexGroups() const const MutexGroups &Description::mutexGroups() const
{ {
return m_mutexGroups; return m_mutexGroups;
} }
@ -97,14 +97,14 @@ const Goal &Description::goal() const
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
const std::vector<Operator> &Description::operators() const const Operators &Description::operators() const
{ {
return m_operators; return m_operators;
} }
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
const std::vector<AxiomRule> &Description::axiomRules() const const AxiomRules &Description::axiomRules() const
{ {
return m_axiomRules; return m_axiomRules;
} }

View File

@ -15,7 +15,7 @@ namespace sas
// //
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
Goal Goal::fromSAS(std::istream &istream, const std::vector<Variable> &variables) Goal Goal::fromSAS(std::istream &istream, const Variables &variables)
{ {
Goal goal; Goal goal;

View File

@ -15,7 +15,7 @@ namespace sas
// //
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
InitialState InitialState::fromSAS(std::istream &istream, const std::vector<Variable> &variables) InitialState InitialState::fromSAS(std::istream &istream, const Variables &variables)
{ {
InitialState initialState; InitialState initialState;

View File

@ -15,7 +15,7 @@ namespace sas
// //
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
MutexGroup MutexGroup::fromSAS(std::istream &istream, const std::vector<Variable> &variables) MutexGroup MutexGroup::fromSAS(std::istream &istream, const Variables &variables)
{ {
MutexGroup mutexGroup; MutexGroup mutexGroup;

View File

@ -44,7 +44,7 @@ Variable Variable::fromSAS(std::istream &istream)
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
const Variable &Variable::referenceFromSAS(std::istream &istream, const std::vector<Variable> &variables) const Variable &Variable::referenceFromSAS(std::istream &istream, const Variables &variables)
{ {
const auto variableID = utils::parse<size_t>(istream); const auto variableID = utils::parse<size_t>(istream);

View File

@ -26,7 +26,7 @@ VariableTransition::VariableTransition()
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
VariableTransition VariableTransition::fromSAS(std::istream &istream, const std::vector<Variable> &variables) VariableTransition VariableTransition::fromSAS(std::istream &istream, const Variables &variables)
{ {
VariableTransition variableTransition; VariableTransition variableTransition;