8 #ifndef __DIADES__PETRI__VDD__HH__ 9 #define __DIADES__PETRI__VDD__HH__ 23 class VddInvalid :
public runtime_error,
public domain_error {
28 VddInvalid(
const string& whatArg) : runtime_error(whatArg), domain_error(whatArg){
29 cerr <<
"EXCEPTION Vdd -> " << whatArg << endl;
60 Vdd():_place(),_tokens(0),_eq(0),_sup(0),_id(0),_factory(0){}
65 Vdd(
VddFactory * factory):_place(),_tokens(0),_eq(0),_sup(0),_id(0),_factory(factory){}
78 _place(p), _tokens(tokens), _eq(eq), _sup(sup), _id(id), _factory(factory){
95 unsigned id()
const {
return _id; }
113 const Vdd *
eq()
const {
return _eq; }
127 int getCardinality()
const;
133 bool isEmpty()
const;
141 bool holds(
Place p,
int tokens)
const;
158 return (tokens() >= 0) && (id() > 0) && (place().valid()) && ( (eq()->isEmpty()) || (eq()->isNull()) || ( eq()->valid() && (eq()->place() > place()) ))
159 && ( (sup()->isEmpty()) || (sup()->isNull()) || ( sup()->valid() && (sup()->place() == place()) && (sup()->tokens() > tokens()) ));
174 vector< vector< unordered_map<unsigned, unordered_map <unsigned, Vdd *> > > >
_vdd;
187 _vdd(net.numberOfPlaces()+1),
190 _table[0] =
new Vdd(
this);
191 _table[1] =
new Vdd(
this);
215 const Vdd * getVdd(
Place place,
int tokens,
const Vdd * eq,
const Vdd * sup);
223 int getCardinality(
const Vdd * vdd);
233 bool holds(
const Vdd * vdd,
Place p,
int tokens)
const;
242 const Vdd * getVdd(
const Vdd * vdd,
const Zsl * zsl);
252 const Vdd * getVdd(
const set<Place> & marking);
259 bool isEmpty(
const Vdd * vdd)
const {
return vdd == _empty; }
267 bool isNull(
const Vdd * vdd)
const {
return vdd == _null; }
276 const Vdd *
getVdd(
unsigned id) {
if(
id >= _table.size()) {
return 0; }
return _table[id]; }
285 const Vdd * addZslToVdd(
const Vdd * vdd,
const Zsl * zsl);
293 const Vdd * getFirable(
const Vdd * vdd,
const Zsl * zsl);
302 const Vdd * getUnion(
const Vdd * vdd1,
const Vdd * vdd2);
310 const Vdd * getIntersection(
const Vdd * vdd1,
const Vdd * vdd2);
323 void printDot(
const string & fileName)
const;
329 void printDot(
const Vdd * vdd,
const string & fileName)
const;
bool isNull(const Vdd *vdd) const
VddFactory(const Net &net)
const Net * owner() const
VddInvalid(const string &whatArg)
bool isEmpty(const Vdd *vdd) const
Diades::Graph::Node Place
const Vdd * empty() const
const Vdd * getVdd(unsigned id)
vector< vector< unordered_map< unsigned, unordered_map< unsigned, Vdd * > > > > _vdd
#define require(Exception, expr, message)
Namespace of the Diades project.
Vdd(Place p, int tokens, const Vdd *eq, const Vdd *sup, unsigned id, VddFactory *factory)
void printDot(ostream &os, const T &value)