00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef CONSUMEREXPORT_HH
00025 #define CONSUMEREXPORT_HH 1
00026
00027 #include <stdio.h>
00028 #include <sys/types.h>
00029 #include <time.h>
00030
00031 #include <iostream>
00032
00033 #include "TSocket.h"
00034 #include "TServerSocket.h"
00035 #include "TMessage.h"
00036 #include "TMonitor.h"
00037 #include "TList.h"
00038
00039 class TConsumerInfo;
00040
00041 class ConsumerExport
00042 {
00043 public:
00044 ConsumerExport(const int firstPort, const bool restartEnable=false,
00045 const int reportToStateManager=2);
00046 ~ConsumerExport();
00047
00048 int send(TConsumerInfo *consinfo, Bool_t modFlag=kFALSE);
00049 int send(const char *messString);
00050 pid_t getServerPid();
00051 static int getMaxString() {return _maxStringLength;}
00052 static void setMaxString(int newLength) {_maxStringLength = newLength;}
00053
00054 private:
00055 bool _debug;
00056 bool _restartEnable;
00057 bool _sendingEnable;
00058 int _reportToStateManager;
00059 int _port;
00060 pid_t _serverPid;
00061 time_t _serverStartTime;
00062 static int _maxStringLength;
00063 char* _canvasString;
00064 TMonitor* _consMonitor;
00065 TServerSocket* _consSS;
00066 TSocket* _consSock;
00067
00068
00069 ConsumerExport(const ConsumerExport& ce);
00070 ConsumerExport& operator=(const ConsumerExport& ce);
00071
00072 int send(TList *list);
00073 int send(const TObject *object);
00074 void errorReact(const Int_t sendRes);
00075 void createCanvasString(TList *canvasList);
00076 int lengthNeeded(TList *canvasList);
00077 int startServer();
00078 int connectServer();
00079 int reestablishServer();
00080 };
00081
00082 #endif