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 <aspect/configurable.h>
27#include <aspect/logging.h>
28#include <core/threading/thread.h>
29#include <navgraph/aspect/navgraph.h>
30#include <navgraph/navgraph.h>
31#include <plugins/clips/aspect/clips_feature.h>
32
33#include <map>
34#include <string>
35#include <vector>
36
37namespace fawkes {
38class NavGraphStaticListEdgeConstraint;
39}
40
48{
49public:
51 virtual ~ClipsNavGraphThread();
52
53 virtual void init();
54 virtual void loop();
55 virtual void finalize();
56
57 // for CLIPSFeature
58 virtual void clips_context_init(const std::string & env_name,
60 virtual void clips_context_destroyed(const std::string &env_name);
61
62 virtual void graph_changed() noexcept;
63
64 /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
65protected:
66 virtual void
68 {
69 Thread::run();
70 }
71
72private:
73 void clips_navgraph_load(fawkes::LockPtr<CLIPS::Environment> &clips);
74 void clips_navgraph_block_edge(std::string env_name, std::string from, std::string to);
75 void clips_navgraph_unblock_edge(std::string env_name, std::string from, std::string to);
76
77private:
78 std::map<std::string, fawkes::LockPtr<CLIPS::Environment>> envs_;
79
81};
82
83#endif
Provide protobuf functionality to CLIPS environment.
virtual void init()
Initialize the thread.
virtual void graph_changed() noexcept
Function called if the graph has been changed.
virtual void run()
Stub to see name in backtrace for easier debugging.
virtual void finalize()
Finalize the thread.
virtual void loop()
Code to execute in the thread.
virtual void clips_context_init(const std::string &env_name, fawkes::LockPtr< CLIPS::Environment > &clips)
Initialize a CLIPS context to use the provided feature.
virtual void clips_context_destroyed(const std::string &env_name)
Notification that a CLIPS environment has been destroyed.
virtual ~ClipsNavGraphThread()
Destructor.
Thread aspect to provide a feature to CLIPS environments.
Definition: clips_feature.h:58
CLIPS feature maintainer.
Definition: clips_feature.h:42
Thread aspect to access configuration data.
Definition: configurable.h:33
Thread aspect to log output.
Definition: logging.h:33
Thread aspect to access NavGraph.
Definition: navgraph.h:36
Constraint that holds a list of edges to block.
Topological graph change listener.
Definition: navgraph.h:179
Thread class encapsulation of pthreads.
Definition: thread.h:46
Fawkes library namespace.