Line data Source code
1 : /*******************************************************************************
2 : * *
3 : * Cosmos:(C)oncept et (O)utils (S)tatistique pour les (Mo)deles *
4 : * (S)tochastiques *
5 : * *
6 : * Copyright (C) 2009-2012 LSV & LACL *
7 : * Authors: Paolo Ballarini BenoƮt Barbot & Hilal Djafri *
8 : * Website: http://www.lsv.ens-cachan.fr/Software/cosmos *
9 : * *
10 : * This program is free software; you can redistribute it and/or modify *
11 : * it under the terms of the GNU General Public License as published by *
12 : * the Free Software Foundation; either version 3 of the License, or *
13 : * (at your option) any later version. *
14 : * *
15 : * This program is distributed in the hope that it will be useful, *
16 : * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 : * GNU General Public License for more details. *
19 : * *
20 : * You should have received a copy of the GNU General Public License along *
21 : * with this program; if not, write to the Free Software Foundation, Inc., *
22 : * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
23 : * file Gspn-Writer.hpp created by Benoit Barbot on 14/01/14. *
24 : *******************************************************************************
25 : */
26 :
27 : #ifndef __Cosmos__Gspn_Writer__
28 : #define __Cosmos__Gspn_Writer__
29 :
30 : #include <iostream>
31 : #include "Gspn-model.hpp"
32 : #include "../parameters.hpp"
33 :
34 33 : class Gspn_Writer {
35 : public:
36 : Gspn_Writer(GspnType& mgspn,const parameters& Q);
37 :
38 : GspnType MyGspn;
39 : const parameters P;
40 :
41 : void writeFile();
42 : void writeDotFile(const std::string &file)const;
43 :
44 :
45 :
46 : protected:
47 :
48 : size_t markingSize;
49 :
50 : std::string trId= "TR_PL_ID t, const abstractBinding &b";
51 : std::string objName= "SPN::";
52 :
53 : void writeFunT(std::ostream &s,const std::string &rtype,const std::string &name,const std::string &extraArg, std::function< void(unsigned int,std::stringstream &)>,std::string) const;
54 :
55 : int varMultiplier(size_t var)const;
56 : void writeTok(std::ostream &SpnF,const coloredToken&,const colorDomain&)const;
57 : void generateStringVal(arcStore&);
58 : virtual void writeMarkingClasse(std::ofstream &, std::ofstream &)const;
59 : void writeEnabledDisabled(std::ofstream &)const;
60 : virtual void writeEnabledDisabledBinding(std::ofstream &)const=0;
61 : virtual void writeEnabledDisabledBindingSet(std::ofstream &)const=0;
62 : void writeUpdateVect(std::ofstream &,const std::string &name,const std::vector< std::set<int> > &vect)const;
63 : void writeTransition(std::ofstream &)const;
64 : void writeVariable(std::ofstream & spnF)const;
65 :
66 : void error(const std::string& m);
67 : void view();
68 :
69 :
70 : virtual void printloot(std::ofstream& sf, const colorDomain &domain, size_t nesting )const=0;
71 :
72 : void EnabledDisabledTr(std::vector< std::set<int> >&,
73 : std::vector< std::set<int> >&,
74 : std::vector< std::set<int> >&)const;
75 :
76 : void writeMacro(std::ofstream &)const;
77 :
78 : void writeMarkingUpdate(std::stringstream &f, size_t t,const place &p,const arcStore &as2,bool direct)const;
79 : void writeMarkingUpdateIn(std::stringstream &f,const arcStore &as, size_t t,const place &p , size_t t2, bool pos,const arcStore &as2,bool directionxs)const;
80 : void writeFire(std::ofstream &f)const;
81 : void writeIsEnabled(std::ofstream &f)const;
82 : void writeSynchronisation(std::ofstream &f)const;
83 : void writeSetConditionsVector(std::ofstream &f)const;
84 : void writeGetDistParameters(std::ofstream &f)const;
85 : void writeGetPriority(std::ofstream &f)const;
86 : void writeGetWeight(std::ofstream &f)const;
87 : void writeUserDefineDistr(std::ofstream &f)const;
88 : void writePolynome(std::ofstream &f)const;
89 :
90 : };
91 :
92 :
93 :
94 : #endif /* defined(__Cosmos__Gspn_Writer__) */
|