Fawkes API  Fawkes Development Version
pddl_robot_memory_thread.h
1 
2 /***************************************************************************
3  * pddl_robot_memory_thread.h - pddl_robot_memory
4  *
5  * Plugin created: Thu Oct 13 13:34:05 2016
6 
7  * Copyright 2016 Frederik Zwilling
8  *
9  ****************************************************************************/
10 
11 /* This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL file in the doc directory.
22  */
23 
24 #ifndef _PLUGINS_PDDL_ROBOT_MEMORYTHREAD_H_
25 #define _PLUGINS_PDDL_ROBOT_MEMORYTHREAD_H_
26 
27 #include "interfaces/PddlGenInterface.h"
28 
29 #include <aspect/blackboard.h>
30 #include <aspect/configurable.h>
31 #include <aspect/logging.h>
32 #include <blackboard/interface_listener.h>
33 #include <core/threading/thread.h>
34 #include <ctemplate/template.h>
35 #include <plugins/robot-memory/aspect/robot_memory_aspect.h>
36 
37 #include <bsoncxx/document/view.hpp>
38 #include <string>
39 
40 namespace fawkes {
41 }
42 
44  public fawkes::LoggingAspect,
49 {
50 public:
52 
53  virtual void init();
54  virtual void finalize();
55  virtual void loop();
56 
57  /** Stub to see name in backtrace for easier debugging. @see Thread::run() */
58 protected:
59  virtual void
60  run()
61  {
62  Thread::run();
63  }
64 
65 private:
66  fawkes::PddlGenInterface *gen_if;
67 
68  std::string collection;
69  std::string input_path;
70  std::string output_path;
71  std::string goal;
72 
73  void fill_dict_from_document(ctemplate::TemplateDictionary *dict,
74  const bsoncxx::document::view &obj,
75  std::string prefix = "");
76  void generate();
77 
78  virtual bool bb_interface_message_received(fawkes::Interface *interface,
79  fawkes::Message * message) throw();
80 };
81 
82 #endif
PddlRobotMemoryThread::run
virtual void run()
Stub to see name in backtrace for easier debugging.
Definition: pddl_robot_memory_thread.h:60
fawkes::Message
Definition: message.h:41
fawkes::BlackBoardInterfaceListener
Definition: interface_listener.h:47
PddlRobotMemoryThread::finalize
virtual void finalize()
Finalize the thread.
Definition: pddl_robot_memory_thread.cpp:221
PddlRobotMemoryThread::init
virtual void init()
Initialize the thread.
Definition: pddl_robot_memory_thread.cpp:68
fawkes::BlackBoardAspect
Definition: blackboard.h:38
fawkes
fawkes::LoggingAspect
Definition: logging.h:38
fawkes::Interface
Definition: interface.h:78
PddlRobotMemoryThread::loop
virtual void loop()
Thread is only waked up if there is a new interface message to generate a pddl.
Definition: pddl_robot_memory_thread.cpp:101
fawkes::Thread
Definition: thread.h:45
PddlRobotMemoryThread
Definition: pddl_robot_memory_thread.h:43
fawkes::ConfigurableAspect
Definition: configurable.h:38
fawkes::RobotMemoryAspect
Definition: robot_memory_aspect.h:39