00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef PROCESSLOADER_H
00029 #define PROCESSLOADER_H
00030
00031 #include <BasicUtils/BasicThread.h>
00032 #include <libmanager.h>
00033 #include <ymlnode.h>
00034
00035 #include <string.h>
00036 #include <string>
00037 #include <iostream>
00038 #include <map>
00039
00040 #ifndef LTSTR
00041 #define LTSTR
00042 #include <string.h>
00043 struct ltstr {
00044 bool operator()(const char* s1, const char* s2) const {
00045 return strcmp(s1, s2) < 0;
00046 }
00047 };
00048 #endif
00049
00050
00051 class PNConnection;
00052 class DataBlockClass;
00053
00055
00062 class ProcessLoader : public BasicThread, public YMLNode {
00063 LibManager libManager;
00064
00066 int pargc;
00067
00069 char **pargs;
00070
00071 typedef enum {S_STOPPED, S_RUNNING, S_READING, S_SENDING_READ,
00072 S_WRITING, S_SENDING_WRITE, S_SENDING_EXECUTE} state_t;
00073 state_t state;
00074 int stateID;
00075
00076 public:
00077 ProcessLoader();
00078 virtual ~ProcessLoader();
00079
00080 DataBlockClass *read(int portId);
00081 void write(int portId, DataBlockClass *dataBlock);
00082 void execute(const char *operation);
00083 void execute(int operation);
00084
00085 LibManager *getLibManager() {return &libManager;}
00086 void loadLibraries();
00087
00088 void loadProcessArgs();
00089 int getProcessArgc() {return pargc;}
00090 char **getProcessArgs() {return pargs;}
00091
00092 virtual void init();
00093
00094 virtual bool load();
00095 virtual void exit();
00096
00097 std::string getStateString();
00098
00099 friend std::ostream &operator<<(std::ostream &stream, ProcessLoader &p);
00100 };
00101
00102 std::ostream &operator<<(std::ostream &stream, ProcessLoader &p);
00103
00104 #endif