OpenANN  1.1.0
An open source library for artificial neural networks.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Macros | Functions | Variables
protocol.cpp File Reference
#include <sys/types.h>
#include <sys/socket.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include "protocol.h"
#include "agent.h"

Macros

#define CMD_GETTASK   "GET_TASK"
 
#define CMD_STARTLOG   "START_LOG"
 
#define CMD_START   "START"
 
#define CMD_STEP   "STEP"
 
#define CMD_SETSTATE   "SET_STATE"
 
#define BUFFER_LENGTH   1024
 

Functions

const char * getNextTokenFromSocket (int sd)
 
int getIntFromSocket (int sd, int *data)
 
int getDoubleFromSocket (int sd, double *data)
 
int getFlagFromSocket (int sd, int *data)
 
int getStatesFromSocket (int sd, double states[])
 
int sendTokenOnSocket (int sd, const char *token)
 
int sendIntOnSocket (int sd, int data)
 
int sendDoubleOnSocket (int sd, double data)
 
int sendActionsOnSocket (int sd, double actions[])
 
void clean_name (char *name)
 
int performInit (int sd, int argc, const char *agent_params[])
 
int performEpisode (int sd)
 
void performCleanup ()
 

Variables

char SEPARATOR = '\n'
 
char buffer [BUFFER_LENGTH]
 
int numStates = 0
 
int numActions = 0
 

Macro Definition Documentation

#define BUFFER_LENGTH   1024
#define CMD_GETTASK   "GET_TASK"
#define CMD_SETSTATE   "SET_STATE"
#define CMD_START   "START"
#define CMD_STARTLOG   "START_LOG"
#define CMD_STEP   "STEP"

Function Documentation

void clean_name ( char *  name)
int getDoubleFromSocket ( int  sd,
double *  data 
)
int getFlagFromSocket ( int  sd,
int *  data 
)
int getIntFromSocket ( int  sd,
int *  data 
)
const char* getNextTokenFromSocket ( int  sd)
int getStatesFromSocket ( int  sd,
double  states[] 
)
void performCleanup ( )
int performEpisode ( int  sd)
int performInit ( int  sd,
int  argc,
const char *  agent_params[] 
)
int sendActionsOnSocket ( int  sd,
double  actions[] 
)
int sendDoubleOnSocket ( int  sd,
double  data 
)
int sendIntOnSocket ( int  sd,
int  data 
)
int sendTokenOnSocket ( int  sd,
const char *  token 
)

Variable Documentation

char buffer[BUFFER_LENGTH]
int numActions = 0
int numStates = 0
char SEPARATOR = '\n'