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