#pragma once #include #include #include #include #include #include "src/storage/jani/Composition.h" namespace storm { namespace jani { class SynchronizationVector { public: SynchronizationVector(std::vector const& input, std::string const& output); std::size_t size() const; std::vector const& getInput() const; static std::string const& getNoActionInput(); std::string const& getInput(uint64_t index) const; std::string const& getOutput() const; static bool isNoActionInput(std::string const& action); /*! * Retrieves the action name that is the last participating action before the given input index. If there is * no such action none is returned. */ boost::optional getPrecedingParticipatingAction(uint64_t index) const; /*! * Retrieves the position with the last participating action before the given input index. If there is * no such action none is returned. */ boost::optional getPositionOfPrecedingParticipatingAction(uint64_t index) const; private: // A marker that can be used as one of the inputs. The semantics is that no action of the corresponding // automaton takes part in the synchronization. static const std::string noAction; /// The input to the synchronization. std::vector input; /// The output of the synchronization. std::string output; }; std::ostream& operator<<(std::ostream& stream, SynchronizationVector const& synchronizationVector); class ParallelComposition : public Composition { public: /*! * Creates a parallel composition of the subcompositions and the provided synchronization vectors. */ ParallelComposition(std::vector> const& subcompositions, std::vector const& synchronizationVectors); /*! * Creates a parallel composition of the subcompositions over the provided synchronization alphabet. */ ParallelComposition(std::vector> const& subcompositions, std::set const& synchronizationAlphabet); /*! * Creates a parallel composition of the subcompositions over the provided synchronization alphabet. */ ParallelComposition(std::shared_ptr const& leftSubcomposition, std::shared_ptr const& rightSubcomposition, std::set const& synchronizationAlphabet); /*! * Retrieves the subcomposition with the given index. */ Composition const& getSubcomposition(uint64_t index) const; /*! * Retrieves the subcompositions of the parallel composition. */ std::vector> const& getSubcompositions() const; /*! * Retrieves the number of subcompositions of this parallel composition. */ uint64_t getNumberOfSubcompositions() const; /*! * Retrieves the synchronization vector with the given index. */ SynchronizationVector const& getSynchronizationVector(uint64_t index) const; /*! * Retrieves the synchronization vectors of the parallel composition. */ std::vector const& getSynchronizationVectors() const; /*! * Retrieves the number of synchronization vectors. */ std::size_t getNumberOfSynchronizationVectors() const; virtual boost::any accept(CompositionVisitor& visitor, boost::any const& data) const override; virtual void write(std::ostream& stream) const override; private: /*! * Checks the synchronization vectors for validity. */ void checkSynchronizationVectors() const; /// The subcompositions. std::vector> subcompositions; /// The synchronization vectors of the parallel composition. std::vector synchronizationVectors; }; } }