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
#include <iosfwd>
#include <vector>
#include <plasp/sas/Value.h>
#include <plasp/sas/Variable.h>
@ -17,10 +18,15 @@ namespace sas
//
////////////////////////////////////////////////////////////////////////////////////////////////////
class AssignedVariable;
using AssignedVariables = std::vector<AssignedVariable>;
////////////////////////////////////////////////////////////////////////////////////////////////////
class AssignedVariable
{
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);
public:

View File

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

View File

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

View File

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

View File

@ -18,9 +18,9 @@ class Goal
{
public:
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:
const Facts &facts() const;

View File

@ -18,9 +18,9 @@ class InitialState
{
public:
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:
const Facts &facts() const;

View File

@ -1,6 +1,8 @@
#ifndef __SAS__MUTEX_GROUP_H
#define __SAS__MUTEX_GROUP_H
#include <vector>
#include <plasp/sas/AssignedVariable.h>
namespace plasp
@ -14,13 +16,18 @@ namespace sas
//
////////////////////////////////////////////////////////////////////////////////////////////////////
class MutexGroup;
using MutexGroups = std::vector<MutexGroup>;
////////////////////////////////////////////////////////////////////////////////////////////////////
class MutexGroup
{
public:
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:
const Facts &facts() const;

View File

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

View File

@ -19,6 +19,11 @@ class Variable;
//
////////////////////////////////////////////////////////////////////////////////////////////////////
struct Value;
using Values = std::vector<Value>;
////////////////////////////////////////////////////////////////////////////////////////////////////
struct Value
{
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
{
public:
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:
const std::string &name() const;

View File

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

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;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
const std::vector<MutexGroup> &Description::mutexGroups() const
const MutexGroups &Description::mutexGroups() const
{
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;
}
////////////////////////////////////////////////////////////////////////////////////////////////////
const std::vector<AxiomRule> &Description::axiomRules() const
const AxiomRules &Description::axiomRules() const
{
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;

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;

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;

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);

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;