]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
- changes according to coding conventions and documentation
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 5 Jan 2007 14:09:48 +0000 (14:09 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 5 Jan 2007 14:09:48 +0000 (14:09 +0000)
- AliHLTTPCDigitReaderRaw: HAVE_TPC_MAPPING dependend implementation
  fixed in order to make class definition independend
- helper functions for data structure handling added
- libHLTbase.pkg and libAliHLTSample.pkg included to the stand-alone
  build system
- AliHLTFilePublisher added
- target to create the stand-alone sample library package added

29 files changed:
HLT/BASE/AliHLTComponent.cxx
HLT/BASE/AliHLTComponent.h
HLT/BASE/AliHLTComponentHandler.cxx
HLT/BASE/AliHLTComponentHandler.h
HLT/BASE/AliHLTConfiguration.cxx
HLT/BASE/AliHLTDataBuffer.cxx
HLT/BASE/AliHLTDataBuffer.h
HLT/BASE/AliHLTDataSource.cxx
HLT/BASE/AliHLTDataSource.h
HLT/BASE/AliHLTDataTypes.h
HLT/BASE/AliHLTFilePublisher.cxx [new file with mode: 0644]
HLT/BASE/AliHLTFilePublisher.h [new file with mode: 0644]
HLT/BASE/AliHLTSystem.cxx
HLT/BASE/AliHLTSystem.h
HLT/BASE/AliHLTTask.h
HLT/BASE/AliHLT_C_Component_WrapperInterface.h
HLT/BASE/Makefile.am
HLT/ChangeLog
HLT/Makefile.am
HLT/SampleLib/AliHLTDummyComponent.cxx
HLT/SampleLib/AliHLTSampleComponent1.cxx
HLT/SampleLib/AliHLTSampleComponent2.cxx
HLT/SampleLib/Makefile.am
HLT/SampleLib/README
HLT/SampleLib/acinclude.m4 [deleted file]
HLT/SampleLib/configure.ac
HLT/configure.ac
HLT/libAliHLTSample.pkg
HLT/libHLTbase.pkg

index 2f1c3fcc7f9f3094a178d3648f7554c733ba0980..19d94fcf1559cbc80d249efcbd3348e84dc15a96 100644 (file)
@@ -110,7 +110,7 @@ void* AliHLTComponent::AllocMemory( unsigned long size ) {
 int AliHLTComponent::MakeOutputDataBlockList( const vector<AliHLTComponentBlockData>& blocks, AliHLTUInt32_t* blockCount,
                                              AliHLTComponentBlockData** outputBlocks ) {
     if ( !blockCount || !outputBlocks )
-       return EFAULT;
+       return -EFAULT;
     AliHLTUInt32_t count = blocks.size();
     if ( !count )
        {
@@ -120,7 +120,7 @@ int AliHLTComponent::MakeOutputDataBlockList( const vector<AliHLTComponentBlockD
        }
     *outputBlocks = reinterpret_cast<AliHLTComponentBlockData*>( AllocMemory( sizeof(AliHLTComponentBlockData)*count ) );
     if ( !*outputBlocks )
-       return ENOMEM;
+       return -ENOMEM;
     for ( unsigned long i = 0; i < count; i++ )
        (*outputBlocks)[i] = blocks[i];
     *blockCount = count;
@@ -154,3 +154,46 @@ int AliHLTComponent::FindMatchingDataTypes(AliHLTComponent* pConsumer, vector<Al
   }
   return iResult;
 }
+
+void AliHLTComponent::FillBlockData( AliHLTComponentBlockData& blockData ) {
+  blockData.fStructSize = sizeof(blockData);
+  FillShmData( blockData.fShmKey );
+  blockData.fOffset = ~(AliHLTUInt32_t)0;
+  blockData.fPtr = NULL;
+  blockData.fSize = 0;
+  FillDataType( blockData.fDataType );
+  blockData.fSpecification = ~(AliHLTUInt32_t)0;
+}
+
+void AliHLTComponent::FillShmData( AliHLTComponentShmData& shmData ) {
+  shmData.fStructSize = sizeof(shmData);
+  shmData.fShmType = gkAliHLTComponentInvalidShmType;
+  shmData.fShmID = gkAliHLTComponentInvalidShmID;
+}
+
+void AliHLTComponent::FillDataType( AliHLTComponentDataType& dataType ) {
+  dataType.fStructSize = sizeof(dataType);
+  memset( dataType.fID, '*', kAliHLTComponentDataTypefIDsize );
+  memset( dataType.fOrigin, '*', kAliHLTComponentDataTypefOriginSize );
+}
+
+void AliHLTComponent::CopyDataType(AliHLTComponentDataType& tgtdt, const AliHLTComponentDataType& srcdt) {
+  memcpy(&tgtdt.fID[0], &srcdt.fID[0], kAliHLTComponentDataTypefIDsize);
+  memcpy(&tgtdt.fOrigin[0], &srcdt.fOrigin[0], kAliHLTComponentDataTypefOriginSize);
+}
+
+void AliHLTComponent::SetDataType(AliHLTComponentDataType& tgtdt, const char* id, const char* origin) {
+  tgtdt.fStructSize = sizeof(AliHLTComponentDataType);
+  memset(&tgtdt.fID[0], 0, kAliHLTComponentDataTypefIDsize);
+  memset(&tgtdt.fOrigin[0], 0, kAliHLTComponentDataTypefOriginSize);
+
+  if (strlen(id)>kAliHLTComponentDataTypefIDsize) {
+    HLTWarning("data type id %s is too long, truncated to %d", id, kAliHLTComponentDataTypefIDsize);
+  }
+  strncpy(&tgtdt.fID[0], id, kAliHLTComponentDataTypefIDsize);
+
+  if (strlen(origin)>kAliHLTComponentDataTypefOriginSize) {
+    HLTWarning("data type origin %s is too long, truncated to %d", origin, kAliHLTComponentDataTypefOriginSize);
+  }
+  strncpy(&tgtdt.fOrigin[0], origin, kAliHLTComponentDataTypefOriginSize);
+}
index efe730ee5959f1400e1ae2ba082102ea34ffdced..71422e6a729f18f4a6c9e00c035cf2ffeb54a84b 100644 (file)
 #include "AliHLTDefinitions.h"
 #include "TObject.h"
 
+/* Matthias Dec 2006
+ * The names have been changed for Aliroot's coding conventions sake
+ * The old names are defined for backward compatibility with the 
+ * stand alone SampleLib package
+ */
+typedef AliHLTComponentLogSeverity AliHLTComponent_LogSeverity;
+typedef AliHLTComponentEventData AliHLTComponent_EventData;
+typedef AliHLTComponentShmData AliHLTComponent_ShmData;
+typedef AliHLTComponentDataType AliHLTComponent_DataType;
+typedef AliHLTComponentBlockData AliHLTComponent_BlockData;
+typedef AliHLTComponentTriggerData AliHLTComponent_TriggerData;
+typedef AliHLTComponentEventDoneData AliHLTComponent_EventDoneData;
+
 class AliHLTComponentHandler;
 
 /**
@@ -90,8 +103,8 @@ class AliHLTComponent : public AliHLTLogging {
    * @param trigData
    * @param outputPtr
    * @param size
-   * @param outputBlockCnt
-   * @param outputBlocks
+   * @param outputBlockCnt  out: size of the output block array, set by the component
+   * @param outputBlocks    out: the output block array is allocated internally
    * @param edd
    * @return neg. error code if failed
    */
@@ -178,36 +191,42 @@ class AliHLTComponent : public AliHLTLogging {
    * Fill AliHLTComponentBlockData structure with default values.
    * @param blockData   reference to data structure
    */
-  void FillBlockData( AliHLTComponentBlockData& blockData ) {
-    blockData.fStructSize = sizeof(blockData);
-    FillShmData( blockData.fShmKey );
-    blockData.fOffset = ~(AliHLTUInt32_t)0;
-    blockData.fPtr = NULL;
-    blockData.fSize = 0;
-    FillDataType( blockData.fDataType );
-    blockData.fSpecification = ~(AliHLTUInt32_t)0;
-  }
+  void FillBlockData( AliHLTComponentBlockData& blockData );
 
   /**
    * Fill AliHLTComponentShmData structure with default values.
    * @param shmData   reference to data structure
    */
-  void FillShmData( AliHLTComponentShmData& shmData ) {
-    shmData.fStructSize = sizeof(shmData);
-    shmData.fShmType = gkAliHLTComponentInvalidShmType;
-    shmData.fShmID = gkAliHLTComponentInvalidShmID;
-  }
+  void FillShmData( AliHLTComponentShmData& shmData );
 
   /**
    * Fill AliHLTComponentDataType structure with default values.
    * @param dataType   reference to data structure
    */
-  void FillDataType( AliHLTComponentDataType& dataType ) {
-    dataType.fStructSize = sizeof(dataType);
-    memset( dataType.fID, '*', 8 );
-    memset( dataType.fOrigin, '*', 4 );
-  }
+  void FillDataType( AliHLTComponentDataType& dataType );
   
+  /**
+   * Copy data type structure
+   * Copies the value an AliHLTComponentDataType structure to another one
+   * @param[out] tgtdt   target structure
+   * @param[in] srcdt   source structure
+   */
+  void CopyDataType(AliHLTComponentDataType& tgtdt, const AliHLTComponentDataType& srcdt);
+
+  /**
+   * Set the ID and Origin of an AliHLTComponentDataType structure.
+   * The function sets the fStructureSize member and copies the strings
+   * to the ID and Origin. Only characters from the valid part of the string
+   * are copied, the rest is fille with 0's.
+   * Please note that the fID and fOrigin members are not strings, just arrays of
+   * chars of size @ref kAliHLTComponentDataTypefIDsize and
+   * @kAliHLTComponentDataTypefOriginSize respectively and not necessarily with
+   * a terminating zero.
+   * @param id      ID string
+   * @param origin  Origin string
+   */
+  void SetDataType(AliHLTComponentDataType& tgtdt, const char* id, const char* origin);
+
   /**
    * Default method for the internal initialization.
    * The method is called by @ref Init
index 7f11cf97de0c0d48d5ef0c365ce88a9a11986f53..3f060e2fcc858411be7ecd5b5161f9bcd4ed0e83 100644 (file)
@@ -113,7 +113,7 @@ Int_t AliHLTComponentHandler::ScheduleRegister(AliHLTComponent* pSample)
   return iResult;
 }
 
-int AliHLTComponentHandler::CreateComponent(const char* componentID, void* pEnv, int argc, const char** argv, AliHLTComponent*& component )
+int AliHLTComponentHandler::CreateComponent(const char* componentID, void* pEnvParam, int argc, const char** argv, AliHLTComponent*& component )
 {
   int iResult=0;
   if (componentID) {
@@ -122,7 +122,7 @@ int AliHLTComponentHandler::CreateComponent(const char* componentID, void* pEnv,
       component=pSample->Spawn();
       if (component) {
        HLTDebug("component \"%s\" created (%p)", componentID, component);
-       if ((iResult=component->Init(&fEnvironment, pEnv, argc, argv))!=0) {
+       if ((iResult=component->Init(&fEnvironment, pEnvParam, argc, argv))!=0) {
          HLTError("Initialization of component \"%s\" failed with error %d", componentID, iResult);
          delete component;
          component=NULL;
index 0124dabb20f47094d917e9cfc2991e182807368a..2ba8d1639ea10a688add568487c372f086cd0b17 100644 (file)
@@ -108,28 +108,36 @@ class AliHLTComponentHandler : public AliHLTLogging {
 
   /**
    * Create a component of the given name (ID).
+   * The method tries to find a registerd component of id \em componentID and calls
+   * the \em Spawn method of the template component. After successful creation of
+   * a new object, the Init method is called in order to initialize the environment
+   * and the component arguments. <br>
+   * The environment is the same for all components, but each component can
+   * have an additional private parameter \em pEnvParam.<br>
+   * The component arguments consist of an array of strings and the array size in the
+   * usual manner of the main() function.
    * @param componentID  ID of the component to create
-   * @param pEnv         environment for the component
+   * @param pEnvParam    environment parameter for the component
    * @param argc         number of arguments in argv
    * @param argv         argument array like in main()
    * @param component    reference to receive the create component instance
    * @return component pointer in component, neg. error code if failed
    */
-  int CreateComponent( const char* componentID, void* pEnv, 
+  int CreateComponent( const char* componentID, void* pEnvParam
                       int argc, const char** argv, AliHLTComponent*& component );
 
   /**
    * Create a component of the given name (ID).
    * Introduced for backward compatibility.
    * @param componentID  ID of the component to create
-   * @param pEnv         environment for the component
+   * @param pEnvParam    environment parameter for the component
    * @param component    reference to receive the create component instance
    * @return component pointer in component, neg. error code if failed
    */
-  int CreateComponent( const char* componentID, void* pEnv, 
+  int CreateComponent( const char* componentID, void* pEnvParam
                       AliHLTComponent*& component ) 
     {
-    return CreateComponent( componentID, pEnv, 0, NULL, component );
+    return CreateComponent( componentID, pEnvParam, 0, NULL, component );
     }
 
   /**
index 9fe5c1960b33ca7450197a4c07629866d318cb98..07ca303269e6a51bd3c99673111770a688301e84 100644 (file)
@@ -421,7 +421,7 @@ int AliHLTTask::Init(AliHLTConfiguration* pConf, AliHLTComponentHandler* pCH)
 {
   int iResult=0;
   if (fpConfiguration!=NULL && fpConfiguration!=pConf) {
-    HLTWarning("overriding previous reference to configuration object %p (%s) by %p",
+    HLTWarning("overriding existing reference to configuration object %p (%s) by %p",
               fpConfiguration, GetName(), pConf);
   }
   if (pConf!=NULL) fpConfiguration=pConf;
@@ -431,6 +431,8 @@ int AliHLTTask::Init(AliHLTConfiguration* pConf, AliHLTComponentHandler* pCH)
       const char** argv=NULL;
       if ((iResult=fpConfiguration->GetArguments(&argv))>=0) {
        argc=iResult; // just to make it clear
+       // TODO: we have to think about the optional environment parameter,
+       // currently just set to NULL. 
        iResult=pCH->CreateComponent(fpConfiguration->GetComponentID(), NULL, argc, argv, fpComponent);
        if (fpComponent) {
        } else {
@@ -450,7 +452,16 @@ int AliHLTTask::Init(AliHLTConfiguration* pConf, AliHLTComponentHandler* pCH)
 
 int AliHLTTask::Deinit()
 {
-  return 0;
+  int iResult=0;
+  AliHLTComponent* pComponent=GetComponent();
+  fpComponent=NULL;
+  if (pComponent) {
+    pComponent->Deinit();
+    delete pComponent;
+  } else {
+    HLTWarning("task %s (%p) doesn't seem to be in initialized", GetName(), this);
+  }
+  return iResult;
 }
 
 const char *AliHLTTask::GetName() const
@@ -540,14 +551,6 @@ void AliHLTTask::PrintDependencyTree(const char* id, int bFromConfiguration)
   }
 }
 
-/* this function is most likely depricated
-int AliHLTTask::InsertBlockData(AliHLTComponentBlockData* pBlock, AliHLTTask* pSource)
-{
-  int iResult=0;
-  return iResult;
-}
-*/
-
 int AliHLTTask::SetDependency(AliHLTTask* pDep)
 {
   int iResult=0;
@@ -622,14 +625,6 @@ int AliHLTTask::SetTarget(AliHLTTask* pTgt)
   return iResult;
 }
 
-/* this function is most likely depricated
-int AliHLTTask::BuildBlockDataArray(AliHLTComponentBlockData*& pBlockData)
-{
-  int iResult=0;
-  return iResult;
-}
-*/
-
 int AliHLTTask::StartRun()
 {
   int iResult=0;
@@ -661,9 +656,11 @@ int AliHLTTask::StartRun()
       }
 
       // component init
+      // the initialization of the component is done by the ComponentHandler after creation
+      // of the component.
       //iResult=Init( AliHLTComponentEnvironment* environ, void* environ_param, int argc, const char** argv );
 
-      // allocate internal task varables for bookkeeping aso.
+      // allocate internal task variables for bookkeeping aso.
       fpBlockDataArray=new AliHLTComponentBlockData[iNofInputDataBlocks];
       if (fpBlockDataArray) {
        fBlockDataArraySize=iNofInputDataBlocks;
@@ -682,13 +679,21 @@ int AliHLTTask::StartRun()
 int AliHLTTask::EndRun()
 {
   int iResult=0;
+  if (fpBlockDataArray) {
+    fBlockDataArraySize=0;
+    delete [] fpBlockDataArray;
+    fpBlockDataArray=0;
+  } else {
+    HLTWarning("task %s (%p) doesn't seem to be in running mode", GetName(), this);
+  }
   return iResult;
 }
 
 int AliHLTTask::ProcessTask()
 {
   int iResult=0;
-  if (fpComponent && fpBlockDataArray) {
+  AliHLTComponent* pComponent=GetComponent();
+  if (pComponent && fpBlockDataArray) {
     int iSourceDataBlock=0;
     int iInputDataVolume=0;
 
@@ -743,7 +748,7 @@ int AliHLTTask::ProcessTask()
     if (iResult>=0) {
       long unsigned int iConstBase=0;
       double fInputMultiplier=0;
-      fpComponent->GetOutputDataSize(iConstBase, fInputMultiplier);
+      pComponent->GetOutputDataSize(iConstBase, fInputMultiplier);
       int iOutputDataSize=int(fInputMultiplier*iInputDataVolume) + iConstBase;
       AliHLTUInt8_t* pTgtBuffer=fpDataBuffer->GetTargetBuffer(iOutputDataSize);
       AliHLTComponentEventData evtData;
@@ -753,7 +758,10 @@ int AliHLTTask::ProcessTask()
       AliHLTComponentBlockData* outputBlocks=NULL;
       AliHLTComponentEventDoneData* edd;
       if (pTgtBuffer!=NULL || iOutputDataSize==0) {
-       iResult=fpComponent->ProcessEvent(evtData, fpBlockDataArray, trigData, pTgtBuffer, size, outputBlockCnt, outputBlocks, edd);
+       iResult=pComponent->ProcessEvent(evtData, fpBlockDataArray, trigData, pTgtBuffer, size, outputBlockCnt, outputBlocks, edd);
+       if (iResult>=0) {
+         iResult=fpDataBuffer->SetSegments(pTgtBuffer, outputBlocks, outputBlockCnt);
+       }
       } else {
       }
     }
@@ -771,8 +779,8 @@ int AliHLTTask::ProcessTask()
          HLTError("Task %s (%p): realease of task %s (%p) failed with error %d", GetName(), this, pSrcTask->GetName(), pSrcTask, iTempRes);
        }
       } else {
-       HLTFatal("fatal internal error in ROOT list handling");
-       iResult=-EFAULT;
+       HLTFatal("internal error in ROOT list handling");
+       if (iResult>=0) iResult=-EFAULT;
       }
       subscribedTaskList.Remove(lnk);
       lnk=subscribedTaskList.FirstLink();
@@ -788,7 +796,7 @@ int AliHLTTask::ProcessTask()
   return iResult;
 }
 
-int AliHLTTask::GetNofMatchingDataBlocks(const AliHLTTask* pConsumerTask)
+int AliHLTTask::GetNofMatchingDataBlocks(const AliHLTTask* pConsumerTask) const
 {
   int iResult=0;
   if (pConsumerTask) {
@@ -804,7 +812,7 @@ int AliHLTTask::GetNofMatchingDataBlocks(const AliHLTTask* pConsumerTask)
   return iResult;
 }
 
-int AliHLTTask::GetNofMatchingDataTypes(const AliHLTTask* pConsumerTask)
+int AliHLTTask::GetNofMatchingDataTypes(const AliHLTTask* pConsumerTask) const
 {
   int iResult=0;
   if (pConsumerTask) {
@@ -867,8 +875,9 @@ int AliHLTTask::ClearSourceBlocks()
 void AliHLTTask::PrintStatus()
 {
   HLTLogKeyword("task properties");
-  if (fpComponent) {
-    HLTMessage("     component: %s (%p)", fpComponent->GetComponentID(), fpComponent);
+  AliHLTComponent* pComponent=GetComponent();
+  if (pComponent) {
+    HLTMessage("     component: %s (%p)", pComponent->GetComponentID(), pComponent);
   } else {
     HLTMessage("     no component set!");
   }
index fc1bb5ffbf195b2b33d72ea1963ad4808cf47846..fa557ad72755193f7bdda5042a097c9fc5f7a96a 100644 (file)
@@ -87,7 +87,7 @@ int AliHLTConsumerDescriptor::CheckActiveDataSegment(AliHLTUInt32_t offset, AliH
   if (fSegments.size()>0) {
     vector<AliHLTDataSegment>::iterator segment=fSegments.begin();
     while (segment!=fSegments.end()) {
-      if (iResult=((*segment).fSegmentOffset==offset && (*segment).fSegmentSize==size)) {
+      if ((iResult=((*segment).fSegmentOffset==offset && (*segment).fSegmentSize==size))>0) {
        break;
       }
       segment++;
@@ -105,13 +105,13 @@ int AliHLTConsumerDescriptor::ReleaseActiveDataSegment(AliHLTUInt32_t offset, Al
   if (fSegments.size()>0) {
     vector<AliHLTDataSegment>::iterator segment=fSegments.begin();
     while (segment!=fSegments.end()) {
-      if (iResult=((*segment).fSegmentOffset==offset && (*segment).fSegmentSize==size)) {
+      if ((iResult=((*segment).fSegmentOffset==offset && (*segment).fSegmentSize==size))>0) {
        fSegments.erase(segment);
        break;
       }
       segment++;
     }
-    if (iResult=0) {
+    if (iResult==0) {
       //HLTWarning("no data segment (%d:%d) active for consumer %p", offset, size, this);
       iResult=-ENOENT;
     }
index 90a0ebcc55c2ab2a037f885e074472dda9a2046f..68731de08122ee7a61c356a06a980533cb88e41f 100644 (file)
@@ -251,7 +251,7 @@ class AliHLTDataBuffer : public TObject, public AliHLTLogging {
    * This is usually done after the component has written the data to the buffer, 
    * which was requested by the @ref GetTargetBuffer method. The component might
    * produce different types of data, for each type a segment has to be defined
-   * which describes the data inside the bauffer.<br>
+   * which describes the data inside the buffer.<br>
    * The @ref AliHLTComponentBlockData segment descriptor comes directly from the
    * @ref AliHLTComponent::ProcessEvent method.
    * @param pTgt            the target buffer which the segments refer to
index 435206e3c37c4e1af52697b2adfcd8c9f595c463..80fdab33f647a6d183cc0272fc2a6bc1f6238d67 100644 (file)
@@ -37,6 +37,12 @@ AliHLTDataSource::~AliHLTDataSource()
 { 
 }
 
+void AliHLTDataSource::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
+{
+  list.clear(); // there are no input data types
+}
+
+
 int AliHLTDataSource::ProcessEvent( const AliHLTComponentEventData& evtData,
                                    const AliHLTComponentBlockData* blocks, 
                                    AliHLTComponentTriggerData& trigData,
index 869183edb2facbb9330cfa4b037488d8ef86cbaf..54ce3b409c73d87883e9bdfcd8c814595d60c89f 100644 (file)
@@ -23,7 +23,6 @@
  * - @ref DoDeinit (optional)
  * - @ref GetEvent
  * - @ref GetComponentID
- * - @ref GetInputDataTypes
  * - @ref GetOutputDataType
  * - @ref GetOutputDataSize
  * - @ref Spawn
@@ -60,6 +59,12 @@ class AliHLTDataSource : public AliHLTComponent {
    */
   TComponentType GetComponentType() { return AliHLTComponent::kSource;}
 
+  /**
+   * Default implementation for all data sources.
+   * There are no input data types.
+   */
+  void AliHLTDataSource::GetInputDataTypes( vector<AliHLTComponentDataType>& list);
+
  private:
   /**
    * Data processing method for the component.
index a6f331f4db06ddcb675e9cd0351bd4b8a11ebe2c..32fa980daa389b7598a79b51d4d6bd8f263d5ecc 100644 (file)
@@ -46,12 +46,18 @@ extern "C" {
     const AliHLTUInt32_t gkAliHLTComponentInvalidShmType = 0;
     const AliHLTUInt64_t gkAliHLTComponentInvalidShmID = ~(AliHLTUInt64_t)0;
 
+  const int kAliHLTComponentDataTypefIDsize=8;
+  const int kAliHLTComponentDataTypefOriginSize=4;
   struct AliHLTComponentDataType
   {
     AliHLTUInt32_t fStructSize;
-    char fID[8];
-    char fOrigin[4];
+    char fID[kAliHLTComponentDataTypefIDsize];
+    char fOrigin[kAliHLTComponentDataTypefOriginSize];
   };
+
+# define kAliHLTVoidDataTypeID "\0\0\0\0\0\0\0"
+# define kAliHLTVoidDataOrigin "\0\0\0"
+  const AliHLTComponentDataType kAliHLTVoidDataType = {sizeof(AliHLTComponentDataType), kAliHLTVoidDataTypeID, kAliHLTVoidDataOrigin};
   
   struct AliHLTComponentBlockData
   {
@@ -95,10 +101,10 @@ extern "C" {
 
 inline bool operator==( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
     {
-    for ( unsigned i = 0; i < 8; i++ )
+    for ( unsigned i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
        if ( dt1.fID[i] != dt2.fID[i] )
            return false;
-    for ( unsigned i = 0; i < 4; i++ )
+    for ( unsigned i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
        if ( dt1.fOrigin[i] != dt2.fOrigin[i] )
            return false;
     return true;
@@ -106,10 +112,10 @@ inline bool operator==( const AliHLTComponentDataType& dt1, const AliHLTComponen
 
 inline bool operator!=( const AliHLTComponentDataType& dt1, const AliHLTComponentDataType& dt2 )
     {
-    for ( unsigned i = 0; i < 8; i++ )
+    for ( unsigned i = 0; i < kAliHLTComponentDataTypefIDsize; i++ )
        if ( dt1.fID[i] != dt2.fID[i] )
            return true;
-    for ( unsigned i = 0; i < 4; i++ )
+    for ( unsigned i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ )
        if ( dt1.fOrigin[i] != dt2.fOrigin[i] )
            return true;
     return false;
diff --git a/HLT/BASE/AliHLTFilePublisher.cxx b/HLT/BASE/AliHLTFilePublisher.cxx
new file mode 100644 (file)
index 0000000..1754c75
--- /dev/null
@@ -0,0 +1,237 @@
+// $Id$
+
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Authors: Matthias Richter <Matthias.Richter@ift.uib.no>                *
+ *          for The ALICE Off-line Project.                               *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/** @file   AliHLTFilePublisher.cxx
+    @author Matthias Richter
+    @date   
+    @brief  HLT file publisher component implementation. */
+
+#if __GNUC__>= 3
+using namespace std;
+#endif
+
+#include "AliHLTFilePublisher.h"
+#include <TObjString.h>
+#include <TMath.h>
+#include <TFile.h>
+
+/** ROOT macro for the implementation of ROOT specific class methods */
+ClassImp(AliHLTFilePublisher)
+
+AliHLTFilePublisher::AliHLTFilePublisher()
+  :
+  fFileNames(),
+  fFiles(),
+  fpCurrent(NULL),
+  fDataType(kAliHLTVoidDataType),
+  fSpecification(~(AliHLTUInt32_t)0),
+  fMaxSize(0)
+{
+  // make the lists owners of their objects in order to automatically
+  // de-allocate the objects
+  fFileNames.SetOwner();
+  fFiles.SetOwner();
+}
+
+AliHLTFilePublisher::AliHLTFilePublisher(const AliHLTFilePublisher&)
+  :
+  fFileNames(),
+  fFiles(),
+  fpCurrent(NULL),
+  fDataType(kAliHLTVoidDataType),
+  fSpecification(0),
+  fMaxSize(0)
+{
+  HLTFatal("copy constructor untested");
+}
+
+AliHLTFilePublisher& AliHLTFilePublisher::operator=(const AliHLTFilePublisher&)
+{ 
+  HLTFatal("assignment operator untested");
+  return *this;
+}
+
+AliHLTFilePublisher::~AliHLTFilePublisher()
+{
+  // file list and file name list are owner of their objects and
+  // delete all the objects
+}
+
+const char* AliHLTFilePublisher::GetComponentID()
+{
+  return "FilePublisher";
+}
+
+void AliHLTFilePublisher::GetInputDataTypes( vector<AliHLTComponentDataType>& list)
+{
+  list.clear();
+}
+
+AliHLTComponentDataType AliHLTFilePublisher::GetOutputDataType()
+{
+  return (AliHLTComponentDataType){ sizeof(AliHLTComponentDataType), kAliHLTVoidDataTypeID, kAliHLTVoidDataOrigin};
+}
+
+void AliHLTFilePublisher::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
+{
+  constBase=fMaxSize;
+  inputMultiplier=1.0;
+}
+
+AliHLTComponent* AliHLTFilePublisher::Spawn()
+{
+  return new AliHLTFilePublisher;
+}
+
+int AliHLTFilePublisher::DoInit( int argc, const char** argv )
+{
+  int iResult=0;
+  TString argument="";
+  int bMissingParam=0;
+  for (int i; i<argc; i++) {
+    argument=argv[i];
+
+    // -datafile
+    if (argument.CompareTo("-datafile")==0) {
+      if ((bMissingParam=(++i>=argc))) break;
+      TObjString* parameter=new TObjString(argv[i]);
+      if (parameter) {
+       fFileNames.Add(parameter);
+      } else {
+       iResult=-ENOMEM;
+      }
+
+      // -datafilelist
+    } else if (argument.CompareTo("-datafilelist")==0) {
+      if ((bMissingParam=(++i>=argc))) break;
+      HLTWarning("-datafilelist option not yet implemented");
+
+      // -datatype
+    } else if (argument.CompareTo("-datatype")==0) {
+      if ((bMissingParam=(++i>=argc))) break;
+      memcpy(&fDataType.fID, argv[i], TMath::Min(kAliHLTComponentDataTypefIDsize, (Int_t)strlen(argv[i])));
+
+      // -dataspec
+    } else if (argument.CompareTo("-dataspec")==0) {
+      if ((bMissingParam=(++i>=argc))) break;
+      TString parameter(argv[i]);
+      if (parameter.IsDigit()) {
+       fSpecification=(AliHLTUInt32_t)parameter.Atoi();
+      } else {
+       HLTError("wrong parameter for argument %s, number expected", argument.Data());
+       iResult=-EINVAL;
+      }
+      // -dataorigin
+    } else if (argument.CompareTo("-dataorigin")==0) {
+      if ((bMissingParam=(++i>=argc))) break;
+      memcpy(&fDataType.fOrigin, argv[i], TMath::Min(kAliHLTComponentDataTypefOriginSize,(Int_t)strlen(argv[i])));
+    } else {
+      HLTError("unknown argument %s", argument.Data());
+      iResult=-EINVAL;
+    }
+  }
+  if (bMissingParam) {
+    HLTError("missing parameter for argument %s", argument.Data());
+    iResult=-EINVAL;
+  }
+  if (fFileNames.GetSize()==0) {
+    HLTError("the publisher needs at least one file argument");
+    iResult=-EINVAL;
+  }
+  if (iResult>=0) iResult=OpenFiles();
+  if (iResult<0) {
+    fFileNames.Clear();
+  }
+  return iResult;
+}
+
+int AliHLTFilePublisher::OpenFiles()
+{
+  int iResult=0;
+  TObjLink *lnk=fFileNames.FirstLink();
+  while (lnk && iResult>=0) {
+    TObjString* pFileName=(TObjString*)lnk->GetObject();
+    if (pFileName) {
+      TString fullFN= pFileName->GetString() + "?filetype=raw";
+      TFile* pFile = new TFile(fullFN);
+      if (pFile) {
+       if (pFile->IsZombie()==0) {
+         fFiles.Add(pFile);
+         if (pFile->GetSize()>fMaxSize) fMaxSize=pFile->GetSize();
+       } else {
+         HLTError("can not open file %s", (pFileName->GetString()).Data());
+         fFiles.Clear();
+         iResult=-ENOENT;
+       }
+      }
+    }
+    lnk = lnk->Next();
+  }
+
+  return iResult;
+}
+
+int AliHLTFilePublisher::DoDeinit()
+{
+  int iResult=0;
+  fFileNames.Clear();
+  fFiles.Clear();
+  return iResult;
+}
+
+int AliHLTFilePublisher::GetEvent( const AliHLTComponentEventData& evtData,
+             AliHLTComponentTriggerData& trigData,
+             AliHLTUInt8_t* outputPtr, 
+             AliHLTUInt32_t& size,
+             vector<AliHLTComponentBlockData>& outputBlocks )
+{
+  int iResult=0;
+  TFile * pFile=NULL;
+  TObjLink *lnk;
+  if (fpCurrent) lnk=fpCurrent->Next();
+  if (lnk==NULL) lnk=fFiles.FirstLink();
+  fpCurrent=lnk;
+  if (lnk) {
+    TFile* pFile=(TFile*)lnk->GetObject();
+    if (pFile) {
+      int iCopy=pFile->GetSize();
+      if (iCopy>size) {
+       iCopy=size;
+       HLTWarning("buffer to small, data of file %s truncated", pFile->GetName());
+      }
+      if (pFile->ReadBuffer((char*)outputPtr, iCopy)!=0) {
+       // ReadBuffer returns 1 in case of failure and 0 in case of success
+       iResult=-EIO;
+      } else {
+       AliHLTComponentBlockData bd;
+       FillBlockData(bd);
+       bd.fPtr=outputPtr;
+       bd.fOffset=0;
+       bd.fSize=iCopy;
+       bd.fDataType=fDataType;
+       bd.fSpecification=fSpecification;
+       outputBlocks.push_back(bd);
+       size=iCopy;
+      }
+    } else {
+      iResult=-EFAULT;
+    }
+  } else {
+    iResult=-ENOENT;
+  }
+  return iResult;
+}
diff --git a/HLT/BASE/AliHLTFilePublisher.h b/HLT/BASE/AliHLTFilePublisher.h
new file mode 100644 (file)
index 0000000..b45d14d
--- /dev/null
@@ -0,0 +1,97 @@
+// @(#) $Id$
+
+#ifndef ALIHLTFILEPUBLISHER_H
+#define ALIHLTFILEPUBLISHER_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/** @file   AliHLTFilePublisher.h
+    @author Matthias Richter
+    @date   
+    @brief  An HLT file publishing (data source) component.
+    @note   The class is used in Offline (AliRoot) context
+*/
+
+#include "AliHLTDataSource.h"
+#include <TList.h>
+
+/**
+ * @class AliHLTFilePublisher
+ * An HLT data source component which publishes data from one or a sequence
+ * of files.<br>
+ * Mandatory arguments: <br>
+ * <!-- NOTE: ignore the \li. <i> and </i>: it's just doxygen formating -->
+ * \li -datafile     <i> filename      </i>
+ * \li -datafilelist <i> file pattern  </i>
+ * \li -datatype     <i> data type     </i>
+ * \li -dataspec     <i> specification </i>
+ * \li -dataorigin   <i> origin        </i>
+ *
+ * Optional arguments:<br>
+ *
+ * The component needs at least one argument \em -datafile or \em -datafilelist.
+ * Both can occur multiple times.
+ * @ingroup alihlt_component
+ */
+class AliHLTFilePublisher : public AliHLTDataSource  {
+ public:
+  /** standard constructor */
+  AliHLTFilePublisher();
+  /** not a valid copy constructor, defined according to effective C++ style */
+  AliHLTFilePublisher(const AliHLTFilePublisher&);
+  /** not a valid assignment op, but defined according to effective C++ style */
+  AliHLTFilePublisher& operator=(const AliHLTFilePublisher&);
+  /** destructor */
+  virtual ~AliHLTFilePublisher();
+
+  const char* GetComponentID();
+  void GetInputDataTypes( vector<AliHLTComponentDataType>& list);
+  AliHLTComponentDataType GetOutputDataType();
+  void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier );
+  AliHLTComponent* Spawn();
+
+  /**
+   * Open all files.
+   * Opens all files from the file name list @ref fFileNames and adds TFile
+   * opjects to the TFiles list.
+   */
+  int OpenFiles();
+
+ protected:
+  /**
+   * Init method.
+   */
+  int DoInit( int argc, const char** argv );
+
+  /**
+   * Deinit method.
+   */
+  int DoDeinit();
+
+  /**
+   * Data processing method for the component.
+   * @param evtData       event data structure
+   * @param trigData     trigger data structure
+   * @param outputPtr    pointer to target buffer
+   * @param size         <i>input</i>: size of target buffer
+   *                     <i>output</i>:size of produced data
+   * @param outputBlocks  list to receive output block descriptors
+   * @return
+   */
+  int GetEvent( const AliHLTComponentEventData& evtData,
+                       AliHLTComponentTriggerData& trigData,
+                       AliHLTUInt8_t* outputPtr, 
+                       AliHLTUInt32_t& size,
+                       vector<AliHLTComponentBlockData>& outputBlocks );
+
+ private:
+  TList                   fFileNames;
+  TList                   fFiles;
+  TObjLink*               fpCurrent; //! transient value
+  AliHLTComponentDataType fDataType;
+  AliHLTUInt32_t          fSpecification;
+  Int_t                   fMaxSize;
+
+  ClassDef(AliHLTFilePublisher, 0)
+};
+#endif
index f140e0d29586982e87e55ca45cb1a41450693fc1..23567ba2fa4ed0c6a5f30d4064821a3f84d61225 100644 (file)
@@ -32,6 +32,7 @@ using namespace std;
 #include "AliHLTConfiguration.h"
 #include "AliHLTConfigurationHandler.h"
 #include "AliHLTTask.h"
+#include "TString.h"
 
 /** ROOT macro for the implementation of ROOT specific class methods */
 ClassImp(AliHLTSystem)
@@ -78,16 +79,17 @@ AliHLTSystem& AliHLTSystem::operator=(const AliHLTSystem&)
 
 AliHLTSystem::~AliHLTSystem()
 {
-    AliHLTConfiguration::GlobalDeinit();
-    if (fpConfigurationHandler) {
-      delete fpConfigurationHandler;
-    }
-    fpConfigurationHandler=NULL;
-
-    if (fpComponentHandler) {
-      delete fpComponentHandler;
-    }
-    fpComponentHandler=NULL;
+  CleanTaskList();
+  AliHLTConfiguration::GlobalDeinit();
+  if (fpConfigurationHandler) {
+    delete fpConfigurationHandler;
+  }
+  fpConfigurationHandler=NULL;
+  
+  if (fpComponentHandler) {
+    delete fpComponentHandler;
+  }
+  fpComponentHandler=NULL;
 }
 
 int AliHLTSystem::AddConfiguration(AliHLTConfiguration* pConf)
@@ -260,12 +262,38 @@ void AliHLTSystem::PrintTaskList()
   }
 }
 
+void AliHLTSystem::PrintComponentDataTypeInfo(const AliHLTComponentDataType& dt) {
+  TString msg;
+  msg.Form("AliHLTComponentDataType(%d): ID=\"", dt.fStructSize);
+  for ( unsigned i = 0; i < kAliHLTComponentDataTypefIDsize; i++ ) {
+   if (dt.fID[i]!=0) msg+=dt.fID[i];
+   else msg+="\\0";
+  }
+  msg+="\" Origin=\"";
+  for ( unsigned i = 0; i < kAliHLTComponentDataTypefOriginSize; i++ ) {
+   if (dt.fOrigin[i]!=0) msg+=dt.fOrigin[i];
+   else msg+="\\0";
+  }
+  msg+="\"";
+  HLTMessage(msg.Data());
+}
+
 int AliHLTSystem::Run(Int_t iNofEvents) 
 {
   int iResult=0;
   if ((iResult=StartTasks())>=0) {
     for (int i=0; i<iNofEvents && iResult>=0; i++) {
       iResult=ProcessTasks(i);
+      if (iResult>=0) {
+       HLTInfo("Event %d successfully finished (%d)", i, iResult);
+       iResult=0;
+      } else {
+       HLTError("Processing of event %d failed (%d)", i, iResult);
+       // TODO: define different running modes to either ignore errors in
+       // event processing or not
+       // currently ignored 
+       iResult=0;
+      }
     }
     StopTasks();
   } else {
index 77b2283bd80ddfee1bc13af72e3b29f24880feaf..c48cb6e96a7b2812ba631d2e7a97a575b946a24b 100644 (file)
@@ -114,6 +114,11 @@ class AliHLTSystem : public AliHLTLogging {
    */
   void PrintTaskList();
 
+  /**
+   * Print info on an AliHLTComponentDataType structure
+   */
+  void PrintComponentDataTypeInfo(const AliHLTComponentDataType& dt);
+
   /**
    * Run the task list.
    * All tasks of the list will be subsequently processed for each event.
index e014888492e9c1b6abc2f2426a6d7ec953facbb5..fbb1f77b30b1090816efa9a9a42c968619ca08e6 100644 (file)
@@ -61,7 +61,8 @@ class AliHLTTask : public TObject, public AliHLTLogging {
   /**
    * Initialize the task.
    * The task is initialized with a configuration descriptor. It needs a
-   * component handler instance to create the analysis component.
+   * component handler instance to create the analysis component. The
+   * component is created and initialized.
    * @param pConf pointer to configuration descriptor, can be NULL if it
    *              was already provided to the constructor
    * @param pCH   the HLT component handler
@@ -70,7 +71,8 @@ class AliHLTTask : public TObject, public AliHLTLogging {
 
   /**
    * De-Initialize the task.
-   * Final cleanup after the run. The analysis component is deleted.
+   * Final cleanup after the run. The @ref AliHLTComponent::Deinit method of
+   * the component is called. The analysis component is deleted.
    */
   int Deinit();
 
@@ -105,18 +107,6 @@ class AliHLTTask : public TObject, public AliHLTLogging {
    */
   AliHLTTask* FindDependency(const char* id);
 
-  /*
-   * insert block data to the list
-   * the data has to come from a task the current one depends on
-   * result:
-   *    -EEXIST : the block data from this task has already been inserted
-   *    -ENOENT : no dependencies to the task the data is coming from
-   */
-  /*
-   * this function is most likely depricated
-  int InsertBlockData(AliHLTComponentBlockData* pBlock, AliHLTTask* pSource);
-  */
-
   /**
    * Add a dependency for the task.
    * The task maintains a list of other tasks it depends on.
@@ -160,27 +150,18 @@ class AliHLTTask : public TObject, public AliHLTLogging {
    */
   int SetTarget(AliHLTTask* pDep);
 
-  // build a monolithic array of block data
-  // @param pBlockData reference to the block data target
-  // @return: array size, pointer to array in the target pTgt
-  //
-  /* this function is most likely depricated
-  int BuildBlockDataArray(AliHLTComponentBlockData*& pBlockData);
-  */
-
   /**
    * Prepare the task for event processing.
    * The method initializes the Data Buffer and calls the
    * @ref AliHLTComponent::Init method of the component.<br>
-   * The @ref ProcessTask methode can be called an arbitrary number of times
+   * The @ref ProcessTask method can be called an arbitrary number of times
    * as soon as the task is in <i>running</i> mode. 
    */
   int StartRun();
 
   /**
    * Clean-up the task after event processing.
-   * The method cleans up internal structures and calls the
-   * @ref AliHLTComponent::Deinit method of the component.
+   * The method cleans up internal structures.
    */
   int EndRun();
 
@@ -209,7 +190,7 @@ class AliHLTTask : public TObject, public AliHLTLogging {
    * @param pConsumerTask   the task which subscribes to the data
    * @return number of matching data blocks
    */
-  int GetNofMatchingDataBlocks(const AliHLTTask* pConsumerTask);
+  int GetNofMatchingDataBlocks(const AliHLTTask* pConsumerTask) const;
 
   /**
    * Determine the number of matching data types between the component and a
@@ -218,7 +199,7 @@ class AliHLTTask : public TObject, public AliHLTLogging {
    * @param pConsumerTask   the task which subscribes to the data
    * @return number of matching data types
    */
-  int GetNofMatchingDataTypes(const AliHLTTask* pConsumerTask);
+  int GetNofMatchingDataTypes(const AliHLTTask* pConsumerTask) const;
 
   /**
    * Subscribe to the data of a source task.
@@ -276,7 +257,7 @@ class AliHLTTask : public TObject, public AliHLTLogging {
    * Get number of source tasks.
    * @return number of source tasks
    */
-  int GetNofSources() {return fListDependencies.GetSize();}
+  int GetNofSources() const {return fListDependencies.GetSize();}
 
  private:
   /** the configuration descriptor (external pointer) */
index cd388be234af35270deeb0a6cdaa126a8c67bfa2..cc8dbd89164e266dd6e1b8f7de787c5cd5d47854 100644 (file)
  */
 
 #include <AliHLTDataTypes.h>
+/* Matthias Dec 2006
+ * The names have been changed for Aliroot's coding conventions sake
+ * The old names are defined for backward compatibility with the 
+ * PublisherSubscriber framework
+ */
 typedef AliHLTComponentLogSeverity AliHLTComponent_LogSeverity;
 typedef AliHLTComponentEventData AliHLTComponent_EventData;
 typedef AliHLTComponentShmData AliHLTComponent_ShmData;
index 8f9fe1f40d2bc1edd631891e3177c090e22a8650..d4a186c4f6f1600a724422f924ff6127732beae6 100644 (file)
@@ -1,6 +1,11 @@
 # $Id$
 # Makefile template for the Alice HLT framework
 
+# be aware of the two different meanings of 'MODULE'
+# 1. AliRoot classifies each detector and main sub-package as a module
+#    so for all HLT library packages MODULE is equal HLT
+# 2. The HLT stand-alone build system knows about sub-modules
+#    e.g. for libHLTbase, MODULE=HLTbase
 MODULE                         = HLTbase
 
 AM_CPPFLAGS                    = -DMODULE=$(MODULE)
@@ -10,48 +15,24 @@ bin_SCRIPTS                 = setenv.sh setenv.csh
 # library definition
 lib_LTLIBRARIES                        =  libHLTbase.la
 
+# version info for the library
+LIBRARY_VERSION                        = '1:1:0'
+
+# MODDIR is set by the AliRoot build system and denotes the topdir
+# of the module, we must set it since the package definition libHLTbase.pkg
+# includes another common configuration file
 MODDIR                         = $(top_srcdir)
 PKGDEF                         = $(MODDIR)/libHLTbase.pkg
-#include $(top_srcdir)/libHLTbase.pkg
+include $(top_srcdir)/libHLTbase.pkg
 
 # library sources
-# temporary until lib*.pkg file is commited to AliRoot
-#libHLTbase_la_SOURCES         = $(MODULE_SRCS)
-libHLTbase_la_SOURCES          =  AliHLTComponent.cxx \
-                                  AliHLTComponentHandler.cxx \
-                                  AliHLTSystem.cxx \
-                                  AliHLT_C_Component_WrapperInterface.cxx \
-                                  AliHLTProcessor.cxx \
-                                  AliHLTConfiguration.cxx \
-                                  AliHLTLogging.cxx \
-                                  AliHLTDataBuffer.cxx \
-                                  AliHLTDataSource.cxx \
-                                  AliHLTDataSink.cxx
+libHLTbase_la_SOURCES          = $(MODULE_SRCS)
 
-# class header files, the link definition for the root dictionary
-# will be created from the names of the header files
-CLASS_HDRS                     =  AliHLTComponent.h \
-                                  AliHLTComponentHandler.h \
-                                  AliHLTSystem.h \
-                                  AliHLTProcessor.h \
-                                  AliHLTConfiguration.h \
-                                  AliHLTConfigurationHandler.h \
-                                  AliHLTTask.h \
-                                  AliHLTLogging.h \
-                                  AliHLTDataBuffer.h \
-                                  AliHLTDataSource.h \
-                                  AliHLTDataSink.h
+# library headers
+pkginclude_HEADERS             = $(MODULE_HDRS)
 
-# temporary until lib*.pkg file is commited to AliRoot
-#pkginclude_HEADERS            =  $(MODULE_HDRS)
-pkginclude_HEADERS             =  $(CLASS_HDRS) \
-                                  AliHLTDataTypes.h \
-                                  AliHLT_C_Component_WrapperInterface.h \
-                                  AliHLTDefinitions.h \
-                                  AliHLTStdIncludes.h
-
-# version info for the library
-libHLTbase_la_LDFLAGS          =  -version-info 1:1:0
+# linker flags
+libHLTbase_la_LDFLAGS          =  -version-info $(LIBRARY_VERSION)
 
 # automatic generation of data and time of library build
 COMPILE_INFO                   =  HLTBaseCompileInfo.cxx
@@ -71,4 +52,3 @@ $(COMPILE_INFO): $(libHLTbase_la_SOURCES) $(pkginclude_HEADERS) $(noinst_HEADERS
        @echo '//add changes in Makefile.am' >> $@
        @echo 'void $(MODULE)CompileInfo( char*& date, char*& time)' >> $@
        @echo '{date=__DATE__; time=__TIME__; return;}' >> $@
-
index 2288491dc611749bfe86f12448e6f6f29f30a499..04076d26c7583fb7c1bca371e1a98cf24a72df11 100644 (file)
@@ -1,3 +1,12 @@
+2007-01-05
+       - changes according to coding conventions and documentation
+       - AliHLTTPCDigitReaderRaw: HAVE_TPC_MAPPING dependend implementation
+         fixed in order to make class definition independend
+       - helper functions for data structure handling added
+       - libHLTbase.pkg and libAliHLTSample.pkg included to the stand-alone
+         build system
+       - AliHLTFilePublisher added
+       - target to create the stand-alone sample library package added
 2006-12-28 changes according to coding conventions
        - special characters in function names have been removed in the
          internal usage, the C interface still uses them in order to preserve
index ec77a090f78a6e70a27e6f0b32afd0f213c153e0..f668da6545ea2b2d259d092d886b31c3f6452aea 100644 (file)
@@ -20,8 +20,32 @@ SUBDIRS              = BASE \
                          $(PHOS_DIR) \
                          doc
 
+EXTRA_DIST             = libHLTbase.pkg \
+                         libAliHLTSample.pkg \
+                         hlt.conf
+
 DIST_SUBDIRS           = $(SUBDIRS)
 
+SampleLibPkg: Makefile $(top_srcdir)/SampleLib/*
+       @tmpdir=/tmp/$(USER)/$@ ; \
+       if test -d $@ ; then \
+         cp -ruv $(top_srcdir)/SampleLib/* $@; \
+         cp -uv $(top_srcdir)/libAliHLTSample.pkg $@; \
+         cp -uv $(top_srcdir)/acinclude.m4 $@; \
+       else \
+         (test ! -d $$tmpdir || rm $$tmpdir); \
+         echo "creating package in tmp dir $$tmpdir" ; \
+         mkdir -p $$tmpdir && \
+         (cp -r $(top_srcdir)/SampleLib/* $$tmpdir ; \
+         cp -uv $(top_srcdir)/libAliHLTSample.pkg $$tmpdir ; \
+         cp -uv $(top_srcdir)/acinclude.m4 $$tmpdir; \
+         (echo 'running autoreconf -f -i' ;cd $$tmpdir ; autoreconf -f -i) ; \
+         echo moving $$tmpdir to `pwd`; mv $$tmpdir . ) \
+       fi
+
+clean-local: 
+       (test ! -d SampleLibPkg || rm -rf SampleLibPkg)
+
 #
 # EOF
 #
index 2b1c5c364a2a609a65b997074598187029fb7620..8427789cf24b327d722d0dc0bc30b76e57c37f07 100644 (file)
@@ -25,6 +25,7 @@
 using namespace std;
 #endif
 
+#include "AliHLTSystem.h"
 #include "AliHLTDummyComponent.h"
 #include <stdlib.h>
 #include <errno.h>
@@ -35,8 +36,9 @@ AliHLTDummyComponent gAliHLTDummyComponent;
 ClassImp(AliHLTDummyComponent)
     
 AliHLTDummyComponent::AliHLTDummyComponent()
+  :
+    fOutputPercentage(100) // By default we copy to the output exactly what we got as input
     {
-    fOutputPercentage = 100; // By default we copy to the output exactly what we got as input
     }
 
 AliHLTDummyComponent::~AliHLTDummyComponent()
@@ -55,7 +57,10 @@ void AliHLTDummyComponent::GetInputDataTypes( vector<AliHLTComponentDataType>& l
 
 AliHLTComponentDataType AliHLTDummyComponent::GetOutputDataType()
     {
-    return (AliHLTComponentDataType){ sizeof(AliHLTComponentDataType), {'D','U','M','M','Y',' ',' ',' '},{'D','U','M','Y'}};
+      AliHLTComponentDataType dt;
+      SetDataType(dt, "DUMMY", "DUMY");
+      cout << "SetDataType: size " << dt.fStructSize << endl;
+      return dt;
     }
 
 void AliHLTDummyComponent::GetOutputDataSize( unsigned long& constBase, double& inputMultiplier )
@@ -70,7 +75,7 @@ void AliHLTDummyComponent::GetOutputDataSize( unsigned long& constBase, double&
 AliHLTComponent* AliHLTDummyComponent::Spawn()
     {
     return new AliHLTDummyComponent;
-    };
+    }
 
 int AliHLTDummyComponent::DoInit( int argc, const char** argv )
     {
index 0f6fb7e4beebedeb7be4f255da439855cae12e6a..104208f0f0a3062173491f1d833b3a5a615726f6 100644 (file)
@@ -35,8 +35,9 @@ AliHLTSampleComponent1 gAliHLTSampleComponent1;
 
 ClassImp(AliHLTSampleComponent1)
 
-const AliHLTComponentDataType AliHLTSampleComponent1::inputDataTypes[]={{0,0}, {0,0}}; //'zero' terminated array
-const AliHLTComponentDataType AliHLTSampleComponent1::outputDataType={0,0};
+const AliHLTComponentDataType AliHLTSampleComponent1::inputDataTypes[]={kAliHLTVoidDataType,
+                                                                       {0,"",""}}; //'zero' terminated array
+const AliHLTComponentDataType AliHLTSampleComponent1::outputDataType=kAliHLTVoidDataType;
 
 AliHLTSampleComponent1::AliHLTSampleComponent1()
 {
index 5ae9f214ea68abb9ffbb97e3fdf177832214be15..4f062868a21a89df8cfcee42f2bd7958c0bef50d 100644 (file)
@@ -35,8 +35,9 @@ AliHLTSampleComponent2 gAliHLTSampleComponent2;
 
 ClassImp(AliHLTSampleComponent2)
 
-const AliHLTComponentDataType AliHLTSampleComponent2::inputDataTypes[]={{0,0}, {0,0}}; //'zero' terminated array
-const AliHLTComponentDataType AliHLTSampleComponent2::outputDataType={0,0};
+const AliHLTComponentDataType AliHLTSampleComponent2::inputDataTypes[]={kAliHLTVoidDataType,
+                                                                       {0,"",""}}; //'zero' terminated array
+const AliHLTComponentDataType AliHLTSampleComponent2::outputDataType=kAliHLTVoidDataType;
 
 AliHLTSampleComponent2::AliHLTSampleComponent2()
 {
index dafc03ea54529ea2fecef46a98384b0151a008f5..457103b58998bf4d70fe9b9865bb61b9c62bb120 100644 (file)
@@ -8,11 +8,14 @@
 
 MODULE                                 = AliHLTSample
 
-#EXTRA_DIST                    = libAliHLTSample.pkg
+EXTRA_DIST                     =
+if STANDALONE_SAMPLELIB
+EXTRA_DIST                     += libAliHLTSample.pkg
+endif
 
 # include the pkg definition which actually contains the source
 # file definitions
-#include libAliHLTSample.pkg
+include $(top_srcdir)/libAliHLTSample.pkg
 
 # library definition
 # The lib_LTLIBRARIES variable is a fixed variable of the autotools build
@@ -45,22 +48,11 @@ LIBRARY_VERSION                     = '1:0:0'
 
 # library sources
 # The source files are specified in libAliHLTSample.pkg
-#libAliHLTSample_la_SOURCES    =  $(MODULE_SRCS)
-# temporary until lib*.pkg file is commited to AliRoot
-libAliHLTSample_la_SOURCES=    AliHLTSampleComponent1.cxx \
-                               AliHLTSampleComponent2.cxx \
-                               AliHLTDummyComponent.cxx
-
-# temporary until lib*.pkg file is commited to AliRoot
-CLASS_HDRS=    AliHLTSampleComponent1.h \
-               AliHLTSampleComponent2.h \
-               AliHLTDummyComponent.h
+libAliHLTSample_la_SOURCES     =  $(MODULE_SRCS)
 
 # library headers
 # The header files are specified in libAliHLTSample.pkg
-#noinst_HEADERS                        =  $(MODULE_HDRS)
-# temporary until lib*.pkg file is commited to AliRoot
-noinst_HEADERS=        $(CLASS_HDRS)
+noinst_HEADERS                 =  $(MODULE_HDRS)
 
 # compilation flags of the library
 # This is the place to add further include directories if you are
index df000ecf5292e2d760427f77203b563b2dc68cde..0c8362ecf1dc86272d0d84b6824ea133cb965ecb 100644 (file)
@@ -34,11 +34,11 @@ as 'topdir' from now on.
 3. Copy the SampleLib folder as new 'Test' folder
 > cp -a SampleLib Test
 
-4. Change dir to the new folder
-> cd Test
+4. Copy libAliHLTSample.pkg to libAliHLTTest.pkg
+> cp libAliHLTSample.pkg libAliHLTTest.pkg
 
-5. Rename libAliHLTSample.pkg to libAliHLTTest.pkg
-> mv libAliHLTSample.pkg libAliHLTTest.pkg
+5. Change dir to the new folder
+> cd Test
 
 6. Open 'Makefile.am' with an editor
    This is the Makefile template for the autotools build system. In particular
@@ -64,7 +64,8 @@ as 'topdir' from now on.
    http://www.kip.uni-heidelberg.de/wiki/HLT
 
 8. Once you are finnished with the first code development, you have to add
-   the new component files to the build system. Open 'libAliHLTTest.pkg' 
+   the new component files to the build system. Open 'libAliHLTTest.pkg' in
+   the package topdir
 8.1. Add all your source files to the SRCS variable, remove the files from
      the libAliHLTSample
 8.2. Add all header files of classes which should be added to the ROOT
@@ -113,6 +114,11 @@ of the AliRoot compilation.
 
 2. Requirements
 ===============
+At this point you should have downloaded and unpacked a package with name
+alice-hlt-sample.tar.gz. If not, please download it from
+http://www.kip.uni-heidelberg.de/ti/HLT/software/download/alice-hlt-sample.tar.gz
+The following description refers to that package.
+
 The package needs both ROOT and AliRoot. Both must be set up in the
 usual way (ROOTSYS, ALICE_ROOT, library locations evtl. specified in
 LD_LIBRARY_PATH, ...). The package also needs the ALICE HLT component
@@ -155,7 +161,8 @@ section.
 ===============
 Package build relies on the GNU triplet configure, make and make install.
 In order to keep the development directory clean, it is recommended to
-use a separate build directory. 
+use a separate build directory. Please read the full section before you
+start. The build is in priciple done like
 
   mkdir build
   cd build
@@ -196,9 +203,13 @@ Each of the components has aheader file '<component>.h' and a source code
 file '<component>.cxx
 
 Leave your build directory and go back to the top directory where you can find 
-the source code as well as the Makefile template Makefile.am. Choose a new 
-name of your library (the tutorial uses AliHLTTest) and follow the instructions 
-5 to 8 of Part A (embedded case).
+the source code as well as the Makefile template Makefile.am. 
+1. Choose a new name of your library (the tutorial uses AliHLTTest)
+
+2. Copy libAliHLTSample.pkg to libAliHLTTest.pkg
+> cp libAliHLTSample.pkg libAliHLTTest.pkg
+
+3. follow the instructions 6 to 8 of Part A (embedded case).
 
 When you are done with this, you can build the library by typing 'make' in your
 build directory, and install it by make install.
diff --git a/HLT/SampleLib/acinclude.m4 b/HLT/SampleLib/acinclude.m4
deleted file mode 100644 (file)
index 2aaa56e..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-dnl
-dnl $Id$
-dnl
-dnl  Copyright (C) 2002 Christian Holm Christensen <cholm@nbi.dk>
-dnl
-dnl  This library is free software; you can redistribute it and/or
-dnl  modify it under the terms of the GNU Lesser General Public License
-dnl  as published by the Free Software Foundation; either version 2.1
-dnl  of the License, or (at your option) any later version.
-dnl
-dnl  This library is distributed in the hope that it will be useful,
-dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-dnl  Lesser General Public License for more details.
-dnl
-dnl  You should have received a copy of the GNU Lesser General Public
-dnl  License along with this library; if not, write to the Free
-dnl  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
-dnl  02111-1307 USA
-dnl
-dnl ------------------------------------------------------------------
-AC_DEFUN([AC_DEBUG],
-[
-  AC_REQUIRE([AC_PROG_CC])
-  AC_REQUIRE([AC_PROG_CXX])
-  AC_MSG_CHECKING(whether to make debug objects)
-  AC_ARG_ENABLE(debug,
-    [AC_HELP_STRING([--enable-debug],[Enable debugging symbols in objects])],
-    [],[enable_debug=yes])
-  if test "x$enable_debug" = "xno" ; then
-    CFLAGS=`echo $CFLAGS | sed 's,-g,,'`
-    CXXFLAGS=`echo $CXXFLAGS | sed 's,-g,,'`
-  else
-    AC_DEFINE(__DEBUG)
-    case $CXXFLAGS in
-    *-g*) ;;
-    *)    CXXFLAGS="$CXXFLAGS -g" ;;
-    esac
-    case $CFLAGS in
-    *-g*) ;;
-    *)    CFLAGS="$CFLAGS -g" ;;
-    esac
-  fi
-  AC_MSG_RESULT($enable_debug 'CFLAGS=$CFLAGS')
-])
-
-dnl ------------------------------------------------------------------
-AC_DEFUN([AC_OPTIMIZATION],
-[
-  AC_REQUIRE([AC_PROG_CC])
-  AC_REQUIRE([AC_PROG_CXX])
-
-  AC_ARG_ENABLE(optimization,
-    [AC_HELP_STRING([--enable-optimization],[Enable optimization of objects])],
-    [],[enable_optimization=yes])
-
-  AC_MSG_CHECKING(for optimiztion level)
-
-  changequote(<<, >>)dnl
-  if test "x$enable_optimization" = "xno" ; then
-    CFLAGS=`echo   $CFLAGS   | sed 's,-O\([0-9][0-9]*\|\),,'`
-    CXXFLAGS=`echo $CXXFLAGS | sed 's,-O\([0-9][0-9]*\|\),,'`
-  elif test "x$enable_optimization" = "xyes" ; then
-    case $CXXFLAGS in
-    *-O*) ;;
-    *)    CXXFLAGS="$CXXFLAGS -O2" ;;
-    esac
-    case $CFLAGS in
-    *-O*) ;;
-    *)    CFLAGS="$CXXFLAGS -O2" ;;
-    esac
-  else
-    CFLAGS=`echo   $CFLAGS   | sed "s,-O\([0-9][0-9]*\|\),-O$enable_optimization,"`
-    CXXFLAGS=`echo $CXXFLAGS | sed "s,-O\([0-9][0-9]*\|\),-O$enable_optimization,"`
-  fi
-  changequote([, ])dnl
-  AC_MSG_RESULT($enable_optimization 'CFLAGS=$CFLAGS')
-])
-
-dnl ------------------------------------------------------------------
-
-dnl
-dnl Autoconf macro to check for existence or ROOT on the system
-dnl Synopsis:
-dnl
-dnl  ROOT_PATH([MINIMUM-VERSION, [ACTION-IF-FOUND, [ACTION-IF-NOT-FOUND]]])
-dnl
-dnl Some examples: 
-dnl 
-dnl    ROOT_PATH(3.03/05, , AC_MSG_ERROR(Your ROOT version is too old))
-dnl    ROOT_PATH(, AC_DEFINE([HAVE_ROOT]))
-dnl 
-dnl The macro defines the following substitution variables
-dnl
-dnl    ROOTCONF           full path to root-config
-dnl    ROOTEXEC           full path to root
-dnl    ROOTCINT           full path to rootcint
-dnl    ROOTLIBDIR         Where the ROOT libraries are 
-dnl    ROOTINCDIR         Where the ROOT headers are 
-dnl    ROOTCFLAGS         Extra compiler flags
-dnl    ROOTLIBS           ROOT basic libraries 
-dnl    ROOTGLIBS          ROOT basic + GUI libraries
-dnl    ROOTAUXLIBS        Auxilary libraries and linker flags for ROOT
-dnl    ROOTAUXCFLAGS      Auxilary compiler flags 
-dnl    ROOTRPATH          Same as ROOTLIBDIR
-dnl
-dnl The macro will fail if root-config and rootcint isn't found.
-dnl
-dnl Christian Holm Christensen <cholm@nbi.dk>
-dnl
-AC_DEFUN([ROOT_PATH],
-[
-  AC_ARG_WITH(rootsys,
-  [  --with-rootsys          top of the ROOT installation directory],
-    user_rootsys=$withval,
-    user_rootsys="none")
-  if test ! x"$user_rootsys" = xnone; then
-    rootbin="$user_rootsys/bin"
-  elif test ! x"$ROOTSYS" = x ; then 
-    rootbin="$ROOTSYS/bin"
-  else 
-   rootbin=$PATH
-  fi
-  AC_PATH_PROG(ROOTCONF, root-config , no, $rootbin)
-  AC_PATH_PROG(ROOTEXEC, root , no, $rootbin)
-  AC_PATH_PROG(ROOTCINT, rootcint , no, $rootbin)
-       
-  if test ! x"$ROOTCONF" = "xno" && \
-     test ! x"$ROOTCINT" = "xno" ; then 
-
-    # define some variables 
-    ROOTLIBDIR=`$ROOTCONF --libdir`
-    ROOTINCDIR=`$ROOTCONF --incdir`
-    ROOTCFLAGS=`$ROOTCONF --noauxcflags --cflags` 
-    ROOTLIBS=`$ROOTCONF --noauxlibs --noldflags --libs`
-    ROOTGLIBS=`$ROOTCONF --noauxlibs --noldflags --glibs`
-    ROOTAUXCFLAGS=`$ROOTCONF --auxcflags`
-    ROOTAUXLIBS=`$ROOTCONF --auxlibs`
-    ROOTRPATH=$ROOTLIBDIR
-       
-    if test $1 ; then 
-      AC_MSG_CHECKING(wether ROOT version >= [$1])
-      vers=`$ROOTCONF --version | tr './' ' ' | awk 'BEGIN { FS = " "; } { printf "%d", ($''1 * 1000 + $''2) * 1000 + $''3;}'`
-      requ=`echo $1 | tr './' ' ' | awk 'BEGIN { FS = " "; } { printf "%d", ($''1 * 1000 + $''2) * 1000 + $''3;}'`
-      if test $vers -lt $requ ; then 
-        AC_MSG_RESULT(no)
-       no_root="yes"
-      else 
-        AC_MSG_RESULT(yes)
-      fi
-    fi
-  else
-    # otherwise, we say no_root
-    no_root="yes"
-  fi
-
-  AC_SUBST(ROOTLIBDIR)
-  AC_SUBST(ROOTINCDIR)
-  AC_SUBST(ROOTCFLAGS)
-  AC_SUBST(ROOTLIBS)
-  AC_SUBST(ROOTGLIBS) 
-  AC_SUBST(ROOTAUXLIBS)
-  AC_SUBST(ROOTAUXCFLAGS)
-  AC_SUBST(ROOTRPATH)
-
-  if test "x$no_root" = "x" ; then 
-    ifelse([$2], , :, [$2])     
-  else 
-    ifelse([$3], , :, [$3])     
-  fi
-])
-
-
-#
-# EOF
-#
index 0b094f58caf986909ea361fd10084ace21280e6e..573550dd21f39b75f8ecab6beab64e81c28fbd4e 100644 (file)
@@ -18,6 +18,7 @@ AC_PROG_LIBTOOL
 
 AC_DEBUG
 AC_OPTIMIZATION
+AM_CONDITIONAL(STANDALONE_SAMPLELIB, 1)
 
 dnl ------------------------------------------------------------------
 dnl
@@ -32,7 +33,7 @@ dnl ------------------------------------------------------------------
 dnl check for AliRoot features
 AC_LANG_PUSH(C++)
 have_aliroot=no
-AC_ARG_WITH(aliroot,[  --with-aliroot  top of the AliRoot installation],
+AC_ARG_WITH(aliroot,[  --with-aliroot    top of the AliRoot installation],
                    [test -d $with_aliroot && ALICE_ROOT=$with_aliroot],
                    [])
 
@@ -149,7 +150,7 @@ fi
 dnl ------------------------------------------------------------------
 dnl check for the HLT component framework
 AC_MSG_CHECKING([for HLT component framework in ])
-AC_ARG_WITH(hltbase, [installation path of the HLT component framework],
+AC_ARG_WITH(hltbase, [  --with-hltbase   installation path of the HLT component framework],
                     [],
                     [test -n $have_aliroot && with_hltbase=$have_aliroot ])
 if test -z $with_hltbase || ! test -d $with_hltbase ; then
index 22b351e9c8986fbd249e6d6a7d5853fcfb196cd1..6bce3d8f00b570d404d64099597948f806aeba07 100644 (file)
@@ -26,6 +26,7 @@ AC_PROG_LIBTOOL
 
 AC_DEBUG
 AC_OPTIMIZATION
+AM_CONDITIONAL(STANDALONE_SAMPLELIB, 0)
 
 dnl ------------------------------------------------------------------
 dnl
index 8aa18282636b619e440a9f162fa2c88e46cf25ab..72602d2bbbb24bc7236ab8cbf4471f1e3d45f428 100644 (file)
@@ -1,8 +1,6 @@
 #-*- Mode: Makefile -*-
 # $Id: 
 
-include HLT/hlt.conf
-
 # This files defines the source and header files for the
 # libAliHLTSample library and additional flags for the compilation
 # and linking process. For further information refer to the 
@@ -41,9 +39,9 @@ CINTAUTOLINK:=
 # directories and linking flags/options must be specified in 
 # Makefile.am (stand-alone build system) and here (AliRoot).
 EDEFINE      := ${HLTDEFS}
-PACKCXXFLAGS := ${HLTCXXFLAGS}
-PACKCFLAGS   := ${HLTCLFAGS}
-PACKDCXXFLAGS:= ${HLTDCXXFLAGS}
+PACKCXXFLAGS := $(filter-out -ansi,$(filter-out -pedantic-errors, $(CXXFLAGS)))
+PACKCFLAGS   := $(filter-out -ansi, $(filter-out -pedantic-errors, $(CFLAGS)))
+PACKDCXXFLAGS:= $(filter-out -pedantic-errors, $(CXXFLAGS))
 
 EINCLUDE := HLT/BASE
 
index fc71c8d47754090264606b206bbd2b6ba72df366..e15863f8df2f5772aa52b91308a69982e0616f55 100644 (file)
@@ -1,7 +1,7 @@
 #-*- Mode: Makefile -*-
 # $Id: 
 
-include HLT/hlt.conf
+include $(MODDIR)/hlt.conf
 
 MODULE_SRCS=   AliHLTComponent.cxx \
                AliHLTComponentHandler.cxx \
@@ -12,7 +12,8 @@ MODULE_SRCS=  AliHLTComponent.cxx \
                AliHLTLogging.cxx \
                AliHLTDataBuffer.cxx \
                AliHLTDataSource.cxx \
-               AliHLTDataSink.cxx
+               AliHLTDataSink.cxx \
+               AliHLTFilePublisher.cxx
 
 CLASS_HDRS:=   AliHLTComponent.h \
                AliHLTComponentHandler.h \
@@ -24,7 +25,8 @@ CLASS_HDRS:=          AliHLTComponent.h \
                AliHLTLogging.h \
                AliHLTDataBuffer.h \
                AliHLTDataSource.h \
-               AliHLTDataSink.h
+               AliHLTDataSink.h \
+               AliHLTFilePublisher.h
 
 MODULE_HDRS:=  $(CLASS_HDRS) \
                AliHLTDataTypes.h \