3#include <boost/algorithm/string.hpp>
14template<
typename ValueType>
21 std::vector<size_t> beOrder;
33 std::vector<std::string> tokens;
34 boost::split(tokens, line, boost::is_any_of(
" \t"), boost::token_compress_on);
36 for (
auto const& token : tokens) {
38 STORM_LOG_THROW(dft.
existsName(name), storm::exceptions::InvalidArgumentException,
"No DFT element with name '" << name <<
"' exists.");
40 STORM_LOG_THROW(element->isBasicElement(), storm::exceptions::InvalidArgumentException,
"Element '" << name <<
"' is not a BE.");
41 beOrder.push_back(element->id());
45 STORM_LOG_THROW(
false, storm::exceptions::FileIoException,
"A parsing exception occurred in line " << lineNo <<
": " << exception.
what());
49 "DFT has " << dft.
nrBasicElements() <<
" BEs but " << beOrder.size() <<
" BE names where given.");
Parser for BE order from text file.
static std::vector< size_t > parseBEOrder(std::string const &filename, storm::dft::storage::DFT< ValueType > const &dft)
Parse BE order from given file.
static std::string parseName(std::string const &name)
Parse element name (strip quotation marks, etc.).
Represents a Dynamic Fault Tree.
size_t nrBasicElements() const
DFTElementCPointer getElement(size_t index) const
Get a pointer to an element in the DFT.
bool existsName(std::string const &name) const
Check whether an element with the given name exists.
size_t getIndex(std::string const &name) const
Get id for the given element name.
This class represents the base class of all exception classes.
virtual const char * what() const NOEXCEPT override
Retrieves the message associated with this exception.
#define STORM_LOG_THROW(cond, exception, message)
std::basic_istream< CharT, Traits > & getline(std::basic_istream< CharT, Traits > &input, std::basic_string< CharT, Traits, Allocator > &str)
Overloaded getline function which handles different types of newline ( and \r).
void closeFile(std::ofstream &stream)
Close the given file after writing.
void openFile(std::string const &filepath, std::ofstream &filestream, bool append=false, bool silent=false)
Open the given file for writing.