Browse Source

Added missing function declaration in CUDD'c C++ interface. Started on an iterator for DD valuations.

Former-commit-id: a97ccdec3d
tempestpy_adaptions
dehnert 11 years ago
parent
commit
5fe7ffe51a
  1. 6
      resources/3rdparty/cudd-2.5.0/src/obj/cuddObj.cc
  2. 1
      resources/3rdparty/cudd-2.5.0/src/obj/cuddObj.hh
  3. 1
      src/storage/dd/CuddDd.cpp
  4. 2
      src/storage/dd/CuddDd.h
  5. 33
      src/storage/dd/CuddDdForwardIterator.cpp
  6. 46
      src/storage/dd/CuddDdForwardIterator.h
  7. 13
      src/storage/dd/DdForwardIterator.h

6
resources/3rdparty/cudd-2.5.0/src/obj/cuddObj.cc

@ -5277,14 +5277,14 @@ ABDD::FirstCube(
int
NextCube(
ABDD::NextCube(
DdGen * gen,
int ** cube,
CUDD_VALUE_TYPE * value)
CUDD_VALUE_TYPE * value) const
{
return Cudd_NextCube(gen, cube, value);
} // NextCube
} // ABDD::NextCube
BDD

1
resources/3rdparty/cudd-2.5.0/src/obj/cuddObj.hh

@ -192,6 +192,7 @@ public:
const;
int CountLeaves() const;
DdGen * FirstCube(int ** cube, CUDD_VALUE_TYPE * value) const;
int NextCube(DdGen * gen, int ** cube, CUDD_VALUE_TYPE * value) const;
double Density(int nvars) const;
}; // ABDD

1
src/storage/dd/CuddDd.cpp

@ -1,3 +1,4 @@
#include <cstring>
#include <algorithm>
#include "src/storage/dd/CuddDd.h"

2
src/storage/dd/CuddDd.h

@ -20,7 +20,7 @@ namespace storm {
template<>
class Dd<DdType::CUDD> {
public:
// Declare the DdManager class as friend so it can access the internals of a DD.
// Declare the DdManager and DdIterator class as friend so it can access the internals of a DD.
friend class DdManager<DdType::CUDD>;
// Instantiate all copy/move constructors/assignments with the default implementation.

33
src/storage/dd/CuddDdForwardIterator.cpp

@ -0,0 +1,33 @@
#include "src/storage/dd/CuddDdForwardIterator.h"
namespace storm {
namespace dd {
DdForwardIterator<DdType::CUDD>::DdForwardIterator(std::shared_ptr<DdManager<DdType::CUDD>> ddManager, ADD cuddAdd) : ddManager(ddManager), value(0), cube(nullptr), cuddAdd(cuddAdd), isAtEnd(false), generator(nullptr) {
// Start by getting the first cube.
this->generator = this->cuddAdd.FirstCube(&cube, &value);
// If the generator is already empty, we set the corresponding flag.
this->isAtEnd = Cudd_IsGenEmpty(generator);
}
DdForwardIterator<DdType::CUDD>& DdForwardIterator<DdType::CUDD>::operator++() {
// TODO: eliminate current
}
bool DdForwardIterator<DdType::CUDD>::operator==(DdForwardIterator<DdType::CUDD> const& other) const {
if (this->isAtEnd && other.isAtEnd) {
return true;
} else {
return this->cuddAdd == other.cuddAdd;
}
}
bool DdForwardIterator<DdType::CUDD>::operator!=(DdForwardIterator<DdType::CUDD> const& other) const {
return !(*this == other);
}
storm::expressions::SimpleValuation DdForwardIterator<DdType::CUDD>::operator*() const {
// FIXME: construct valuation and return it.
}
}
}

46
src/storage/dd/CuddDdForwardIterator.h

@ -0,0 +1,46 @@
#ifndef STORM_STORAGE_DD_CUDDDDFORWARDITERATOR_H_
#define STORM_STORAGE_DD_CUDDDDFORWARDITERATOR_H_
#include <memory>
#include <cstdint>
#include "src/storage/dd/DdForwardIterator.h"
#include "src/storage/expressions/SimpleValuation.h"
// Include the C++-interface of CUDD.
#include "cuddObj.hh"
namespace storm {
namespace dd {
template<>
class DdForwardIterator<DdType::CUDD> {
public:
// Forward-declare the DdManager class.
template<DdType Type> class DdManager;
DdForwardIterator<DdType::CUDD>& operator++();
storm::expressions::SimpleValuation operator*() const;
bool operator==(DdForwardIterator<DdType::CUDD> const& other) const;
bool operator!=(DdForwardIterator<DdType::CUDD> const& other) const;
private:
DdForwardIterator(std::shared_ptr<DdManager<DdType::CUDD>> ddManager, ADD cuddAdd, std::vector<ADD> const& relevantDdVariables);
std::shared_ptr<DdManager<DdType::CUDD>> ddManager;
double value;
int* cube;
uint_fast64_t positionInCube;
ADD cuddAdd;
bool isAtEnd;
DdGen* generator;
};
}
}
#endif /* STORM_STORAGE_DD_CUDDDDFORWARDITERATOR_H_ */

13
src/storage/dd/DdForwardIterator.h

@ -0,0 +1,13 @@
#ifndef STORM_STORAGE_DD_DDFORWARDITERATOR_H_
#define STORM_STORAGE_DD_DDFORWARDITERATOR_H_
#include "src/storage/dd/DdType.h"
namespace storm {
namespace dd {
// Declare DdIterator class so we can then specialize it for the different DD types.
template<DdType Type> class DdForwardIterator;
}
}
#endif /* STORM_STORAGE_DD_DDFORWARDITERATOR_H_ */
Loading…
Cancel
Save