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 <core/threading/thread.h>
27 #include <aspect/logging.h>
28 #include <aspect/configurable.h>
29 #include <plugins/clips/aspect/clips_feature.h>
30 
31 #include <vector>
32 #include <string>
33 #include <map>
34 
35 namespace protobuf_clips {
36  class ClipsProtobufCommunicator;
37 }
38 
40 : public fawkes::Thread,
41  public fawkes::LoggingAspect,
43  public fawkes::CLIPSFeature,
45 {
46  public:
48  virtual ~ClipsProtobufThread();
49 
50  virtual void init();
51  virtual void loop();
52  virtual void finalize();
53 
54  // for CLIPSFeature
55  virtual void clips_context_init(const std::string &env_name,
57  virtual void clips_context_destroyed(const std::string &env_name);
58 
59  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
60  protected: virtual void run() { Thread::run(); }
61 
62  private:
63  std::map<std::string, protobuf_clips::ClipsProtobufCommunicator *> pb_comms_;
64  std::vector<std::string> cfg_proto_dirs_;
65 
66 };
67 
68 #endif
Thread aspect to provide a feature to CLIPS environments.
Definition: clips_feature.h:57
Thread class encapsulation of pthreads.
Definition: thread.h:42
virtual void run()
Stub to see name in backtrace for easier debugging.
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
Provide protobuf functionality to CLIPS environment.