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