ODIN
odinmethod.h
1 /***************************************************************************
2  odinmethod.h - description
3  -------------------
4  begin : Sun Dec 25 21:30:11 CEST 2005
5  copyright : (C) 2000-2021 by Thies H. Jochimsen
6  email : thies@jochimsen.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef OdinMethod_H
19 #define OdinMethod_H
20 
21 #include <tjutils/tjstate.h>
22 
23 #include <odinseq/seqmeth.h>
24 
25 #include "odincomp.h"
26 #include "odinconf.h"
27 
28 class QWidget; // forward declaration
29 
30 
32 
33 /*
34  State diagram for OdinMethod, i.e. for compiling/linking of sequences:
35 
36  Possible transitions between states are indicated by
37  the corresponding member functions that perform the transition.
38 
39 
40  clean <-------\
41  |
42  | | clear()
43  | compile() |
44  | |
45  V |
46  |
47  compiled ------| /---------\
48  | | |
49  | | | |
50  | link() | | | relink()
51  | | | |
52  V | | |
53  | V |
54  linked --------' ---------'
55 
56 */
57 
59 
66 
67  virtual void report(bool status, const STD_string& trans_label, const STD_string& message) = 0;
68 
69  virtual void create_widgets() = 0;
70 
71  virtual void delete_widgets() = 0;
72 
73 };
74 
75 
77 
83 class OdinMethod : public StateMachine<OdinMethod> {
84 
85  public:
86  OdinMethod(const OdinConf& conf, OdinMethodCallback* callback, QWidget* parent4dialog);
87 
91  bool clear() {return clean.obtain_state();}
92 
96  bool compile() {return compiled.obtain_state();}
97 
101  bool link() {return linked.obtain_state();}
102 
106  bool relink();
107 
111  SeqMethod* operator -> () {return method.get_current_method();}
112 
116  bool check_srcdir();
117 
121  STD_string seqParsFile();
122 
123  private:
124 
125  // states and their transition functions:
126 
127  State<OdinMethod> clean;
128  bool make_clean();
129 
130  State<OdinMethod> compiled;
131  bool clean2compiled();
132 
133  State<OdinMethod> linked;
134  bool compiled2linked();
135  bool linked2compiled();
136 
137 
138  // helpers:
139  bool unlink();
140  bool make();
141  STD_string find_so();
142 
143 
144 
145 
146  SeqMethodProxy method;
147 
148  // stuff passed in during construction
149  const OdinConf& settings;
150  OdinMethodCallback* cback;
151  QWidget* parent;
152 
153 
154 };
155 
156 #endif
bool check_srcdir()
STD_string seqParsFile()
bool link()
Definition: odinmethod.h:101
SeqMethod * operator->()
Definition: odinmethod.h:111
bool relink()
bool compile()
Definition: odinmethod.h:96
bool clear()
Definition: odinmethod.h:91
Base class for methods (sequences)
Definition: seqmeth.h:155