Fawkes API  Fawkes Development Version
clips_navgraph_thread.h
1 
2 /***************************************************************************
3  * clips_navgraph_thread.h - NavGraph feature for CLIPS
4  *
5  * Created: Wed Oct 09 19:26:41 2013
6  * Copyright 2006-2013 Tim Niemueller [www.niemueller.de]
7  *
8  ****************************************************************************/
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 2 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 Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef __PLUGINS_CLIPS_NAVGRAPH_CLIPS_NAVGRAPH_THREAD_H_
24 #define __PLUGINS_CLIPS_NAVGRAPH_CLIPS_NAVGRAPH_THREAD_H_
25 
26 #include <core/threading/thread.h>
27 #include <aspect/logging.h>
28 #include <aspect/configurable.h>
29 #include <plugins/clips/aspect/clips_feature.h>
30 #include <navgraph/aspect/navgraph.h>
31 #include <navgraph/navgraph.h>
32 
33 #include <vector>
34 #include <string>
35 #include <map>
36 
37 namespace fawkes {
38  class NavGraphStaticListEdgeConstraint;
39 }
40 
42 : public fawkes::Thread,
43  public fawkes::LoggingAspect,
46  public fawkes::CLIPSFeature,
49 {
50  public:
52  virtual ~ClipsNavGraphThread();
53 
54  virtual void init();
55  virtual void loop();
56  virtual void finalize();
57 
58  // for CLIPSFeature
59  virtual void clips_context_init(const std::string &env_name,
61  virtual void clips_context_destroyed(const std::string &env_name);
62 
63  virtual void graph_changed() throw();
64 
65  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
66  protected: virtual void run() { Thread::run(); }
67 
68  private:
69  void clips_navgraph_load(fawkes::LockPtr<CLIPS::Environment> &clips);
70  void clips_navgraph_block_edge(std::string env_name, std::string from, std::string to);
71  void clips_navgraph_unblock_edge(std::string env_name, std::string from, std::string to);
72 
73  private:
74  std::map<std::string, fawkes::LockPtr<CLIPS::Environment> > envs_;
75 
77 };
78 
79 #endif
Thread aspect to provide a feature to CLIPS environments.
Definition: clips_feature.h:57
Fawkes library namespace.
virtual void run()
Code to execute in the thread.
Definition: thread.cpp:939
Thread class encapsulation of pthreads.
Definition: thread.h:42
CLIPS feature maintainer.
Definition: clips_feature.h:41
Thread aspect to log output.
Definition: logging.h:35
Thread aspect to access configuration data.
Definition: configurable.h:35
Constraint that holds a list of edges to block.
Topological graph change listener.
Definition: navgraph.h:175
Thread aspect to access NavGraph.
Definition: navgraph.h:37
virtual void run()
Stub to see name in backtrace for easier debugging.
Provide protobuf functionality to CLIPS environment.