]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
added possibility to get buffer size of last serialized object, useful in particular...
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 10 Nov 2008 06:09:20 +0000 (06:09 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 10 Nov 2008 06:09:20 +0000 (06:09 +0000)
HLT/BASE/AliHLTComponent.cxx
HLT/BASE/AliHLTComponent.h

index 87cb3fe3058a63ad56ff6ee010a3e7ffcb026839..d8c6844eb50c1d6295d99c331edb5837c0f1b7d7 100644 (file)
@@ -88,6 +88,7 @@ AliHLTComponent::AliHLTComponent()
   fEventDoneData(NULL),
   fEventDoneDataSize(0),
   fCompressionLevel(ALIHLTCOMPONENT_DEFAULT_OBJECT_COMPRESSION)
+  , fLastObjectSize(0)
 {
   // see header file for class documentation
   // or
@@ -1079,6 +1080,7 @@ int AliHLTComponent::PushBack(TObject* pObject, const AliHLTComponentDataType& d
   // see header file for function documentation
   ALIHLTCOMPONENT_BASE_STOPWATCH();
   int iResult=0;
+  fLastObjectSize=0;
   if (pObject) {
     AliHLTMessage msg(kMESS_OBJECT);
     msg.SetCompressionLevel(fCompressionLevel);
@@ -1108,6 +1110,7 @@ int AliHLTComponent::PushBack(TObject* pObject, const AliHLTComponentDataType& d
       if (iResult>=0) {
        HLTDebug("object %s (%p) size %d compression %d inserted to output", pObject->ClassName(), pObject, iMsgLength, msg.GetCompressionLevel());
       }
+      fLastObjectSize=iMsgLength;
     } else {
       HLTError("object serialization failed for object %p", pObject);
       iResult=-ENOMSG;
@@ -1176,7 +1179,7 @@ int AliHLTComponent::InsertOutputBlock(const void* pBuffer, int iBufferSize, con
       //HLTDebug("buffer inserted to output: size %d data type %s spec %#x", iBlkSize, DataType2Text(dt).c_str(), spec);
     } else {
       if (fpOutputBuffer) {
-       HLTError("too little space in output buffer: %d, required %d", fOutputBufferSize-fOutputBufferFilled, iBlkSize);
+       HLTError("too little space in output buffer: %d of %d, required %d", fOutputBufferSize-fOutputBufferFilled, fOutputBufferSize, iBlkSize);
       } else {
        HLTError("output buffer not available");
       }
index a9b28fcdcf5b0c80b47c5c1c6ec11c8cec8b7c09..6ad8c4daa2c87a2346190f0d381c1ec52f7f34cd 100644 (file)
@@ -680,6 +680,16 @@ class AliHLTComponent : public AliHLTLogging {
    */
   int SetStopwatches(TObjArray* pStopwatches);
 
+  /**
+   * Get size of last serialized object.
+   * During PushBack, TObjects are serialized in a separate buffer. The
+   * size of the last object can be retrieved by this function.
+   *
+   * This might be especially useful for PushBack failures caused by too
+   * small output buffer.
+   */
+  int GetLastObjectSize() const {return fLastObjectSize;}
+
  protected:
 
   /**
@@ -1464,6 +1474,9 @@ class AliHLTComponent : public AliHLTLogging {
   /** Comression level for ROOT objects */
   int fCompressionLevel;                                           //! transient
 
-  ClassDef(AliHLTComponent, 9)
+  /** size of last PushBack-serialized object */
+  int fLastObjectSize;                                             //! transient
+
+  ClassDef(AliHLTComponent, 10)
 };
 #endif