GAMS  1.4.0
JavaAlgorithm.h
Go to the documentation of this file.
1 
54 #ifndef _GAMS_ALGORITHM_JAVA_H_
55 #define _GAMS_ALGORITHM_JAVA_H_
56 
57 #include "gams/variables/Self.h"
58 #include "gams/variables/Sensor.h"
62 #include "madara/knowledge/KnowledgeBase.h"
64 
65 #ifdef _GAMS_JAVA_
66 #include <jni.h>
67 #include "gams_jni.h"
68 #endif
69 
70 namespace gams
71 {
72  namespace algorithms
73  {
78  {
79  public:
90  jobject obj,
91  madara::knowledge::KnowledgeBase * knowledge = 0,
92  platforms::BasePlatform * platform = 0,
93  variables::Sensors * sensors = 0,
94  variables::Self * self = 0,
95  variables::Agents * agents = 0);
96 
101 
106  void operator=(const JavaAlgorithm & rhs);
107 
112  virtual int analyze(void);
113 
118  virtual int execute(void);
119 
124  virtual int plan(void);
125 
131  virtual std::string get_id() const;
132 
136  virtual std::string get_name() const;
137 
142  jobject get_java_instance(void);
143 
144  protected:
146  jobject obj_;
147 
149  jclass class_;
150  };
151 
152 
157  {
158  public:
159 
164  JavaAlgorithmFactory(jobject obj);
165 
170 
188  const madara::knowledge::KnowledgeMap & args,
189  madara::knowledge::KnowledgeBase * knowledge,
190  platforms::BasePlatform * platform,
191  variables::Sensors * sensors,
192  variables::Self * self,
193  variables::Agents * agents);
194 
199  jobject get_java_instance(void);
200 
201  protected:
203  jobject obj_;
204  };
205  }
206 }
207 
208 #endif // _GAMS_ALGORITHM_JAVA_H_
Copyright(c) 2014 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
Copyright (c) 2014 Carnegie Mellon University.
#define GAMS_EXPORT
Definition: GamsExport.h:20
Copyright(c) 2014 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
Copyright(c) 2014 Carnegie Mellon University.
Base class for algorithm factories that classes derived from.
The base class that algorithms in GAMS use.
Definition: BaseAlgorithm.h:95
A factory class for creating Java Algorithms.
jobject get_java_instance(void)
Returns the Java instance that implements from AlgorithmFactory.
virtual ~JavaAlgorithmFactory()
Destructor.
JavaAlgorithmFactory(jobject obj)
Constructor.
virtual BaseAlgorithm * create(const madara::knowledge::KnowledgeMap &args, madara::knowledge::KnowledgeBase *knowledge, platforms::BasePlatform *platform, variables::Sensors *sensors, variables::Self *self, variables::Agents *agents)
Creates a Java Algorithm.
jobject obj_
the Java object with callable methods
A facade for Java algorithms.
Definition: JavaAlgorithm.h:78
jobject obj_
the Java object with callable methods
JavaAlgorithm(jobject obj, madara::knowledge::KnowledgeBase *knowledge=0, platforms::BasePlatform *platform=0, variables::Sensors *sensors=0, variables::Self *self=0, variables::Agents *agents=0)
Constructor.
virtual int execute(void)
Plans the next execution of the algorithm.
virtual std::string get_name() const
Gets the name of the algorithm.
virtual int plan(void)
Plans the next execution of the algorithm.
virtual std::string get_id() const
Gets the unique identifier of the algorithm.
jobject get_java_instance(void)
Returns the Java instance that derives from BaseAlgorithm.
virtual int analyze(void)
Analyzes environment, platform, or other information.
jclass class_
the class of the Java object obj_
void operator=(const JavaAlgorithm &rhs)
Assignment operator.
The base platform for all platforms to use.
Definition: BasePlatform.h:113
A container for self referencing information.
Definition: Self.h:70
std::map< std::string, Sensor * > Sensors
a map of sensor names to the sensor information
Definition: Sensor.h:238
std::vector< Agent > Agents
An array of agent knowledge.
Definition: Agent.h:246
Contains all GAMS-related tools, classes and code.