UnCoVer (Using Coverability for Verification)
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
InstantWriterResultHandler.h
1 /***************************************************************************
2  * Copyright (C) 2014 by Jan Stückrath <jan.stueckrath@uni-due.de> *
3  * *
4  * This program is free software; you can redistribute it and/or modify *
5  * it under the terms of the GNU General Public License as published by *
6  * the Free Software Foundation; either version 2 of the License, or *
7  * (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this program; if not, write to the *
16  * Free Software Foundation, Inc., *
17  * 51 Franklin St, Fifth Floor, Boston, MA 02110, USA *
18  ***************************************************************************/
19 
20 #ifndef INSTANTWRITERRESULTHANDLER_H_
21 #define INSTANTWRITERRESULTHANDLER_H_
22 
23 #include "BackwardResultHandler.h"
24 #include "../io/GTXLWriter.h"
25 #include <boost/filesystem.hpp>
26 #include <boost/filesystem/fstream.hpp>
27 
28 namespace uncover {
29  namespace analysis {
30 
38 
39  public:
40 
44  enum Extent {
46  FULL = 0,
50  ID_FILES = 20};
51 
56  InstantWriterResultHandler(boost::filesystem::path& foldername);
57 
62 
63  virtual void setOldGTS(graphs::GTS_csp gts) override;
64 
65  virtual void setPreparedGTS(PreparedGTS_csp gts) override;
66 
67  virtual void setFirstGraphs(shared_ptr<const vector<graphs::Hypergraph_sp>> graphs) override;
68 
69  virtual void wasDeletedBecauseOf(IDType deletedGraph, IDType reasonGraph) override;
70 
71  virtual void wasNoValidGraph(IDType deletedGraph) override;
72 
73  virtual void wasGeneratedByFrom(graphs::Hypergraph_sp genGraph, IDType rule, IDType srcGraph) override;
74 
75  virtual void startingNewBackwardStep() override;
76 
77  virtual void finishedBackwardStep() override;
78 
79  private:
80 
85 
89  boost::filesystem::path foldername;
90 
94  unique_ptr<io::GTXLWriter> gtxlWriter;
95 
99  boost::filesystem::ofstream graphGenerationFile;
100 
104  boost::filesystem::ofstream graphDeletionFile;
105 
109  vector<graphs::Hypergraph_sp> currentStepGraphs;
110 
114  unsigned int stepnr;
115 
120 
121  };
122 
123  } /* namespace analysis */
124 } /* namespace uncover */
125 #endif /* INSTANTWRITERRESULTHANDLER_H_ */
boost::filesystem::path foldername
Stores the path to the storage folder.
Definition: InstantWriterResultHandler.h:89
virtual void finishedBackwardStep() override
Informs that the current backward step has ended.
Definition: InstantWriterResultHandler.cpp:115
shared_ptr< const GTS > GTS_csp
Alias for a shared pointer to a constant GTS object.
Definition: GTS.h:169
virtual void setOldGTS(graphs::GTS_csp gts) override
Sets the old unprepared GTS.
Definition: InstantWriterResultHandler.cpp:70
Stores only the GTSs and the IDs of graph, but not the graphs themselves.
Definition: InstantWriterResultHandler.h:48
virtual ~InstantWriterResultHandler()
Destroys this instance of InstantWriterResultHandler.
Definition: InstantWriterResultHandler.cpp:61
The BackwardResultHandler is an interface to handle intermediate results produced by the backward sea...
Definition: BackwardResultHandler.h:33
InstantWriterResultHandler::Extent extent
Stores the extent to which information is stored.
Definition: InstantWriterResultHandler.h:119
vector< graphs::Hypergraph_sp > currentStepGraphs
A collection temporary storing all graphs generated in the current backward step. ...
Definition: InstantWriterResultHandler.h:109
Stores only the IDs of graph, but not the graphs or GTSs.
Definition: InstantWriterResultHandler.h:50
Extent
Describes the extent to which the information should be stored.
Definition: InstantWriterResultHandler.h:44
shared_ptr< PreparedGTS const > PreparedGTS_csp
Alias of a shared pointer to a constant PreparedGTS.
Definition: PreparedGTS.h:289
virtual void setFirstGraphs(shared_ptr< const vector< graphs::Hypergraph_sp >> graphs) override
Sets the initial set of graphs from which the backward search is started.
Definition: InstantWriterResultHandler.cpp:86
virtual void startingNewBackwardStep() override
Informs that the next backward step has begun.
Definition: InstantWriterResultHandler.cpp:109
virtual void wasDeletedBecauseOf(IDType deletedGraph, IDType reasonGraph) override
Stores that the graph with the first ID was deleted because it was subsumed by the graph with the sec...
Definition: InstantWriterResultHandler.cpp:94
unsigned int stepnr
A counter storing the index of the current backward step.
Definition: InstantWriterResultHandler.h:114
The InstantWriterResultHandler implements the BackwardResultHandler by writing the given information ...
Definition: InstantWriterResultHandler.h:37
boost::filesystem::ofstream graphDeletionFile
The file stream where information about the deletion of old graphs are stored.
Definition: InstantWriterResultHandler.h:104
virtual void wasNoValidGraph(IDType deletedGraph) override
Stores that the graph with the given ID did not belong to the restricted set of graphs and was theref...
Definition: InstantWriterResultHandler.cpp:98
InstantWriterResultHandler()
This constructor cannot/should not be called.
Definition: InstantWriterResultHandler.cpp:34
virtual void setPreparedGTS(PreparedGTS_csp gts) override
Sets the new prepared GTS.
Definition: InstantWriterResultHandler.cpp:78
boost::filesystem::ofstream graphGenerationFile
The file stream where information about the generation of new graphs are stored.
Definition: InstantWriterResultHandler.h:99
unsigned int IDType
IDType is an (unsigned) integer specifically used as an Identifier of graphs, elements of graphs or a...
Definition: globals.h:53
unique_ptr< io::GTXLWriter > gtxlWriter
A GTXLWriter used to write the information to the file system.
Definition: InstantWriterResultHandler.h:94
virtual void wasGeneratedByFrom(graphs::Hypergraph_sp genGraph, IDType rule, IDType srcGraph) override
Stores that the given graph was generated from the second graph by the given rule.
Definition: InstantWriterResultHandler.cpp:102
Stores all given information.
Definition: InstantWriterResultHandler.h:46
shared_ptr< Hypergraph > Hypergraph_sp
Alias for a shared pointer to a Hypergraph.
Definition: Hypergraph.h:85