Fawkes API Fawkes Development Version
clips-protobuf-thread.h
1
2/***************************************************************************
3 * clips-protobuf-thread.h - Protobuf communication for CLIPS
4 *
5 * Created: Tue Apr 16 13:02:22 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_PROTOBUF_CLIPS_PROTOBUF_THREAD_H_
24#define _PLUGINS_CLIPS_PROTOBUF_CLIPS_PROTOBUF_THREAD_H_
25
26#include <aspect/configurable.h>
27#include <aspect/logging.h>
28#include <core/threading/thread.h>
29#include <plugins/clips/aspect/clips_feature.h>
30
31#include <map>
32#include <string>
33#include <vector>
34
35namespace protobuf_clips {
36class ClipsProtobufCommunicator;
37}
38
44{
45public:
47 virtual ~ClipsProtobufThread();
48
49 virtual void init();
50 virtual void loop();
51 virtual void finalize();
52
53 // for CLIPSFeature
54 virtual void clips_context_init(const std::string & env_name,
56 virtual void clips_context_destroyed(const std::string &env_name);
57
58 /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
59protected:
60 virtual void
62 {
63 Thread::run();
64 }
65
66private:
67 std::map<std::string, protobuf_clips::ClipsProtobufCommunicator *> pb_comms_;
68 std::vector<std::string> cfg_proto_dirs_;
69};
70
71#endif
Provide protobuf functionality to CLIPS environment.
virtual void finalize()
Finalize the thread.
virtual ~ClipsProtobufThread()
Destructor.
virtual void clips_context_destroyed(const std::string &env_name)
Notification that a CLIPS environment has been destroyed.
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 run()
Stub to see name in backtrace for easier debugging.
virtual void init()
Initialize the thread.
virtual void loop()
Code to execute in the thread.
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 class encapsulation of pthreads.
Definition: thread.h:46