Mike Spadaru / physcom
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers RPCFunction.h Source File

RPCFunction.h

00001 #ifndef PHYSCOM_RPCFUNCTION_H
00002 #define PHYSCOM_RPCFUNCTION_H
00003 
00004 #include "rpc.h"
00005 
00006 namespace physcom {
00007 
00008 /**
00009  *
00010  * Class to call custom functions over RPC
00011  * For details see rpc.h
00012  *
00013  */
00014 class RPCFunction: public RPC {
00015 public:
00016     /**
00017      * Constructor
00018      *
00019      * @param f Pointer to the function to call. the function must be of the form void foo(char * input, char * output)
00020      * @param name The name of this object
00021      */
00022     RPCFunction(void (*f)(char*, char*), const char* = NULL);
00023 
00024     /*
00025      * Calls the attached function passing the string in but doesn't return the result.
00026      *  @param input: The string to be passed into the attached function. 
00027      * This string can consist of any ASCII characters apart from escape codes. 
00028      * The usual limtations on argument content for RPC strings has been removed
00029      * @param output: string output from the function
00030      */
00031     virtual void run(char *input, char *output);
00032 
00033 
00034 private:
00035     void (*function_ptr)(char*, char*);
00036 };
00037 
00038 } // Namespace physcom
00039 
00040 #endif