Browse Source
Added visitor pattern for LTL formulas
Added visitor pattern for LTL formulas
(which hopefully will make the implementation of an adapter to ltl2dstar easier)main
13 changed files with 339 additions and 0 deletions
-
30src/formula/Ltl/AbstractLtlFormula.h
-
22src/formula/Ltl/And.h
-
23src/formula/Ltl/Ap.h
-
22src/formula/Ltl/BoundedEventually.h
-
22src/formula/Ltl/BoundedUntil.h
-
22src/formula/Ltl/Eventually.h
-
22src/formula/Ltl/Globally.h
-
22src/formula/Ltl/Next.h
-
22src/formula/Ltl/Not.h
-
22src/formula/Ltl/Or.h
-
22src/formula/Ltl/Until.h
-
16src/formula/Ltl/visitor/AbstractLtlFormulaVisitor.cpp
-
72src/formula/Ltl/visitor/AbstractLtlFormulaVisitor.h
@ -0,0 +1,16 @@ |
|||
/*
|
|||
* AbstractLtlFormulaVisitor.cpp |
|||
* |
|||
* Created on: 29.05.2013 |
|||
* Author: thomas |
|||
*/ |
|||
|
|||
#include "AbstractLtlFormulaVisitor.h"
|
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace visitor { |
|||
|
|||
} /* namespace visitor */ |
|||
} /* namespace property */ |
|||
} /* namespace storm */ |
@ -0,0 +1,72 @@ |
|||
/* |
|||
* AbstractLtlFormulaVisitor.h |
|||
* |
|||
* Created on: 29.05.2013 |
|||
* Author: thomas |
|||
*/ |
|||
|
|||
#ifndef STORM_PROPERTY_LTL_VISITOR_ABSTRACTLTLFORMULAVISITOR_H_ |
|||
#define STORM_PROPERTY_LTL_VISITOR_ABSTRACTLTLFORMULAVISITOR_H_ |
|||
|
|||
// Forward declaration of visitor |
|||
namespace storm { |
|||
namespace property { |
|||
namespace ltl { |
|||
namespace visitor { |
|||
|
|||
template <class T> |
|||
class AbstractLtlFormulaVisitor; |
|||
|
|||
} /* namespace visitor */ |
|||
} |
|||
} |
|||
} |
|||
|
|||
#include "../AbstractLtlFormula.h" |
|||
#include "log4cplus/logger.h" |
|||
#include "log4cplus/loggingmacros.h" |
|||
|
|||
#include <typeinfo> |
|||
|
|||
extern log4cplus::Logger logger; |
|||
|
|||
namespace storm { |
|||
namespace property { |
|||
namespace ltl { |
|||
namespace visitor { |
|||
|
|||
template <class T> |
|||
class AbstractLtlFormulaVisitor { |
|||
public: |
|||
virtual ~AbstractLtlFormulaVisitor() { |
|||
// TODO Auto-generated destructor stub |
|||
} |
|||
|
|||
|
|||
/*! |
|||
* Returns a pointer to the model checker object that is of the requested type as given by the template parameters. |
|||
* @returns A pointer to the model checker object that is of the requested type as given by the template parameters. |
|||
* If the model checker is not of the requested type, type casting will fail and result in an exception. |
|||
*/ |
|||
template <template <class Type> class Target> |
|||
const Target<T>* as() const { |
|||
try { |
|||
const Target<T>* target = dynamic_cast<const Target<T>*>(this); |
|||
return target; |
|||
} catch (std::bad_cast& bc) { |
|||
LOG4CPLUS_ERROR(logger, "Bad cast: tried to cast " << typeid(*this).name() << " to " << typeid(Target<T>).name() << "."); |
|||
throw bc; |
|||
} |
|||
return nullptr; |
|||
} |
|||
|
|||
void visit(storm::property::ltl::AbstractLtlFormula<T> const& formula) { |
|||
formula.visit(*this); |
|||
} |
|||
}; |
|||
|
|||
} /* namespace visitor */ |
|||
} /* namespace ltl*/ |
|||
} /* namespace property */ |
|||
} /* namespace storm */ |
|||
#endif /* STORM_PROPERTY_LTL_VISITOR_ABSTRACTLTLFORMULAVISITOR_H_ */ |
Write
Preview
Loading…
Cancel
Save
Reference in new issue