52 void execute(std::function<
void()>
const &f)
const {
53 internalManager.execute(f);
62 nameToIndex[name] = nextFreeVariableIndex;
63 indexToName[nextFreeVariableIndex] = name;
64 sylvan::Bdd::bddVar(nextFreeVariableIndex);
65 return nextFreeVariableIndex++;
74 return sylvan::Bdd::bddVar(nameToIndex.at(name));
85 return !sylvan::Bdd::bddVar(nameToIndex.at(name));
94 return sylvan::Bdd::bddVar(index);
105 return !sylvan::Bdd::bddVar(index);
113 return sylvan::Bdd::bddOne();
121 return sylvan::Bdd::bddZero();
129 return nameToIndex.at(name);
136 std::string
getName(uint32_t
const index)
const {
137 return indexToName.at(index);
150 FILE *filePointer = fopen(filename.c_str(),
"w+");
153 if (filePointer ==
nullptr) {
156 bdd.PrintDot(filePointer);
158 std::ofstream filestream;
160 filestream <<
"// Mapping from BDD nodes to DFT BEs as follows: \n";
161 for (
auto const &[index, name] : indexToName) {
162 filestream <<
"// " << index <<
" -> " << name <<
'\n';
170 uint32_t nextFreeVariableIndex{0};
172 std::map<std::string, uint32_t> nameToIndex{};
173 std::map<uint32_t, std::string> indexToName{};
Simple Manager for Sylvan.
sylvan::Bdd getNegativeLiteral(std::string const name) const
uint32_t createVariable(std::string const name)
Creates a variable with a unique name.
void execute(std::function< void()> const &f) const
All code that manipulates DDs shall be called through this function.
std::string getName(uint32_t const index) const
SylvanBddManager & operator=(SylvanBddManager &&)=default
sylvan::Bdd getPositiveLiteral(uint32_t const index) const
SylvanBddManager(SylvanBddManager &&)=default
sylvan::Bdd getPositiveLiteral(std::string const name) const
sylvan::Bdd getNegativeLiteral(uint32_t const index) const
SylvanBddManager()=default
Initializes Sylvan.
~SylvanBddManager()=default
Destroys Sylvan.
void exportBddToDot(sylvan::Bdd const &bdd, std::string const &filename) const
Exports the given Bdd to a file in the dot format.
SylvanBddManager(SylvanBddManager const &)=delete
uint32_t getIndex(std::string const name) const
#define STORM_LOG_ERROR(message)
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.