ROOT logo
//-*- Mode: C++ -*-
// $Id$

#ifndef ALIHLTCONSUMERDESCRIPTOR_H
#define ALIHLTCONSUMERDESCRIPTOR_H
//* This file is property of and copyright by the                          * 
//* ALICE Experiment at CERN, All rights reserved.                         *
//* See cxx source for full Copyright notice                               *

/// @file   AliHLTConsumerDescriptor.h
/// @author Matthias Richter
/// @date   
/// @brief  Helper class to describe a consumer component.
/// @note   The class is used in Offline (AliRoot) context

#include "AliHLTDataBuffer.h"

/**
 * @class AliHLTConsumerDescriptor
 * @brief Helper class to describe a consumer component.
 *
 * There is unfortunately no unique determination of the data type from the
 * component itself possible, thats why both component and data type have to
 * be initialized and are stored in a compound. The class is intended to make
 * bookkeeping easier.
 *
 * @note This class is only used for the @ref alihlt_system.
 *
 * @ingroup alihlt_system
 */
class AliHLTConsumerDescriptor : public TObject, public AliHLTLogging {
 public:
  /** standard constructur */
  AliHLTConsumerDescriptor();
  /** constructur 
   * @param pConsumer pointer to the consumer component
   */
  AliHLTConsumerDescriptor(AliHLTComponent* pConsumer);
  /** destructor */
  ~AliHLTConsumerDescriptor();

  /**
   * Get the component of this descriptor.
   * @return pointer to the component
   */
  AliHLTComponent* GetComponent() {return fpConsumer;}

  /**
   * Set an active data segment.
   * the pointer will be handled in a container, no allocation, copy or
   * cleanup.
   * @param segment segment descriptor
   * @return >=0 if succeeded
   */
  int SetActiveDataSegment(AliHLTDataBuffer::AliHLTDataSegment segment);

  /**
   * Check whether there is an active data segment of certain size with
   * certain offset.
   * @param segment segment descriptor
   * @return > if existend, 0 if not
   */
  int CheckActiveDataSegment(AliHLTDataBuffer::AliHLTDataSegment segment);

  /** find an active data segment of certain size with certain offset
   * will see if this is necessary
   * @param offset  offset of the data segment in the data buffer
   * @param size    size of the data segment in the data buffer
   * @return offset of the data segment
   */
  //AliHLTUInt32_t FindActiveDataSegment(AliHLTUInt32_t offset, AliHLTUInt32_t size);

  /** get the number of active segments for this consumer
   * @return number of active segments
   */
  int GetNofActiveSegments() {return fSegments.size();};

  /**
   * @param segment segment descriptor
   */
  int ReleaseActiveDataSegment(AliHLTDataBuffer::AliHLTDataSegment segment);

  virtual void Print(const char* option) const;

 private:
  /** copy constructor prohibited */
  AliHLTConsumerDescriptor(const AliHLTConsumerDescriptor&);
  /** assignment operator prohibited */
  AliHLTConsumerDescriptor& operator=(const AliHLTConsumerDescriptor&);

  /** consumer object */
  AliHLTComponent* fpConsumer;                        //! transient

  /** list of data segments */
  AliHLTDataBuffer::AliHLTDataSegmentList fSegments;  // list of data segments

  ClassDef(AliHLTConsumerDescriptor, 0)
};

#endif // ALIHLTCONSUMERDESCRIPTOR_H
 AliHLTConsumerDescriptor.h:1
 AliHLTConsumerDescriptor.h:2
 AliHLTConsumerDescriptor.h:3
 AliHLTConsumerDescriptor.h:4
 AliHLTConsumerDescriptor.h:5
 AliHLTConsumerDescriptor.h:6
 AliHLTConsumerDescriptor.h:7
 AliHLTConsumerDescriptor.h:8
 AliHLTConsumerDescriptor.h:9
 AliHLTConsumerDescriptor.h:10
 AliHLTConsumerDescriptor.h:11
 AliHLTConsumerDescriptor.h:12
 AliHLTConsumerDescriptor.h:13
 AliHLTConsumerDescriptor.h:14
 AliHLTConsumerDescriptor.h:15
 AliHLTConsumerDescriptor.h:16
 AliHLTConsumerDescriptor.h:17
 AliHLTConsumerDescriptor.h:18
 AliHLTConsumerDescriptor.h:19
 AliHLTConsumerDescriptor.h:20
 AliHLTConsumerDescriptor.h:21
 AliHLTConsumerDescriptor.h:22
 AliHLTConsumerDescriptor.h:23
 AliHLTConsumerDescriptor.h:24
 AliHLTConsumerDescriptor.h:25
 AliHLTConsumerDescriptor.h:26
 AliHLTConsumerDescriptor.h:27
 AliHLTConsumerDescriptor.h:28
 AliHLTConsumerDescriptor.h:29
 AliHLTConsumerDescriptor.h:30
 AliHLTConsumerDescriptor.h:31
 AliHLTConsumerDescriptor.h:32
 AliHLTConsumerDescriptor.h:33
 AliHLTConsumerDescriptor.h:34
 AliHLTConsumerDescriptor.h:35
 AliHLTConsumerDescriptor.h:36
 AliHLTConsumerDescriptor.h:37
 AliHLTConsumerDescriptor.h:38
 AliHLTConsumerDescriptor.h:39
 AliHLTConsumerDescriptor.h:40
 AliHLTConsumerDescriptor.h:41
 AliHLTConsumerDescriptor.h:42
 AliHLTConsumerDescriptor.h:43
 AliHLTConsumerDescriptor.h:44
 AliHLTConsumerDescriptor.h:45
 AliHLTConsumerDescriptor.h:46
 AliHLTConsumerDescriptor.h:47
 AliHLTConsumerDescriptor.h:48
 AliHLTConsumerDescriptor.h:49
 AliHLTConsumerDescriptor.h:50
 AliHLTConsumerDescriptor.h:51
 AliHLTConsumerDescriptor.h:52
 AliHLTConsumerDescriptor.h:53
 AliHLTConsumerDescriptor.h:54
 AliHLTConsumerDescriptor.h:55
 AliHLTConsumerDescriptor.h:56
 AliHLTConsumerDescriptor.h:57
 AliHLTConsumerDescriptor.h:58
 AliHLTConsumerDescriptor.h:59
 AliHLTConsumerDescriptor.h:60
 AliHLTConsumerDescriptor.h:61
 AliHLTConsumerDescriptor.h:62
 AliHLTConsumerDescriptor.h:63
 AliHLTConsumerDescriptor.h:64
 AliHLTConsumerDescriptor.h:65
 AliHLTConsumerDescriptor.h:66
 AliHLTConsumerDescriptor.h:67
 AliHLTConsumerDescriptor.h:68
 AliHLTConsumerDescriptor.h:69
 AliHLTConsumerDescriptor.h:70
 AliHLTConsumerDescriptor.h:71
 AliHLTConsumerDescriptor.h:72
 AliHLTConsumerDescriptor.h:73
 AliHLTConsumerDescriptor.h:74
 AliHLTConsumerDescriptor.h:75
 AliHLTConsumerDescriptor.h:76
 AliHLTConsumerDescriptor.h:77
 AliHLTConsumerDescriptor.h:78
 AliHLTConsumerDescriptor.h:79
 AliHLTConsumerDescriptor.h:80
 AliHLTConsumerDescriptor.h:81
 AliHLTConsumerDescriptor.h:82
 AliHLTConsumerDescriptor.h:83
 AliHLTConsumerDescriptor.h:84
 AliHLTConsumerDescriptor.h:85
 AliHLTConsumerDescriptor.h:86
 AliHLTConsumerDescriptor.h:87
 AliHLTConsumerDescriptor.h:88
 AliHLTConsumerDescriptor.h:89
 AliHLTConsumerDescriptor.h:90
 AliHLTConsumerDescriptor.h:91
 AliHLTConsumerDescriptor.h:92
 AliHLTConsumerDescriptor.h:93
 AliHLTConsumerDescriptor.h:94
 AliHLTConsumerDescriptor.h:95
 AliHLTConsumerDescriptor.h:96
 AliHLTConsumerDescriptor.h:97
 AliHLTConsumerDescriptor.h:98
 AliHLTConsumerDescriptor.h:99
 AliHLTConsumerDescriptor.h:100