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