- package adapted to new HOMER version
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 16 Nov 2006 06:46:23 +0000 (06:46 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 16 Nov 2006 06:46:23 +0000 (06:46 +0000)
- started cleaning of logging

HLT/BASE/AliHLTLogging.cxx
HLT/BASE/AliHLTLogging.h
HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplay3D.cxx
HLT/TPCLib/OnlineDisplay/AliHLTTPCDisplayMain.cxx
HLT/TPCLib/OnlineDisplay/Makefile.am
HLT/configure.ac

index 93712ae..3e5cad9 100644 (file)
@@ -29,6 +29,11 @@ using namespace std;
 #include "AliHLTStdIncludes.h"
 #include "AliHLTLogging.h"
 
+// global logging buffer
+#define LOG_BUFFER_SIZE 100
+char gAliHLTLoggingBuffer[LOG_BUFFER_SIZE]="";
+char gAliHLTLoggingOriginBuffer[LOG_BUFFER_SIZE]="";
+
 /** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTLogging)
 
@@ -56,8 +61,6 @@ AliHLTLogging& AliHLTLogging::operator=(const AliHLTLogging&)
   return *this;
 }
 
-char AliHLTLogging::fLogBuffer[LOG_BUFFER_SIZE]="";
-char AliHLTLogging::fOriginBuffer[LOG_BUFFER_SIZE]="";
 AliHLTComponent_LogSeverity AliHLTLogging::fGlobalLogFilter=kHLTLogAll;
 AliHLTfctLogging AliHLTLogging::fLoggingFunc=NULL;
 
@@ -109,7 +112,7 @@ int AliHLTLogging::Message(void *param, AliHLTComponent_LogSeverity severity, co
 const char* AliHLTLogging::BuildLogString(const char *format, va_list ap) {
   int tgtLen=0;
   int iBufferSize=LOG_BUFFER_SIZE;
-  char* tgtBuffer=fLogBuffer;
+  char* tgtBuffer=gAliHLTLoggingBuffer;
   tgtBuffer[tgtLen]=0;
 
 #if (defined LOG_PREFIX)
@@ -126,7 +129,7 @@ const char* AliHLTLogging::BuildLogString(const char *format, va_list ap) {
       *tgtBuffer=0; // terminate the buffer
     }
   }
-  return fLogBuffer;
+  return gAliHLTLoggingBuffer;
 }
 
 int AliHLTLogging::Logging(AliHLTComponent_LogSeverity severity, const char* origin, const char* keyword, const char* format, ... ) {
@@ -150,19 +153,19 @@ int AliHLTLogging::LoggingVarargs( AliHLTComponent_LogSeverity severity, const c
     int iMaxSize=LOG_BUFFER_SIZE-1;
     int iPos=0;
     const char* separator="";
-    fOriginBuffer[iPos]=0;
+    gAliHLTLoggingOriginBuffer[iPos]=0;
     if (origin_class) {
       if ((int)strlen(origin_class)<iMaxSize-iPos) {
-       strcpy(&fOriginBuffer[iPos], origin_class);
+       strcpy(&gAliHLTLoggingOriginBuffer[iPos], origin_class);
        iPos+=strlen(origin_class);
        separator="::";
       }
     }
     if (origin_func) {
       if ((int)strlen(origin_func)+(int)strlen(separator)<iMaxSize-iPos) {
-       strcpy(&fOriginBuffer[iPos], separator);
+       strcpy(&gAliHLTLoggingOriginBuffer[iPos], separator);
        iPos+=strlen(separator);
-       strcpy(&fOriginBuffer[iPos], origin_func);
+       strcpy(&gAliHLTLoggingOriginBuffer[iPos], origin_func);
        iPos+=strlen(origin_func);
       }
     }
@@ -176,9 +179,9 @@ int AliHLTLogging::LoggingVarargs( AliHLTComponent_LogSeverity severity, const c
       message=AliHLTLogging::BuildLogString(format, args);
     }
     if (fLoggingFunc) {
-      iResult=(*fLoggingFunc)(NULL/*fParam*/, severity, fOriginBuffer, GetKeyword(), message);
+      iResult=(*fLoggingFunc)(NULL/*fParam*/, severity, gAliHLTLoggingOriginBuffer, GetKeyword(), message);
     } else {
-      iResult=Message(NULL/*fParam*/, severity, fOriginBuffer, GetKeyword(), message);
+      iResult=Message(NULL/*fParam*/, severity, gAliHLTLoggingOriginBuffer, GetKeyword(), message);
     }
     va_end(args);
   }
index ba0f33b..7e1b7c6 100644 (file)
@@ -13,9 +13,8 @@
 
 #include "AliHLTDataTypes.h"
 #include <TObject.h>
-#include <stdio.h>
+#include "AliHLTStdIncludes.h"
 
-#define LOG_BUFFER_SIZE 100 // global logging buffer
 //#define LOG_PREFIX ""       // logging prefix, for later extensions
 
 
@@ -100,8 +99,6 @@ protected:
 private:
   static  AliHLTComponent_LogSeverity fGlobalLogFilter;
   AliHLTComponent_LogSeverity fLocalLogFilter;
-  static char fLogBuffer[LOG_BUFFER_SIZE];
-  static char fOriginBuffer[LOG_BUFFER_SIZE];
   static AliHLTfctLogging fLoggingFunc;
   const char* fpDefaultKeyword;
   const char* fpCurrentKeyword;
index ed7c0f8..5c08d3f 100644 (file)
@@ -508,11 +508,13 @@ void AliHLTTPCDisplay3D::Draw(){
          printf( "Found raw data block %lu\n", blk );
 #endif
          // Check for corrupt data
+#if HOMER_VERSION >= 2
          AliHLTUInt64_t corruptFlag = reader->GetBlockStatusFlags( blk );
          if (corruptFlag & 0x00000001) {
            LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplayMain::ReadData","Block status flags") << "Data block is corrupt"<<ENDLOG; 
            continue;
          }
+#endif
 
          unsigned long rawDataBlock = (unsigned long) reader->GetBlockData( blk );
          unsigned long rawDataLen = reader->GetBlockDataLength( blk );
index 06e96e6..4281fbb 100644 (file)
@@ -470,12 +470,14 @@ void AliHLTTPCDisplayMain::DisplayEvent(Bool_t newRawSlice){
 
            if ( ~(unsigned long)0 != blk ){
 
+#if HOMER_VERSION >= 2
              // Check for corrupt data
              AliHLTUInt64_t corruptFlag = reader->GetBlockStatusFlags( blk );
              if (corruptFlag & 0x00000001) {
                LOG(AliHLTTPCLog::kError,"AliHLTTPCDisplayMain::ReadData","Block status flags") << "Data block is corrupt"<<ENDLOG; 
                continue;
              }
+#endif
 
 #if DEBUG
                printf( "Raw Data found for slice %u/patch %u\n", fSlicePadRow, patch );
@@ -747,6 +749,7 @@ void AliHLTTPCDisplayMain::ReadRawData(){
   while ( blk != ~(ULong_t)0 ) {
     HLTDebug( "Found raw data block %lu\n", blk );
 
+#if HOMER_VERSION >= 2
     // -- Check for corrupt data
     AliHLTUInt64_t corruptFlag = reader->GetBlockStatusFlags( blk );
     if (corruptFlag & 0x00000001) {
@@ -754,6 +757,7 @@ void AliHLTTPCDisplayMain::ReadRawData(){
       blk = reader->FindBlockNdx( rawID, " CPT", 0xFFFFFFFF, blk+1 );
       continue;
     }
+#endif
 
     void* rawDataBlock = (void*) reader->GetBlockData( blk );
     unsigned long rawDataLen = reader->GetBlockDataLength( blk );
index 6460184..02ba605 100644 (file)
@@ -47,6 +47,7 @@ libAliHLTTPCDisplay_la_LDFLAGS        = -L@ROOTLIBDIR@ \
                                  @ALIROOT_LDFLAGS@ \
                                  @ALIROOT_LIBS@ \
                                  @HOMER_LDFLAGS@ \
+                                 @HOMER_LIBS@ \
                                  -version-info 1:1:0
 
 # automatic generation of data and time of library build
index 016d2fd..b345ff9 100644 (file)
@@ -243,6 +243,8 @@ if test -z $with_pubsub || ! test -d $with_pubsub ; then
   with_pubsub=no
 fi
 AC_MSG_RESULT([$with_pubsub])
+HOMER_VERSION=1
+HOMER_LIBS=
 
 AH_TEMPLATE([HAVE_HOMERREADER],[the HLT PubSub Homer Reader interface])
 if test "x$with_pubsub" != "xno" ; then
@@ -271,12 +273,33 @@ if test "x$with_pubsub" != "xno" ; then
   with_homer=no
   AC_LANG_PUSH(C++)
   AC_CHECK_HEADER([HOMERReader.h],
-    [ AC_CHECK_LIB([HOMERReader],[_init],[with_homer=yes])])
+    [ AC_CHECK_LIB([HOMER],[_init],
+      [with_homer=yes
+       HOMER_LIBS="-lHOMER"],
+      [ AC_CHECK_LIB([HOMERReader],[_init],
+                     [with_homer=yes
+                     HOMER_LIBS="-lHOMERReader"])])
+      LIBS="$LIBS $HOMER_LIBS"
+      AC_MSG_CHECKING([for HOMER version])
+      dnl The Homer library has no versioning, so we do our own
+      dnl version           description
+      dnl ----------------------------------------------------------------------
+      dnl   1          inintial version
+      dnl   2          GetBlockStatusFlags added to the interface
+      AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <HOMERReader.h>],
+                                      [HOMERReader reader("dummy", 0);
+                                      reader.GetBlockStatusFlags(0);])],
+                                      [if test $HOMER_VERSION -lt 2 ; then HOMER_VERSION=2; fi],
+                                     [])
+      AC_MSG_RESULT([$HOMER_VERSION])
+  ]) #AC_CHECK_HEADER([HOMERReader.h])
   AC_LANG_POP(C++)
   if test "x$with_homer" = "xno" ; then
     HOMER_CPPFLAGS=
     HOMER_LDFLAGS=
+    HOMER_LIBS=
   else
+    HOMER_CPPFLAGS="$HOMER_CPPFLAGS -DHOMER_VERSION=$HOMER_VERSION"
     AC_DEFINE(HAVE_HOMERREADER)
   fi
   CPPFLAGS="$save_CPPFLAGS"
@@ -285,6 +308,7 @@ if test "x$with_pubsub" != "xno" ; then
 fi
 AC_SUBST([HOMER_CPPFLAGS])
 AC_SUBST([HOMER_LDFLAGS])
+AC_SUBST([HOMER_LIBS])
 
 dnl ------------------------------------------------------------------
 AC_MSG_CHECKING([whether to impose strict coding conventions])