00001
00056
00057 #ifndef __TTYPES_H
00058 #define __TTYPES_H
00059
00060 #include <iostream.h>
00061 #include <iomanip.h>
00062 #include <fstream.h>
00063 #include <string>
00064 #include <list>
00065 #include <vector>
00066 #include <map>
00067 #include <strstream.h>
00068 #include <stdio.h>
00069 #include <unistd.h>
00070
00071 #define Tfalse 0
00072 #define Ttrue 1
00073 #define Tstd std
00074 #define Tios Tstd::ios
00075 #define Tin Tios::inin
00076 #define Tout Tios::out
00077 #define Tate Tios::ate
00078 #define Tapp Tios::app
00079 #define Ttrunc Tios::trunc
00080 #define Tnocreate Tios::nocreate
00081 #define Tnoreplace Tios::noreplace
00082 #define Tbin Tios::bin
00083 #define Tbinary Tios::binary
00084 #define Tgoodbit Tios::goodbit
00085 #define Teofbit Tios::eofbit
00086 #define Tfailbit Tios::failbit
00087 #define Tbadbit Tios::badbit
00088 #define Tostream Tstd::ostream
00089 #define Tostrstream Tstd::ostrstream
00090 #define Tistream Tstd::istream
00091 #define Tlist Tstd::list
00092 #define Tvector Tstd::vector
00093 #define Tmap Tstd::map
00094 #define Tmultimap Tstd::multimap
00095 #define Tpair Tstd::pair
00096 #define Tcout Tstd::cout
00097 #define Tcin Tstd::cin
00098 #define Tcerr Tstd::cerr
00099 #define Tendl Tstd::endl
00100 #define Tends Tstd::ends
00101 #define Tdec Tstd::dec
00102 #define Thex Tstd::hex
00103 #define Toct Tstd::oct
00104 #define Tflush Tstd::flush
00105 #define Tsizeof(_type_) sizeof(_type_)
00106
00107
00108 #define CLDAQ_DEBUG(m) \
00109 if ( strlen(m) ) {\
00110 Tcout << "* [CLDAQ DEBUG]: "\
00111 << m << " at " << __LINE__ << " in \"" << __FILE__ << "\"." << Tendl;\
00112 } else {\
00113 Tcout << "* [CLDAQ DEBUG]: "\
00114 << "At " << __LINE__ << " in \"" << __FILE__ << "\"." << Tendl;\
00115 }
00116 #define CLDAQ_WARN(m) \
00117 if ( strlen(m) ) {\
00118 Tcerr << "** [CLDAQ WARNING]: "\
00119 << m << " at " << __LINE__ << " in \"" << __FILE__ << "\"." << Tendl;\
00120 } else {\
00121 Tcerr << "** [CLDAQ WARNING]: "\
00122 << "At " << __LINE__ << " in \"" << __FILE__ << "\"." << Tendl;\
00123 }\
00124 perror( "** [CLDAQ WARNING]" );
00125 #define CLDAQ_EMERG(m) \
00126 if ( strlen(m) ) {\
00127 Tcerr << "*** [CLDAQ EMERGENCY]: "\
00128 << m << " at " << __LINE__ << " in \"" << __FILE__ << "\"." << Tendl;\
00129 } else {\
00130 Tcerr << "*** [CLDAQ EMERGENCY]: "\
00131 << "At " << __LINE__ << " in \"" << __FILE__ << "\"." << Tendl;\
00132 }\
00133 perror( "*** [CLDAQ EMERGENCY]" );\
00134 abort();
00135 #define CLDAQ_ABORT(m) CLDAQ_EMERG(m)
00136 #define CLDAQ_EXIT(m) \
00137 if ( strlen(m) ) {\
00138 Tcout << "* [CLDAQ EXIT]: "\
00139 << m << " at " << __LINE__ << " in \"" << __FILE__ << "\"." << Tendl;\
00140 } else {\
00141 Tcout << "* [CLDAQ EXIT]: "\
00142 << "At " << __LINE__ << " in \"" << __FILE__ << "\"." << Tendl;\
00143 }\
00144 exit(EXIT_SUCCESS);
00145
00146
00147 typedef double Tdouble;
00148 typedef int Tint;
00149 typedef float Tfloat;
00150 typedef char Tchar;
00151 typedef long Tlong;
00152 typedef unsigned char TUchar;
00153 typedef unsigned int TUint;
00154 typedef unsigned long TUlong;
00155 typedef short Tshort;
00156 typedef unsigned short TUshort;
00157 typedef bool Tbool;
00158 typedef Tbool Tbit;
00159 typedef FILE TFileStream;
00160 typedef size_t Tsize_t;
00161 typedef void Tvoid;
00162 typedef Tstd::string Tstring;
00163 typedef Tstd::ofstream Tofstream;
00164 typedef Tstd::ifstream Tifstream;
00165 typedef Tvector<Tint> TintList;
00166 typedef Tvector<TUint> TUintList;
00167 typedef Tvector<TUshort> TUshortList;
00168 typedef Tvector<Tdouble> TdoubleList;
00169 typedef Tvector<Tfloat> TfloatList;
00170 typedef Tvector<Tstring> TstringList;
00171
00172 static const Tstring Tspace = " ";
00173 static const Tstring Thyphen = "-";
00174 static const Tstring Tslash = "/";
00175 static const Tstring Twslash = Tslash + Tslash;
00176 static const Tstring Tbslash = "\\";
00177 static const Tstring Tbackslash = Tbslash;
00178 static const Tstring Twquote = "\"";
00179 static const Tstring Tquote = "'";
00180 static const Tstring Tsharp = "#";
00181 static const Tstring Tpipe = "|";
00182 static const Tstring Tcolon = ":";
00183 static const Tstring Twspace = Tspace + Tspace;
00184 static const Tstring Ttab = "\t";
00185 static const Tstring Tbeep = "\b";
00186 static const Tstring Thour = "h";
00187 static const Tstring Tmin = "m";
00188 static const Tstring Tsec = "s";
00189 static const Tstring Tmsec = "ms";
00190 static const Tstring Tusec = "us";
00191 static const Tstring Tnsec = "ns";
00192 static const Tstring Tid = "$Id: Ttypes.h,v 1.14 2003/11/03 08:39:23 goiwai Exp $";
00193 static const Tstring Tname = "$Name: CLDAQ-1-10-00 $";
00194 static const Tstring Tproject = "CLDAQ";
00195 static const Tstring Tversion = "1.10.0";
00196 static const Tstring Texit = "exit";
00197 static const Tstring Tprompt = Tproject + Thyphen + Tversion + ">" + Tspace;
00198 static const Tchar Tkey = '\x01';
00199 static const Tchar Teol = '\n';
00200
00201 enum Tobject_t {
00202 tObjectDataRecord,
00203 tObjectDataSection,
00204 tObjectDataSegment,
00205 tObjectDataElement,
00206 tObject1DHistogram,
00207 tObject2DHistogram,
00208 tObjectAppendGraph,
00209 tObjectSubstituteGraph,
00210 tObjectNtuple,
00211 tNumberOfObjectTypes,
00212 tObjectUnknown = -1
00213 };
00214
00215 enum Telement_t {
00216 tTypeInt,
00217 tTypeString,
00218 tTypeDouble,
00219 tTypeObject,
00220 tTypeFloat,
00221 tTypeUnsignedShort,
00222 tTypeShort,
00223 tTypeWord,
00224 tTypeLong,
00225 tTypeUnsignedLong,
00226 tTypeUnsignedInt,
00227 tNumberOfElementTypes,
00228 tTypeUnknown = -1
00229 };
00230
00231 enum Tstream_t {
00232 tFileStream,
00233 tSocketStream,
00234 tSharedMemoryStream,
00235 tNumberOfStreamTypes,
00236 tUnknownStream = -1
00237 };
00238
00239 enum Trandom_t {
00240 tRandomExponential,
00241 tRandomGaussian,
00242 tRandomChiSquare,
00243 tRandomLandau,
00244 tRandomGamma,
00245 tRandomPoisson,
00246 tNumberOfRandomTypes,
00247 tRandomUnknown = -1
00248 };
00249
00250 enum Tstatus_t {
00251 tStatusStandby,
00252 tStatusReady,
00253 tStatusBusy,
00254 tStatusIdle,
00255 tStatusWaitingReady,
00256 tStatusJustTakingEvent,
00257 tStatusJustRecordingEvent,
00258 tStatusSleep,
00259 tStatusDead,
00260 tNumberOfStatusTypes,
00261 tStatusUnknown = -1
00262 };
00263
00264 enum TvmeTransfer_t {
00265 tA16D16,
00266 tA16D32,
00267 tA24D16,
00268 tA24D32,
00269 tA32D16,
00270 tA32D32,
00271 tA24D16dma,
00272 tA32D16dma,
00273 tA24D32dma,
00274 tA32D32dma,
00275 tNumberOfVmeTransferModes,
00276 tTransferModeUnknown = -1
00277 };
00278
00279
00280 static const Tstring TvmeDevices[ tNumberOfVmeTransferModes ] =
00281 {
00282 "/dev/vmedrv16d16",
00283 "/dev/vmedrv16d32",
00284 "/dev/vmedrv24d16",
00285 "/dev/vmedrv24d32",
00286 "/dev/vmedrv32d16",
00287 "/dev/vmedrv32d32",
00288 "/dev/vmedrv24d16dma",
00289 "/dev/vmedrv32d16dma",
00290 "/dev/vmedrv24d32dma",
00291 "/dev/vmedrv32d32dma"
00292 };
00293
00294 enum TcamacCrateController_t {
00295 tISAcc7000_1,
00296 tISAcc7000_2,
00297 tISAcc7000_3,
00298 tISAcc7000_4,
00299 tISAcc7700_1,
00300 tISAcc7700_2,
00301 tISAcc7700_3,
00302 tISAcc7700_4,
00303 tPCIcc7700_1,
00304 tPCIcc7700_2,
00305 tPCIcc7700_3,
00306 tPCIcc7700_4,
00307 tNumberOfCamacCrateController,
00308 tCamacCrateControllerUnknown = -1
00309 };
00310
00311
00312 static const Tstring TcamacDevices[ tNumberOfCamacCrateController ] =
00313 {
00314 "/dev/ISAcc7000.1",
00315 "/dev/ISAcc7000.2",
00316 "/dev/ISAcc7000.3",
00317 "/dev/ISAcc7000.4",
00318 "/dev/ISAcc7700.1",
00319 "/dev/ISAcc7700.2",
00320 "/dev/ISAcc7700.3",
00321 "/dev/ISAcc7700.4",
00322 "/dev/PCIcc7700.1",
00323 "/dev/PCIcc7700.2",
00324 "/dev/PCIcc7700.3",
00325 "/dev/PCIcc7700.4"
00326 };
00327
00328 enum Truninfo_t {
00329 tInfoFreeValue,
00330 tInfoSelectableValue,
00331 tInfoFreeText,
00332 tNumberOfInformations,
00333 tInfoUnknown = -1
00334 };
00335
00336 enum {
00337 tIDunknown = -1
00338 };
00339
00340 static const Tstring TunknownID = "unkown ID";
00341
00342 #endif