Generated on Wed Apr 29 2015 11:51:40 for GGL-4.1.2 by doxygen 1.8.3.1
Rule_GML_writer.hh
Go to the documentation of this file.
1 #ifndef GGL_RULE_GML_WRITER_HH_
2 #define GGL_RULE_GML_WRITER_HH_
3 
4 #include <iostream>
5 
6 #include "ggl/Rule.hh"
7 
8 
9 namespace ggl
10 {
11 
12 
13  /*! @brief Rule GML writer
14  *
15  * Algorithm wrapper class to write a ggl rule in GGL GML format to stream.
16  *
17  * @author Martin Mann (c) 2013 http://www.bioinf.uni-freiburg.de/~mmann/
18  *
19  */
21 {
22 public:
23  //! construction
25  //! destruction
27 
28 
29  /*!
30  * Writes a boost rule in GGL GML format to stream.
31  *
32  * NOTE: currently no constraints are printed...
33  *
34  * @param out the stream to write to
35  * @param rule the rule to print
36  * @param withSpaces if true newlines and white spaces are used to write a
37  * user friendly and readable output, otherwise a one-line output
38  * with minimal space requirement is produced.
39  */
40  static
41  void
42  write( std::ostream& out
43  , const Rule & rule
44  , const bool withSpaces = true );
45 
46  /*!
47  * Writes a boost rule in compacted GGL GML format to stream.
48  *
49  * Therin, each node/label occurs only once. To indicate label changes or
50  * edge insertions/deletions, a label is in one of the following 4 forms:
51  *
52  * - "C" : the according node/edge has this label left and right = context
53  * - "L|" : the according edge is removed and the left side label L is given
54  * - "|R" : the according edge is inserted and the right side label R is given
55  * - "L|R" : the node label changes from left label L to right label R or
56  * the edge changes from valence L to valence R during the reaction
57  *
58  * @param out the stream to write to
59  * @param rule the rule to print
60  * @param withSpaces if true newlines and white spaces are used to write a
61  * user friendly and readable output, otherwise a one-line output
62  * with minimal space requirement is produced.
63  */
64  static
65  void
66  writeCompact( std::ostream& out
67  , const Rule & rule
68  , const bool withSpaces = true );
69 
70 private:
71 
72  /*!
73  * Writes the GML part for the given context
74  *
75  * @param graph the rule core graph
76  * @param context the context to print
77  * @param whether to print with whitespaces or minimal
78  *
79  * @return the GML notation for the current context
80  */
81  static
82  std::string
83  getContextGML( const Rule::CoreGraph & graph
84  , const Rule::RuleContext & context
85  , const bool withSpaces );
86 
87 
88 };
89 
90 
91 } // namespace ggl
92 
93 
94  // include implementation
95 #include "ggl/Rule_GML_writer.icc"
96 
97 #endif /*RULE_GML_WRITER_HH_*/
98