00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _TALKER_H
00023 #define _TALKER_H
00024
00025 #include "graphbuilder.h"
00026 #include "sampler.h"
00027 #include "pvminterface.h"
00028 #include <algorithm>
00029 #include <sstream>
00030
00031
00032 struct LeafCountsStruct {
00033 uint32 id;
00034 uint32 occupation_count;
00035 };
00036
00037
00038
00039
00040
00041
00042
00043
00044 #define MAXLEAFMESSAGE_SIZE ((5 * Mb)/sizeof(LeafCountsStruct))
00045
00046
00047 class Talker {
00048 public:
00049 Talker(const char* rippername, const char* tempdir,
00050 WebLinkGraph *ripperweb, GraphBuilder *rippergb,
00051 bool pvm_is_master, int pvm_numtasks) throw (exception);
00052 ~Talker();
00053
00054 void Talk() throw (exception);
00055
00056 void PropagateLeafCounts() throw (invalid_argument);
00057
00058 void PrintStatistics(ostream& o);
00059 void PrintStatisticsGraph(ostream& o);
00060
00061 bool BuildTags(ifstream& g);
00062 bool LoadLeaves(ifstream& g);
00063
00064 int GetToken(char* command, ostream& out, char* message, int n, ...);
00065 char *GetTokenVar(char* command, ostream& out, char* message);
00066 bool ProcessCommand(char *command, ostream& out);
00067
00068 void SetupFIFOs() throw (exception);
00069 void RemoveFIFOs();
00070
00071 private:
00072
00073 ostringstream inputfifo;
00074 ostringstream outputfifo;
00075 ostringstream nodequiv;
00076 const char *name;
00077 const char *tempdir;
00078 WebLinkGraph *web;
00079 GraphBuilder *gb;
00080
00081 gsl_rng* r;
00082
00083 PageRankSampler *prsampler;
00084 DateBiasedPageRankSampler *dbsampler;
00085 TruncatedKleinbergSampler *tksampler;
00086 WebSampler *defaultsampler;
00087
00088 PVMInterface *pvminterface;
00089
00090 LeafNodePtrList *leaflist;
00091 };
00092
00093 #endif