]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
adding new interface function for the announcement of required OCDB objects and
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 18 Apr 2010 10:46:23 +0000 (10:46 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 18 Apr 2010 10:46:23 +0000 (10:46 +0000)
implemented a check for the objects in the component initialization

/**
 * Get a list of OCDB object description.
 * The list of objects is provided in a TMap
 * - key: complete OCDB path, e.g. GRP/GRP/Data
 * - value: short description why the object is needed
 * Key and value objects created inside this class go into ownership of
 * target TMap.
 * @param targetMap   TMap instance receiving the list
 * @return void
 */
virtual void GetOCDBObjectDescription( TMap* const targetArray);

HLT/BASE/AliHLTComponent.cxx
HLT/BASE/AliHLTComponent.h

index ed5898e7d24da7e4b64545adf97bb009b4359501..dd9fd1145a143b4828e98bafba22045936ab7458 100644 (file)
@@ -256,6 +256,9 @@ int AliHLTComponent::Init(const AliHLTAnalysisEnvironment* comenv, void* environ
     HLTError("missing parameter for argument %s", argument.Data());
     iResult=-EINVAL;
   }
+  if (iResult>=0) {
+    iResult=CheckOCDBEntries();
+  }
   if (iResult>=0) {
     iResult=DoInit(iNofChildArgs, pArguments);
   }
@@ -573,6 +576,36 @@ int AliHLTComponent::GetOutputDataTypes(AliHLTComponentDataTypeList& /*tgtList*/
   return 0;
 }
 
+void AliHLTComponent::GetOCDBObjectDescription( TMap* const /*targetArray*/)
+{
+  // default implementation, childs can overload
+  HLTLogKeyword("dummy");
+}
+
+int AliHLTComponent::CheckOCDBEntries(const TMap* const externList)
+{
+  // check the availability of the OCDB entry descriptions in the TMap
+  //  key : complete OCDB path of the entry
+  //  value : auxiliary object - short description
+  // if the external map was not provided the function invokes
+  // interface function GetOCDBObjectDescription() to retrieve the list.
+  int iResult=0;
+  if (externList) {
+    iResult=AliHLTMisc::Instance().CheckOCDBEntries(externList);
+  } else {
+    TMap* pMap=new TMap;
+    if (pMap) {
+      pMap->SetOwnerKeyValue(kTRUE);
+      GetOCDBObjectDescription(pMap);
+      iResult=AliHLTMisc::Instance().CheckOCDBEntries(pMap);
+      delete pMap;
+      pMap=NULL;
+    }
+  }
+
+  return iResult;
+}
+
 void AliHLTComponent::DataType2Text( const AliHLTComponentDataType& type, char output[kAliHLTComponentDataTypefIDsize+kAliHLTComponentDataTypefOriginSize+2] ) const
 {
   // see header file for function documentation
index 6d8dc18a6a2f5a4b49f4293fb0155256c6d46848..cfcc1a6fafe45005723e9e9e94c26ef9574f5de7 100644 (file)
@@ -80,6 +80,7 @@ typedef AliHLTComponentEventDoneData AliHLTComponent_EventDoneData;
 
 class AliHLTComponentHandler;
 class TObjArray;
+class TMap;
 class TStopwatch;
 class AliHLTComponent;
 class AliHLTMemoryFile;
@@ -572,6 +573,18 @@ class AliHLTComponent : public AliHLTLogging {
    */
   virtual void GetOutputDataSize( unsigned long& constBase, double& inputMultiplier ) = 0;
 
+  /**
+   * Get a list of OCDB object description.
+   * The list of objects is provided in a TMap
+   * - key: complete OCDB path, e.g. GRP/GRP/Data
+   * - value: short description why the object is needed
+   * Key and value objects created inside this class go into ownership of
+   * target TMap.
+   * @param targetMap   TMap instance receiving the list
+   * @return void
+   */
+  virtual void GetOCDBObjectDescription( TMap* const targetArray);
+
   /**
    * Spawn function.
    * Each component must implement a spawn function to create a new instance of 
@@ -580,6 +593,17 @@ class AliHLTComponent : public AliHLTLogging {
    */
   virtual AliHLTComponent* Spawn() = 0;
 
+  /**
+   * check the availability of the OCDB entry descriptions in the TMap
+   *  key : complete OCDB path of the entry
+   *  value : auxiliary object - short description
+   * if the external map was not provided the function invokes
+   * interface function GetOCDBObjectDescription() to retrieve the list.
+   * @param externList  map of entries to be tested
+   * @result 0 if all found, -ENOENT if objects not found
+   */
+  int CheckOCDBEntries(const TMap* const externList=NULL);
+
   /**
    * Find matching data types between this component and a consumer component.
    * Currently, a component can produce only one type of data. This restriction is most