bugfix #29879: multiple subscribers in AliHLTSystem; code cleanup, documentation
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 28 Sep 2007 14:31:47 +0000 (14:31 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 28 Sep 2007 14:31:47 +0000 (14:31 +0000)
HLT/BASE/AliHLTComponent.cxx
HLT/BASE/AliHLTComponent.h
HLT/BASE/AliHLTConsumerDescriptor.cxx
HLT/BASE/AliHLTConsumerDescriptor.h
HLT/BASE/AliHLTDataBuffer.cxx
HLT/BASE/AliHLTDataBuffer.h

index 84a9250175e451236e7d71d6bbc900104aca3e2c..38d2ed62ad493aba6bbbb7e43a0f8355dbae282b 100644 (file)
@@ -82,37 +82,6 @@ AliHLTComponent::AliHLTComponent()
   //SetLocalLoggingLevel(kHLTLogDefault);
 }
 
-AliHLTComponent::AliHLTComponent(const AliHLTComponent&)
-  :
-  AliHLTLogging(),
-  fEnvironment(),
-  fCurrentEvent(0),
-  fEventCount(-1),
-  fFailedEvents(0),
-  fCurrentEventData(),
-  fpInputBlocks(NULL),
-  fCurrentInputBlock(-1),
-  fSearchDataType(kAliHLTVoidDataType),
-  fClassName(),
-  fpInputObjects(NULL),
-  fpOutputBuffer(NULL),
-  fOutputBufferSize(0),
-  fOutputBufferFilled(0),
-  fOutputBlocks(),
-  fpStopwatches(NULL),
-  fMemFiles(),
-  fpRunDesc(NULL),
-  fpDDLList(NULL)
-{
-  // see header file for class documentation
-}
-
-AliHLTComponent& AliHLTComponent::operator=(const AliHLTComponent&)
-{ 
-  // see header file for class documentation
-  return *this;
-}
-
 AliHLTComponent::~AliHLTComponent()
 {
   // see header file for function documentation
index 498212abc46c8cf94273f7fafb48ea45b51c354b..529bf6bbf4222dff6c04f86a6febaa30f4e57f68 100644 (file)
@@ -134,6 +134,22 @@ class AliHLTMemoryFile;
  * framework will allocate a buffer of appropriate size and call the processing
  * again.
  *
+ * @subsection alihltcomponent-error-codes Data processing
+ * For return codes, the following scheme applies:
+ * - The data processing methods have to indicate error conditions by a negative
+ * error/return code. Preferably the system error codes are used like
+ * e.g. -EINVAL. This requires to include the header
+ * <pre>
+ * #include <cerrno>
+ * </pre>
+ * - If no suitable input block could be found (e.g. no clusters for the TPC cluster
+ * finder) set size to 0, block list is empty, return 0
+ * - If no ususable or significant signal could be found in the input blocks
+ * return an empty output block, set size accordingly, and return 0. An empty output
+ * block here could be either a real empty one of size 0 (in which case size also
+ * would have to be set to zero) or a block filled with just the minimum necessary
+ * accounting/meta-structures. E.g. in the TPC
+ *
  * @subsection alihltcomponent-high-level-interface High-level interface
  * The high-level component interface provides functionality to exchange ROOT
  * structures between components. In contrast to the 
@@ -906,9 +922,9 @@ class AliHLTComponent : public AliHLTLogging {
                 const char* structname="", const char* eventname="");
 
  private:
-  /** not a valid copy constructor, defined according to effective C++ style */
+  /** copy constructor prohibited */
   AliHLTComponent(const AliHLTComponent&);
-  /** not a valid assignment op, but defined according to effective C++ style */
+  /** assignment operator prohibited */
   AliHLTComponent& operator=(const AliHLTComponent&);
 
   /**
index a31fd4384d0c7305a0117780476b04a5e799270d..1d07bed1e68fcbc93172811fe389af6cd29d361e 100644 (file)
@@ -53,29 +53,6 @@ AliHLTConsumerDescriptor::AliHLTConsumerDescriptor(AliHLTComponent* pConsumer)
   fSegments.clear();
 }
 
-AliHLTConsumerDescriptor::AliHLTConsumerDescriptor(const AliHLTConsumerDescriptor& desc)
-  :
-  TObject(),
-  AliHLTLogging(),
-  fpConsumer(desc.fpConsumer),
-  fSegments()
-{
-  // see header file for function documentation
-
-  // we can simply transfer the pointer to th new object since there are no
-  // release actions in the destructor
-}
-
-AliHLTConsumerDescriptor& AliHLTConsumerDescriptor::operator=(const AliHLTConsumerDescriptor& desc)
-{ 
-  // see header file for function documentation
-
-  // we can simply transfer the pointer to th new object since there are no
-  // release actions in the destructor
-  fpConsumer=desc.fpConsumer;
-  return *this;
-}
-
 AliHLTConsumerDescriptor::~AliHLTConsumerDescriptor()
 {
   // see header file for function documentation
index a9bc069a39673b0c2af0a2fc3605e5057673d281..aa678350a3efa6556a96954c511e9a6ce3aefc1f 100644 (file)
@@ -35,10 +35,6 @@ class AliHLTConsumerDescriptor : public TObject, public AliHLTLogging {
    * @param pConsumer pointer to the consumer component
    */
   AliHLTConsumerDescriptor(AliHLTComponent* pConsumer);
-  /** not a valid copy constructor, defined according to effective C++ style */
-  AliHLTConsumerDescriptor(const AliHLTConsumerDescriptor&);
-  /** not a valid assignment op, but defined according to effective C++ style */
-  AliHLTConsumerDescriptor& operator=(const AliHLTConsumerDescriptor&);
   /** destructor */
   ~AliHLTConsumerDescriptor();
 
@@ -85,6 +81,11 @@ class AliHLTConsumerDescriptor : public TObject, public AliHLTLogging {
   int ReleaseActiveDataSegment(AliHLTUInt32_t offset, AliHLTUInt32_t size);
 
  private:
+  /** copy constructor prohibited */
+  AliHLTConsumerDescriptor(const AliHLTConsumerDescriptor&);
+  /** assignment operator prohibited */
+  AliHLTConsumerDescriptor& operator=(const AliHLTConsumerDescriptor&);
+
   /** consumer object */
   AliHLTComponent* fpConsumer;                                     //! transient
 
index d00b9d1deb19aea40e6d5632a20ae4573d3dad1c..16da7ce69920b1046be340be054b110a1fc3a37b 100644 (file)
@@ -63,28 +63,6 @@ AliHLTDataBuffer::AliHLTDataBuffer()
   fgNofInstances++;
 }
 
-AliHLTDataBuffer::AliHLTDataBuffer(const AliHLTDataBuffer&)
-  :
-  TObject(),
-  AliHLTLogging(),
-  fSegments(),
-  fConsumers(),
-  fActiveConsumers(),
-  fReleasedConsumers(),
-  fpBuffer(NULL),
-  fFlags(0)
-{
-  // see header file for function documentation
-  HLTFatal("copy constructor untested");
-}
-
-AliHLTDataBuffer& AliHLTDataBuffer::operator=(const AliHLTDataBuffer&)
-{ 
-  // see header file for function documentation
-  HLTFatal("assignment operator untested");
-  return *this;
-}
-
 int AliHLTDataBuffer::fgNofInstances=0;
 vector<AliHLTDataBuffer::AliHLTRawBuffer*> AliHLTDataBuffer::fgFreeBuffers;
 vector<AliHLTDataBuffer::AliHLTRawBuffer*> AliHLTDataBuffer::fgActiveBuffers;
@@ -273,7 +251,7 @@ int AliHLTDataBuffer::Release(AliHLTComponentBlockData* pBlockDesc, const AliHLT
       }
       if (pDesc->GetNofActiveSegments()==0) {
        if ((iResult=ChangeConsumerState(pDesc, fActiveConsumers, fReleasedConsumers))>=0) {
-         if (GetNofActiveConsumers()==0) {
+         if (GetNofActiveConsumers()==0 && GetNofPendingConsumers()==0) {
            // this is the last consumer, reset the consumer list and release the raw buffer
            ResetDataBuffer();
          }
@@ -380,6 +358,13 @@ int AliHLTDataBuffer::GetNofConsumers()
   return iResult;
 }
 
+int AliHLTDataBuffer::GetNofPendingConsumers()
+{
+  // see header file for function documentation
+  int iResult=fConsumers.size();
+  return iResult;
+}
+
 int AliHLTDataBuffer::GetNofActiveConsumers()
 {
   // see header file for function documentation
@@ -506,7 +491,16 @@ int AliHLTDataBuffer::ResetDataBuffer()
   fpBuffer=NULL;
 
   // cleanup consumer states
-  vector<AliHLTConsumerDescriptor*>::iterator desc=fReleasedConsumers.begin();
+  vector<AliHLTConsumerDescriptor*>::iterator desc;
+//   if (GetNofPendingConsumers()>0) {
+//     desc=fConsumers.begin();
+//     while (desc!=fConsumers.end()) {
+//       AliHLTComponent* pComp=(*desc)->GetComponent();
+//       HLTError("internal error: consumer %p (%s %p) did not get data from data buffer %p", *desc, pComp?pComp->GetComponentID():"", pComp, this);
+//       desc++;
+//     }
+//   }
+  desc=fReleasedConsumers.begin();
   while (desc!=fReleasedConsumers.end()) {
     AliHLTConsumerDescriptor* pDesc=*desc;
     fReleasedConsumers.erase(desc);
index e083feef30e7b2919142ee823e10ba6cfd67330b..fa3797f883f2a738a28ed292458214e0afd51e32 100644 (file)
@@ -53,10 +53,6 @@ class AliHLTDataBuffer : public TObject, public AliHLTLogging
   /* standard constructor
    */
   AliHLTDataBuffer();
-  /** not a valid copy constructor, defined according to effective C++ style */
-  AliHLTDataBuffer(const AliHLTDataBuffer&);
-  /** not a valid assignment op, but defined according to effective C++ style */
-  AliHLTDataBuffer& operator=(const AliHLTDataBuffer&);
   /** destructor */
   virtual ~AliHLTDataBuffer();
 
@@ -165,13 +161,21 @@ class AliHLTDataBuffer : public TObject, public AliHLTLogging
   int GetNofSegments();
 
   /**
-   * Get the number of consumers
+   * Get the total number of consumers.
+   * This gives the number of consumers regardless of their state.
    * @return number of consumers
    */
   int GetNofConsumers();
 
   /**
-   * Get the number of active consumers
+   * Get the number of consumers which still need to be processed during
+   * the current event.
+   * @return number of consumers
+   */
+  int GetNofPendingConsumers();
+
+  /**
+   * Get the number of consumers currently under processing.
    * @return number of active consumers
    */
   int GetNofActiveConsumers();
@@ -264,6 +268,11 @@ class AliHLTDataBuffer : public TObject, public AliHLTLogging
   };
 
  private:
+  /** copy constructor prohibited */
+  AliHLTDataBuffer(const AliHLTDataBuffer&);
+  /** assignment operator prohibited */
+  AliHLTDataBuffer& operator=(const AliHLTDataBuffer&);
+
   /* lets see if this is needed
      AliHLTDataSegment* FindDataSegment(AliHLTComponentDataType datatype);
   */