Fawkes API Fawkes Development Version
eclipse_thread.h
1
2/***************************************************************************
3 * eclipse_thread.h - Fawkes ECLiPSe Thread
4 *
5 * Created: Wed Jul 16 10:20:51 2009
6 * Copyright 2009 Daniel Beck
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_ECLIPSE_CLP_ECLIPSE_THREAD_H_
24#define _PLUGINS_ECLIPSE_CLP_ECLIPSE_THREAD_H_
25
26#include <aspect/blackboard.h>
27#include <aspect/configurable.h>
28#include <aspect/logging.h>
29#include <core/threading/mutex.h>
30#include <core/threading/thread.h>
31
32#include <eclipseclass.h>
33#include <string>
34#include <vector>
35
36namespace fawkes {
37class Interface;
38class Mutex;
39} // namespace fawkes
40
45{
46public:
48 virtual ~EclipseAgentThread();
49
50 virtual void init();
51 virtual void finalize();
52 virtual void once();
53 virtual void loop();
54
55 void post_event(const char *);
57
59
60private: /* methods */
61 bool load_file(const char *filename);
62
63private: /* members */
64 static EclipseAgentThread *m_instance;
65
66 bool m_initialized;
67 std::string agent;
68 std::string graph_path;
69 int ec_result;
70 EC_ref ec_yield_reason;
71 fawkes::Mutex *mutex;
72};
73
74#endif /* PLUGINS_ECLIPSE_CLP_ECLIPSE_THREAD_H__ */
This thread creates an ECLiPSe context in which the ECLiPSe interpreter and the program are loaded.
virtual void finalize()
Finalize the thread.
static EclipseAgentThread * instance()
Get the EclipseAgentThread instance.
void post_event(const char *)
Post an event to the ECLiPSe context.
fawkes::Logger * get_logger()
Get the logger.
virtual void init()
Initialize the thread.
virtual void loop()
Code to execute in the thread.
virtual ~EclipseAgentThread()
Destructor.
virtual void once()
Execute an action exactly once.
EclipseAgentThread()
Constructor.
Thread aspect to access to BlackBoard.
Definition: blackboard.h:34
Thread aspect to access configuration data.
Definition: configurable.h:33
Interface for logging.
Definition: logger.h:42
Thread aspect to log output.
Definition: logging.h:33
Mutex mutual exclusion lock.
Definition: mutex.h:33
Thread class encapsulation of pthreads.
Definition: thread.h:46
Fawkes library namespace.