00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00013
00014 #include "TString.h"
00015
00016 #include "MessageService/MsgService.h"
00017 #include "Dispatcher/DDS.h"
00018
00019 CVSID("$Id: DDS.cxx,v 1.19 2006/11/05 20:31:13 schubert Exp $");
00020
00021
00022
00023
00024 const char* DDS::AsString(EDataSource datasource) {
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 switch ( datasource ) {
00036 case kDaq:
00037 return "DAQ";
00038 case kDcs:
00039 return "DCS";
00040 default:
00041 MSG("DDS",Msg::kWarning)
00042 << "DDS::AsString called with unknown message type"
00043 << (int)datasource << endl;
00044 return "Unknown";
00045 }
00046
00047 }
00048
00049 const char* DDS::AsString(EKeepUpMode keepupmode) {
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060 switch ( keepupmode ) {
00061 case kAll:
00062 return "All";
00063 case kFileKeepUp:
00064 return "FileKeepUp";
00065 case kRecordKeepUp:
00066 return "RecordKeepUp";
00067 default:
00068 MSG("DDS",Msg::kWarning)
00069 << "DDS::AsString called with unknown keepup mode"
00070 << (int)keepupmode << endl;
00071 return "Unknown";
00072 }
00073
00074 }
00075
00076 const char* DDS::AsString(EMessageType messagetype) {
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087 switch ( messagetype ) {
00088 case kData:
00089 return "Data";
00090 case kStatus:
00091 return "Status";
00092 case kGoToFile:
00093 return "GoToFile";
00094 case kNext:
00095 return "Next";
00096 case kSubscribe:
00097 return "Subscribe";
00098 case kShutdown:
00099 return "Shutdown";
00100 case kPermissionDenied:
00101 return "PermissionDenied";
00102 case kSaturated:
00103 return "Saturated";
00104 case kFileError:
00105 return "FileError";
00106 case kTimeoutNewFile:
00107 return "TimeoutNewFile";
00108 case kTimeoutNewRecord:
00109 return "TimeoutNewRecord";
00110 case kInvalidSelection:
00111 return "InvalidSelection";
00112 case kMessageUnknown:
00113 return "MessageUnknown";
00114 case kOk:
00115 return "Ok";
00116 case kSocketError:
00117 return "SocketError";
00118 case kSystemError:
00119 return "SystemError";
00120 case kError:
00121 return "Error";
00122 case kInactive:
00123 return "Inactive";
00124 default:
00125 MSG("DDS",Msg::kWarning)
00126 << "DDS::AsString called with unknown message type"
00127 << (int)messagetype << endl;
00128 return "Unknown";
00129 }
00130
00131 }
00132
00133 const char* DDS::AsString(EClientType clienttype) {
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143 switch ( clienttype ) {
00144 case kOnlineMonitor:
00145 return "OnlineMonitor";
00146 case kDatabaseUpdater:
00147 return "DatabaseUpdater";
00148 case kEventDisplay:
00149 return "EventDisplay";
00150 case kOther:
00151 return "Other";
00152 case kUnknownClientType:
00153 return "Unknown";
00154 default:
00155 MSG("DDS",Msg::kWarning)
00156 << "DDS::AsString called with unknown client type"
00157 << (int)clienttype << endl;
00158 return "Unknown";
00159 }
00160
00161 }
00162
00163 int DDS::GetKeepUpCode(const char* keepupmode) {
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173 TString tmpstr(keepupmode);
00174 tmpstr.ToLower();
00175 if ( strcmp(tmpstr.Data(),"all") == 0 ) return DDS::kAll;
00176 else if ( strcmp(tmpstr.Data(),"filekeepup") == 0 ) return DDS::kFileKeepUp;
00177 else if (strcmp(tmpstr.Data(),"recordkeepup")==0) return DDS::kRecordKeepUp;
00178 return -1;
00179
00180 }
00181
00182 int DDS::GetDataSourceCode(const char* datasource) {
00183
00184
00185
00186
00187
00188
00189
00190
00191
00192 TString tmpstr(datasource);
00193 tmpstr.ToLower();
00194 if ( strcmp(tmpstr.Data(),"daq") == 0 ) return DDS::kDaq;
00195 else if ( strcmp(tmpstr.Data(),"dcs") == 0 ) return DDS::kDcs;
00196 return -1;
00197
00198 }
00199
00200 DDS::EClientType DDS::GetClientType(const char* clienttype) {
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210 TString tmpstr(clienttype);
00211 tmpstr.ToLower();
00212 if (strcmp(tmpstr.Data(),"onlinemonitor") ==0) return DDS::kOnlineMonitor;
00213 if (strcmp(tmpstr.Data(),"databaseupdater")==0) return DDS::kDatabaseUpdater;
00214 if (strcmp(tmpstr.Data(),"eventdisplay") ==0) return DDS::kEventDisplay;
00215 if (strcmp(tmpstr.Data(),"other") ==0) return DDS::kOther;
00216 if (strcmp(tmpstr.Data(),"unknown") ==0) return DDS::kUnknownClientType;
00217 MSG("DDS",Msg::kWarning) << "DDS::GetClientType called with unknown"
00218 << "\nclienttype " << clienttype
00219 << " Return DDS::kUnknownClientType." << endl;
00220 return DDS::kUnknownClientType;
00221
00222 }
00223
00224
00225
00226
00227
00228
00229
00230
00231
00232