Shiokaze Framework
A research-oriented fluid solver for computer graphics
runnable.h
Go to the documentation of this file.
1 /*
2 ** runnable.h
3 **
4 ** This is part of Shiokaze, a research-oriented fluid solver for computer graphics.
5 ** Created by Ryoichi Ando <rand@nii.ac.jp> on July 11, 2017.
6 **
7 ** Permission is hereby granted, free of charge, to any person obtaining a copy of
8 ** this software and associated documentation files (the "Software"), to deal in
9 ** the Software without restriction, including without limitation the rights to use,
10 ** copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
11 ** Software, and to permit persons to whom the Software is furnished to do so,
12 ** subject to the following conditions:
13 **
14 ** The above copyright notice and this permission notice shall be included in all copies
15 ** or substantial portions of the Software.
16 **
17 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
18 ** INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
19 ** PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20 ** HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
21 ** CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
22 ** OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24 //
25 #ifndef SHKZ_RUNNABLE_H
26 #define SHKZ_RUNNABLE_H
27 //
29 //
31 //
36 public:
37  //
38  LONG_NAME("runnable")
43  runnable () : m_running(true) {}
48  virtual ~runnable() {}
53  virtual void run_onetime() {}
58  virtual void idle() {}
63  virtual bool should_quit() const { return true; }
68  virtual bool is_running() const { return m_running; }
73  virtual void set_running( bool running ) { m_running = running; }
74  //
75 private:
76  bool m_running;
77 protected:
78  virtual void initialize( const environment_map &environment ) override { run_onetime(); }
79 };
80 //
82 //
83 #endif
runnable::is_running
virtual bool is_running() const
Get if the simulation is running.
Definition: runnable.h:68
runnable
Class that performs a task.
Definition: runnable.h:35
runnable::idle
virtual void idle()
idling function that is called while is_running() returns true.
Definition: runnable.h:58
SHKZ_BEGIN_NAMESPACE
#define SHKZ_BEGIN_NAMESPACE
Name space beggining definition for shiokaze.
Definition: common.h:39
runnable::should_quit
virtual bool should_quit() const
Function that if return true, the program will exit.
Definition: runnable.h:63
runnable::~runnable
virtual ~runnable()
Destructor for runnable.
Definition: runnable.h:48
LONG_NAME
#define LONG_NAME(long_name)
Macro that defines the full name.
Definition: credit.h:37
configurable::environment_map
std::map< std::string, const void * > environment_map
Type for environment_map.
Definition: configurable.h:46
runnable::initialize
virtual void initialize(const environment_map &environment) override
Initialize the program. Used to get things ready for actual use.
Definition: runnable.h:78
runnable::run_onetime
virtual void run_onetime()
Function that is called only one time on start.
Definition: runnable.h:53
SHKZ_END_NAMESPACE
#define SHKZ_END_NAMESPACE
Name space end definition for shiokaze.
Definition: common.h:44
recursive_configurable_module.h
recursive_configurable_module
recursive_configurable class that also inherits module.
Definition: recursive_configurable_module.h:49
runnable::set_running
virtual void set_running(bool running)
Set if the simulation is running.
Definition: runnable.h:73