Qualia  0.2
OscEnvironment.h
Go to the documentation of this file.
1 /*
2  * OscEnvironment.h
3  *
4  * (c) 2012 Sofian Audry -- info(@)sofianaudry(.)com
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef OSCENVIRONMENT_H_
21 #define OSCENVIRONMENT_H_
22 
24 
25 #include <stdio.h>
26 
27 #ifdef _WIN32
28  #define _WINSOCKAPI_
29  #include <windows.h>
30  #include <winbase.h>
31 #else
32  #include <unistd.h>
33 #endif
34 
35 #include "OscManager.h"
36 
37 class OscEnvironment : public Environment {
38 public:
39  int id;
40 
42  int actionDim;
44 
45  // Internal use.
47  volatile bool locked;
48  char observationTypes[100];
49 
50 public:
52  virtual ~OscEnvironment();
53 
54  char* getPath(const char* path);
55 
56  // Main qualia environment methods.
57  virtual void init();
58  virtual Observation* start();
59  virtual Observation* step(const Action* action);
60 
61  // Read the observation from the observationBuffer.
62  virtual Observation* readObservation(observation_t* buffer) = 0;
63 
64 // static int handlerCreate(const char *path, const char *types, lo_arg **argv,
65 // int argc, void *data, void *user_data);
66  static int handlerInit(const char *path, const char *types, lo_arg **argv,
67  int argc, void *data, void *user_data);
68  static int handlerStartStep(const char *path, const char *types, lo_arg **argv,
69  int argc, void *data, void *user_data);
70 
71 };
72 
73 #endif /* PROTOTYPE2ENVIRONMENT_H_ */