00001
00098
00099 #ifndef CLDAQ__TTYPES_H
00100 #define CLDAQ__TTYPES_H
00101
00102 #include <iostream>
00103 #include <iomanip>
00104 #include <fstream>
00105 #include <string>
00106 #include <list>
00107 #include <vector>
00108 #include <map>
00109 #if (__GNUC__==3) && (__GNUC_MINOR__>0)
00110 #undef __DEPRECATED
00111 #endif
00112 #include <strstream>
00113 #include <stdio.h>
00114 #include <unistd.h>
00115
00116 #define Tfalse 0
00117 #define Ttrue 1
00118
00119 #define Tios std::ios
00120 #define Tin ios::inin
00121 #define Tout ios::out
00122 #define Tate ios::ate
00123 #define Tapp ios::app
00124 #define Ttrunc ios::trunc
00125 #define Tnocreate ios::nocreate
00126 #define Tnoreplace ios::noreplace
00127 #define Tbin ios::bin
00128 #define Tbinary ios::binary
00129 #define Tgoodbit ios::goodbit
00130 #define Teofbit ios::eofbit
00131 #define Tfailbit ios::failbit
00132 #define Tbadbit ios::badbit
00133 #define Tostream std::ostream
00134 #define Tstreambuf std::streambuf
00135 #define Tostrstream std::ostrstream
00136 #define Tistream std::istream
00137 #define Tlist std::list
00138 #define Tvector std::vector
00139 #define Tmap std::map
00140 #define Tmultimap std::multimap
00141 #define Tpair std::pair
00142 #define Tcin std::cin
00143
00144 #include "TOutputStream.hh"
00145 #ifdef __cplusplus
00146 extern "C" {
00147 #endif
00148 class TOutputStream;
00149 extern TOutputStream Tcout;
00150 extern TOutputStream Tcerr;
00151 extern TOutputStream Tclog;
00152
00153 class TStringStreamBuffer;
00154 extern TStringStreamBuffer coutbuf;
00155 extern TStringStreamBuffer cerrbuf;
00156 extern TStringStreamBuffer clogbuf;
00157
00158 #ifdef __cplusplus
00159 }
00160 #endif
00161
00162 #define Tendl std::endl
00163 #define Tends std::ends
00164 #define Tdec std::dec
00165 #define Thex std::hex
00166 #define Toct std::oct
00167 #define Tflush std::flush
00168 #define Tsizeof(_type_) sizeof(_type_)
00169
00170
00171 #define CLDAQ_DEBUG(m) \
00172 if ( strlen(m) ) {\
00173 Tcout << "[CLDAQ:DEBUG]: " << m << " in \"" << __PRETTY_FUNCTION__ << "\" at " << __FILE__ << " line " << __LINE__ << "." << Tendl;\
00174 } else {\
00175 Tcout << "[CLDAQ:DEBUG]: in \"" << __PRETTY_FUNCTION__ << "\" at " << __FILE__ << " line " << __LINE__ << "." << Tendl;\
00176 }
00177 #define CLDAQ_WARN(m) \
00178 if ( strlen(m) ) {\
00179 Tcerr << "[CLDAQ:WARNIG]: " << m << " in \"" << __PRETTY_FUNCTION__ << "\" at " << __FILE__ << " line " << __LINE__ << "." << Tendl;\
00180 } else {\
00181 Tcerr << "[CLDAQ:WARNIG]: in \"" << __PRETTY_FUNCTION__ << "\" at " << __FILE__ << " line " << __LINE__ << "." << Tendl;\
00182 }\
00183 perror( "[CLDAQ:WARNING]" );
00184 #define CLDAQ_EMERG(m) \
00185 if ( strlen(m) ) {\
00186 Tcerr << "[CLDAQ:EMERG]: " << m << " in \"" << __PRETTY_FUNCTION__ << "\" at " << __FILE__ << " line " << __LINE__ << "." << Tendl;\
00187 } else {\
00188 Tcerr << "[CLDAQ:EMERG]: in \"" << __PRETTY_FUNCTION__ << "\" at " << __FILE__ << " line " << __LINE__ << "." << Tendl;\
00189 }\
00190 perror( "[CLDAQ:EMERG]" );\
00191 abort();
00192 #define CLDAQ_ABORT(m) CLDAQ_EMERG(m)
00193 #define CLDAQ_EXIT(m) \
00194 if ( strlen(m) ) {\
00195 Tcerr << "[CLDAQ:EXIT]: " << m << " in \"" << __PRETTY_FUNCTION__ << "\" at " << __FILE__ << " line " << __LINE__ << "." << Tendl;\
00196 } else {\
00197 Tcerr << "[CLDAQ:EXIT]: in \"" << __PRETTY_FUNCTION__ << "\" at " << __FILE__ << " line " << __LINE__ << "." << Tendl;\
00198 }\
00199 perror( "[CLDAQ:EXIT]" );\
00200 exit(EXIT_SUCCESS);
00201
00202
00203 typedef double Tdouble;
00204 typedef int Tint;
00205 typedef float Tfloat;
00206 typedef char Tchar;
00207 typedef long Tlong;
00208 typedef unsigned char TUchar;
00209 typedef unsigned int TUint;
00210 typedef unsigned long TUlong;
00211 typedef short Tshort;
00212 typedef unsigned short TUshort;
00213 typedef bool Tbool;
00214 typedef Tbool Tbit;
00215 typedef FILE TFileStream;
00216 typedef size_t Tsize_t;
00217 typedef void Tvoid;
00218 typedef std::string Tstring;
00219 typedef std::ofstream Tofstream;
00220 typedef std::ifstream Tifstream;
00221 typedef Tvector<Tint> TintList;
00222 typedef Tvector<TUint> TUintList;
00223 typedef Tvector<TUshort> TUshortList;
00224 typedef Tvector<Tdouble> TdoubleList;
00225 typedef Tvector<Tfloat> TfloatList;
00226 typedef Tvector<Tstring> TstringList;
00227
00228 static const Tstring Tspace = " ";
00229 static const Tstring Thyphen = "-";
00230 static const Tstring Tslash = "/";
00231 static const Tstring Twslash = Tslash + Tslash;
00232 static const Tstring Tbslash = "\\";
00233 static const Tstring Tbackslash = Tbslash;
00234 static const Tstring Twquote = "\"";
00235 static const Tstring Tquote = "'";
00236 static const Tstring Tsharp = "#";
00237 static const Tstring Tpipe = "|";
00238 static const Tstring Tcolon = ":";
00239 static const Tstring Twspace = Tspace + Tspace;
00240 static const Tstring Ttab = "\t";
00241 static const Tstring Tbeep = "\b";
00242 static const Tstring Thour = "h";
00243 static const Tstring Tmin = "m";
00244 static const Tstring Tsec = "s";
00245 static const Tstring Tmsec = "ms";
00246 static const Tstring Tusec = "us";
00247 static const Tstring Tnsec = "ns";
00248 static const Tstring Tid = "$Id: Ttypes.h,v 1.27 2004/06/28 07:19:58 goiwai Exp $";
00249 static const Tstring Tname = "$Name: CLDAQ-1-14-03 $";
00250 static const Tstring Tproject = "CLDAQ";
00251 static const Tstring Tversion = "1.14.3";
00252 static const Tstring Texit = "exit";
00253 static const Tstring Tprompt = Tproject + Thyphen + Tversion + ">" + Tspace;
00254 static const Tchar Tkey = '\x01';
00255 static const Tchar Teol = '\n';
00256
00257 enum Tobject_t {
00258 tObjectDataRecord,
00259 tObjectDataSection,
00260 tObjectDataSegment,
00261 tObjectDataElement,
00262 tObject1DHistogram,
00263 tObject2DHistogram,
00264 tObjectAppendGraph,
00265 tObjectSubstituteGraph,
00266 tObjectNtuple,
00267 tNumberOfObjectTypes,
00268 tObjectUnknown = -1
00269 };
00270
00271 enum Telement_t {
00272 tTypeInt,
00273 tTypeString,
00274 tTypeDouble,
00275 tTypeObject,
00276 tTypeFloat,
00277 tTypeUnsignedShort,
00278 tTypeShort,
00279 tTypeWord,
00280 tTypeLong,
00281 tTypeUnsignedLong,
00282 tTypeUnsignedInt,
00283 tNumberOfElementTypes,
00284 tTypeUnknown = -1
00285 };
00286
00287 enum Tstream_t {
00288 tFileStream,
00289 tSocketStream,
00290 tSharedMemoryStream,
00291 tNumberOfStreamTypes,
00292 tUnknownStream = -1
00293 };
00294
00295 enum Trandom_t {
00296 tRandomExponential,
00297 tRandomGaussian,
00298 tRandomChiSquare,
00299 tRandomLandau,
00300 tRandomGamma,
00301 tRandomPoisson,
00302 tNumberOfRandomTypes,
00303 tRandomUnknown = -1
00304 };
00305
00306 enum Tstatus_t {
00307 tStatusStandby,
00308 tStatusReady,
00309 tStatusBusy,
00310 tStatusIdle,
00311 tStatusWaitingReady,
00312 tStatusJustTakingEvent,
00313 tStatusJustRecordingEvent,
00314 tStatusSleep,
00315 tStatusDead,
00316 tNumberOfStatusTypes,
00317 tStatusUnknown = -1
00318 };
00319
00320 enum TvmeTransfer_t {
00321 tA16D16,
00322 tA16D32,
00323 tA24D16,
00324 tA24D32,
00325 tA32D16,
00326 tA32D32,
00327 tA24D16dma,
00328 tA32D16dma,
00329 tA24D32dma,
00330 tA32D32dma,
00331 tNumberOfVmeTransferModes,
00332 tTransferModeUnknown = -1
00333 };
00334
00335
00336 static const Tstring TvmeDevices[ tNumberOfVmeTransferModes ] =
00337 {
00338 "/dev/vmedrv16d16",
00339 "/dev/vmedrv16d32",
00340 "/dev/vmedrv24d16",
00341 "/dev/vmedrv24d32",
00342 "/dev/vmedrv32d16",
00343 "/dev/vmedrv32d32",
00344 "/dev/vmedrv24d16dma",
00345 "/dev/vmedrv32d16dma",
00346 "/dev/vmedrv24d32dma",
00347 "/dev/vmedrv32d32dma"
00348 };
00349
00350 enum TcamacCrateController_t {
00351 tISAcc7000_1,
00352 tISAcc7000_2,
00353 tISAcc7000_3,
00354 tISAcc7000_4,
00355 tISAcc7700_1,
00356 tISAcc7700_2,
00357 tISAcc7700_3,
00358 tISAcc7700_4,
00359 tPCIcc7700_1,
00360 tPCIcc7700_2,
00361 tPCIcc7700_3,
00362 tPCIcc7700_4,
00363 tNumberOfCamacCrateController,
00364 tCamacCrateControllerUnknown = -1
00365 };
00366
00367
00368 static const Tstring TcamacDevices[ tNumberOfCamacCrateController ] =
00369 {
00370 "/dev/ISAcc7000.1",
00371 "/dev/ISAcc7000.2",
00372 "/dev/ISAcc7000.3",
00373 "/dev/ISAcc7000.4",
00374 "/dev/ISAcc7700.1",
00375 "/dev/ISAcc7700.2",
00376 "/dev/ISAcc7700.3",
00377 "/dev/ISAcc7700.4",
00378 "/dev/PCIcc7700.1",
00379 "/dev/PCIcc7700.2",
00380 "/dev/PCIcc7700.3",
00381 "/dev/PCIcc7700.4"
00382 };
00383
00384 enum Truninfo_t {
00385 tInfoFreeValue,
00386 tInfoSelectableValue,
00387 tInfoFreeText,
00388 tNumberOfInformations,
00389 tInfoUnknown = -1
00390 };
00391
00392 enum {
00393 tIDunknown = -1
00394 };
00395
00396 static const Tstring TunknownID = "unkown ID";
00397
00398 using namespace std;
00399
00400 #endif