]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - HLT/BASE/AliHLTDomainEntry.cxx
Ignore
[u/mrichter/AliRoot.git] / HLT / BASE / AliHLTDomainEntry.cxx
index 7bfda707fb357f69dad4e4f03bb00c03e23469e8..e4b39853279b6ed33c13911afcfd144576334985 100644 (file)
@@ -1,4 +1,4 @@
-// $Id:$
+// $Id$
 /**************************************************************************
  * This file is property of and copyright by the ALICE HLT Project        *
  * ALICE Experiment at CERN, All rights reserved.                         *
@@ -35,6 +35,7 @@
 #include "Riostream.h"
 #include "TString.h"
 #include <cstring>
+#include <cerrno>
 
 ClassImp(AliHLTDomainEntry)
 
@@ -44,7 +45,7 @@ AliHLTDomainEntry::AliHLTDomainEntry() :
   fExclude(kFALSE),
   fUseSpec(kFALSE),
   fType(kAliHLTVoidDataType),
-  fSpecification(0x0)
+  fSpecification(kAliHLTVoidDataSpec)
 {
   // Default constructor.
 }
@@ -65,7 +66,7 @@ AliHLTDomainEntry::AliHLTDomainEntry(const AliHLTComponentDataType& type) :
   fExclude(kFALSE),
   fUseSpec(kFALSE),
   fType(type),
-  fSpecification(0x0)
+  fSpecification(kAliHLTVoidDataSpec)
 {
   // Constructs a domain entry with a particular data type and any specification.
   // See header file for more information.
@@ -77,7 +78,7 @@ AliHLTDomainEntry::AliHLTDomainEntry(const char* blocktype, const char* origin)
   fExclude(kFALSE),
   fUseSpec(kFALSE),
   fType(),
-  fSpecification(0x0)
+  fSpecification(kAliHLTVoidDataSpec)
 {
   // Constructs a domain entry with a particular data type and any specification.
   // See header file for more information.
@@ -141,7 +142,7 @@ AliHLTDomainEntry::AliHLTDomainEntry(Bool_t exclude, const AliHLTComponentDataTy
   fExclude(exclude),
   fUseSpec(kFALSE),
   fType(type),
-  fSpecification(0x0)
+  fSpecification(kAliHLTVoidDataSpec)
 {
   // Constructs a domain entry with the given data type, any specification
   // and the exclude flag set.
@@ -154,7 +155,7 @@ AliHLTDomainEntry::AliHLTDomainEntry(Bool_t exclude, const char* blocktype, cons
   fExclude(exclude),
   fUseSpec(kFALSE),
   fType(),
-  fSpecification(0x0)
+  fSpecification(kAliHLTVoidDataSpec)
 {
   // Constructs a domain entry with a particular data type, any specification
   // and the exclude flag set.
@@ -240,13 +241,13 @@ bool AliHLTDomainEntry::SubsetOf(const AliHLTDomainEntry& rhs) const
 
   if (*this != rhs) return false;
   bool thisTypeIsAny = strncmp(&fType.fID[0], kAliHLTAnyDataTypeID, kAliHLTComponentDataTypefIDsize) == 0;
-  bool thisOriginIsAny = strncmp(&fType.fOrigin[0], kAliHLTDataOriginAny, kAliHLTComponentDataTypefOriginSize) == 0;
-  bool thisSpecIsAny = not fUseSpec;
   bool rhsTypeIsAny = strncmp(&rhs.fType.fID[0], kAliHLTAnyDataTypeID, kAliHLTComponentDataTypefIDsize) == 0;
-  bool rhsOriginIsAny = strncmp(&rhs.fType.fOrigin[0], kAliHLTDataOriginAny, kAliHLTComponentDataTypefOriginSize) == 0;
-  bool rhsSpecIsAny = not rhs.fUseSpec;
   if (thisTypeIsAny and not rhsTypeIsAny) return false;
+  bool thisOriginIsAny = strncmp(&fType.fOrigin[0], kAliHLTDataOriginAny, kAliHLTComponentDataTypefOriginSize) == 0;
+  bool rhsOriginIsAny = strncmp(&rhs.fType.fOrigin[0], kAliHLTDataOriginAny, kAliHLTComponentDataTypefOriginSize) == 0;
   if (thisOriginIsAny and not rhsOriginIsAny) return false;
+  bool thisSpecIsAny = not fUseSpec;
+  bool rhsSpecIsAny = not rhs.fUseSpec;
   if (thisSpecIsAny and not rhsSpecIsAny) return false;
   return true;
 }
@@ -348,3 +349,40 @@ TString AliHLTDomainEntry::AsString() const
   return str;
 }
 
+int AliHLTDomainEntry::AsBinary(AliHLTUInt32_t buffer[4]) const
+{
+  // convert the data type and specification to a 32 byte buffer
+  if (!buffer) return -EINVAL;
+
+  AliHLTUInt32_t* tgt=buffer; 
+  unsigned ii=0;
+
+  // lower part of the data type id
+  *tgt=0;
+  for ( ii=0; ii<4; ii++ ) {
+    *tgt |= ((AliHLTUInt32_t)(fType.fID[8-1-ii])) << (ii*8);
+  }
+  tgt++;
+         
+  // upper part of the data type id
+  *tgt=0;
+  for ( ii=0; ii<4; ii++ ) {
+    *tgt |= ((AliHLTUInt32_t)(fType.fID[8-5-ii])) << (ii*8);
+  }
+  tgt++;
+  
+  // data type origin
+  *tgt=0;
+  for ( ii=0; ii<4; ii++ ) {
+    *tgt |= ((AliHLTUInt32_t)(fType.fOrigin[4-1-ii])) << (ii*8);
+  }
+  tgt++;
+  
+  // specification
+  if (fUseSpec)
+    *tgt = fSpecification;
+  else
+    *tgt = kAliHLTVoidDataSpec;
+
+  return 0;
+}