4 #include "thread_util.h"
9 * A wrapping class for an external program, which can exchange messages with the current process through stdin/stdout
10 * Useful for attaching control of an operation to an external process - for example, AI for a game
15 Program(const char * executeablePath); //Constructor
16 virtual ~Program(); //Destructor
21 bool SendMessage(const char * print, ...); //Sends a formated message (NOTE: Prints a newline)
22 bool SendMessage(const std::string & buffer) {return SendMessage(buffer.c_str());} //Sends a C++ string message
23 bool GetMessage(std::string & buffer, double timeout=-1); //Retrieves a message, or waits for a timeout (if positive)
30 FILE * input; //Stream used for sending information TO the process
31 FILE * output; //Stream used for retrieving information FROM the process
34 pid_t pid; //Process ID of the program wrapped