LCOV - code coverage report
Current view: top level - HLT/BASE - AliHLTOUTHandlerDetectorDDL.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 31 3.2 %
Date: 2016-06-14 17:26:59 Functions: 1 7 14.3 %

          Line data    Source code
       1             : // $Id$
       2             : 
       3             : //**************************************************************************
       4             : //* This file is property of and copyright by the                          * 
       5             : //* ALICE Experiment at CERN, All rights reserved.                         *
       6             : //*                                                                        *
       7             : //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no>        *
       8             : //*                  for The ALICE HLT Project.                            *
       9             : //*                                                                        *
      10             : //* Permission to use, copy, modify and distribute this software and its   *
      11             : //* documentation strictly for non-commercial purposes is hereby granted   *
      12             : //* without fee, provided that the above copyright notice appears in all   *
      13             : //* copies and that both the copyright notice and this permission notice   *
      14             : //* appear in the supporting documentation. The authors make no claims     *
      15             : //* about the suitability of this software for any purpose. It is          *
      16             : //* provided "as is" without express or implied warranty.                  *
      17             : //**************************************************************************
      18             : 
      19             : /// @file   AliHLTOUTHandlerDetectorDDL.cxx
      20             : /// @author Matthias Richter
      21             : /// @date   2008-09-09
      22             : /// @brief  HLTOUT handler returning equipment id from data type and spec.
      23             : ///
      24             : 
      25             : #include "AliHLTOUTHandlerDetectorDDL.h"
      26             : #include "AliHLTOUT.h"
      27             : #include "AliHLTDAQ.h"
      28             : 
      29             : /** ROOT macro for the implementation of ROOT specific class methods */
      30         126 : ClassImp(AliHLTOUTHandlerDetectorDDL)
      31             : 
      32           0 : AliHLTOUTHandlerDetectorDDL::AliHLTOUTHandlerDetectorDDL(const char* detector, AliHLTComponentDataType dt)
      33             :   :
      34           0 :   fDDLOffset(-1),
      35           0 :   fNumberOfDDLs(-1),
      36           0 :   fDt(dt)
      37           0 : { 
      38             :   // A default handler class for DDL raw data redirection handlers.
      39             :   //
      40             :   // This class implements an AliHLTOUTHandlerEquId which extracts the
      41             :   // equipment Id from the bit pattern in the specification. All detectors
      42             :   // with up to 32 DDL links follow this convention. The bit no in the
      43             :   // data specification word corresponds to the DDL number within the
      44             :   // sub-detector.
      45             :   
      46           0 :   fDDLOffset=AliHLTDAQ::DdlIDOffset(detector);
      47           0 :   fNumberOfDDLs=AliHLTDAQ::NumberOfDdls(detector);
      48           0 : }
      49             : 
      50             : AliHLTOUTHandlerDetectorDDL::~AliHLTOUTHandlerDetectorDDL()
      51           0 : {
      52             :   // destructor
      53           0 : }
      54             : 
      55             : int AliHLTOUTHandlerDetectorDDL::ProcessData(AliHLTOUT* pData)
      56             : {
      57             :   // extract the ddl no from the data specification of the data
      58             :   // block and return it
      59             :   // negative error code if failed
      60           0 :   if (!pData) return -EINVAL;
      61           0 :   if (fDDLOffset<0 || fNumberOfDDLs<0) return -ENODEV;
      62             : 
      63             :   static int errorCount=0;
      64             :   const int maxErrorCount=10;
      65           0 :   AliHLTComponentDataType dt=kAliHLTVoidDataType;
      66           0 :   AliHLTUInt32_t spec=kAliHLTVoidDataSpec;
      67           0 :   int iResult=pData->GetDataBlockDescription(dt, spec);
      68           0 :   if (iResult>=0 && dt!=kAliHLTVoidDataType && spec!=kAliHLTVoidDataSpec) {
      69           0 :     if (dt==fDt) {
      70             :       int ddlNo=0;
      71           0 :       for (;ddlNo<32 && ddlNo<fNumberOfDDLs; ddlNo++) {
      72           0 :         if (spec&(0x1<<ddlNo)) break;
      73             :       }
      74           0 :       if (ddlNo>=32 || ddlNo>=fNumberOfDDLs) {
      75           0 :         HLTError("invalid specification 0x%08x: can not extract DDL id for data block %s", spec, AliHLTComponent::DataType2Text(dt).c_str());
      76             :         iResult=-ENODEV;
      77           0 :       } else if (spec^(0x1<<ddlNo)) {
      78             :         iResult=-EEXIST;
      79           0 :         HLTError("multiple links set in specification 0x%08x: can not extract DDL id for data block %s", spec, AliHLTComponent::DataType2Text(dt).c_str());
      80             :       } else {
      81           0 :         iResult=fDDLOffset+ddlNo;
      82             :       }
      83           0 :     } else {
      84           0 :       if (errorCount++<10) {
      85           0 :         HLTError("wrong data type: expecting %s, got %s%s",
      86             :                  AliHLTComponent::DataType2Text(fDt).c_str(),
      87             :                  AliHLTComponent::DataType2Text(dt).c_str(),
      88             :                  errorCount==maxErrorCount?"; suppressing further error messages":"");
      89             :       }
      90             :       iResult=-EBADF;
      91             :     }
      92             :   } else {
      93           0 :     if (errorCount++<10) {
      94           0 :       HLTError("can not get a valid data type and specification from HLTOUT: type %s, specification 0x%08x%s",
      95             :                AliHLTComponent::DataType2Text(dt).c_str(), spec,
      96             :                errorCount==maxErrorCount?"; suppressing further error messages":"");
      97             :     }
      98             :     iResult=-ENODATA;
      99             :   }
     100             :   return iResult;
     101           0 : }

Generated by: LCOV version 1.11