]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
- added version announcement to base library
authorrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 23 Aug 2006 09:20:30 +0000 (09:20 +0000)
committerrichterm <richterm@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 23 Aug 2006 09:20:30 +0000 (09:20 +0000)
- documentation added for ComponentHandler

HLT/BASE/AliHLTComponentHandler.cxx
HLT/BASE/AliHLTComponentHandler.h
HLT/BASE/AliHLT_C_Component_WrapperInterface.cxx
HLT/BASE/Makefile.am
HLT/make.dict

index fa93e7040b3b7a8c27f384e3f9008467fe962192..bf63982f80c5f05c590d72a19740cb92ce79b3b2 100644 (file)
@@ -50,6 +50,23 @@ AliHLTComponentHandler::~AliHLTComponentHandler()
   UnloadLibraries();
 }
 
+int AliHLTComponentHandler::AnnounceVersion()
+{
+  int iResult=0;
+#ifdef PACKAGE_STRING
+  void HLTbaseCompileInfo( char*& date, char*& time);
+  char* date="";
+  char* time="";
+  HLTbaseCompileInfo(date, time);
+  if (!date) date="unknown";
+  if (!time) time="unknown";
+  HLTInfo("%s build on %s (%s)", PACKAGE_STRING, date, time);
+#else
+  HLTInfo("ALICE High Level Trigger (embedded AliRoot build)");
+#endif
+  return iResult;
+}
+
 Int_t AliHLTComponentHandler::RegisterComponent(AliHLTComponent* pSample)
 {
   Int_t iResult=0;
@@ -61,7 +78,7 @@ Int_t AliHLTComponentHandler::RegisterComponent(AliHLTComponent* pSample)
       }
     } else {
       // component already registered
-      HLTInfo("component %s already registered, skipped", pSample->GetComponentID());
+      HLTDebug("component %s already registered, skipped", pSample->GetComponentID());
       iResult=-EEXIST;
     }
   } else {
@@ -86,7 +103,7 @@ Int_t AliHLTComponentHandler::ScheduleRegister(AliHLTComponent* pSample)
   return iResult;
 }
 
-int AliHLTComponentHandler::CreateComponent(const char* componentID, void* environ_param, int argc, const char** argv, AliHLTComponent*& component )
+int AliHLTComponentHandler::CreateComponent(const char* componentID, void* pEnv, int argc, const char** argv, AliHLTComponent*& component )
 {
   int iResult=0;
   if (componentID) {
@@ -95,7 +112,7 @@ int AliHLTComponentHandler::CreateComponent(const char* componentID, void* envir
       component=pSample->Spawn();
       if (component) {
        HLTDebug("component \"%s\" created (%p)", componentID, component);
-       component->Init(&fEnvironment, environ_param, argc, argv);
+       component->Init(&fEnvironment, pEnv, argc, argv);
       } else {
        HLTError("can not spawn component \"%s\"", componentID);
        iResult=-ENOENT;
@@ -173,7 +190,7 @@ int AliHLTComponentHandler::LoadLibrary( const char* libraryPath )
     AliHLTLibHandle hLib=dlopen(libraryPath, RTLD_NOW);
     if (hLib) {
       AliHLTComponent::UnsetGlobalComponentHandler();
-      HLTDebug("library %s loaded", libraryPath);
+      HLTInfo("library %s loaded", libraryPath);
       fLibraryList.push_back(hLib);
       vector<AliHLTComponent*>::iterator element=fScheduleList.begin();
       int iSize=fScheduleList.size();
index 05e4d84f94783865dd437f153d67859d0cbe0679..638164d9adfffbbdfa9cb6e5b9986cba8fc78978 100644 (file)
@@ -24,76 +24,165 @@ struct AliHLTComponent_DataType;
 
 typedef void* AliHLTLibHandle;
 
+/**
+ * @class AliHLTComponentHandler
+ * The component handler controls all the processing components available in
+ * the system. It also controls the component shared libraries.
+ * @ingroup alihlt_component
+ */
 class AliHLTComponentHandler : public AliHLTLogging {
  public:
+  /** standard constructor */
   AliHLTComponentHandler();
+  /** destructor */
   virtual ~AliHLTComponentHandler();
 
+  /**
+   * Set the environment for the HLT framework.
+   * The environment mainly consists of function pointers for the integration
+   * of the HLT framework into a system like the PubSub online system or
+   * AliRoot offline system.
+   * @param pEnv    pointer to @ref AliHLTComponentEnvironment structure
+   * @return none
+   */
   void SetEnvironment(AliHLTComponentEnvironment* pEnv);
 
-  // Load a component shared library
+  /**
+   * Load a component shared library.
+   * The component library needs to be loaded from the ComponentHanler in order
+   * to automatically register all components in the library.
+   * Registration is done by passing a sample object of the component to the
+   * handler. The object has to be valid during the whole runtime and should
+   * thus be a global object which is ONLY used for the purpose of registration.
+   * This also ensures automatically registration at library load time.
+   * @param libraryPath  const char string containing the library name/path
+   * @return 0 if succeeded, neg. error code if failed
+   */
   int LoadLibrary( const char* libraryPath );
+
+  /**
+   * Unload a component shared library.
+   * All components will be de-registered.
+   * @param libraryPath  library name as specified to @ref LoadLibrary
+   * @return 0 if succeeded, neg. error code if failed
+   */
   int UnloadLibrary( const char* libraryPath );
 
-  /* Component registration funcions
-   * registration is done by passing a sample object of the component to the handler
-   * the object has to be valid during the whole runtime and should thus be a global object
+  /**
+   * Schedule a component for registration.
+   * Full registration will be done after successfull loading of the shared
+   * library.
+   * @param pSample  a sample object of the component
+   * @return neg. error code if failed
    */
-  // Schedule a component for registration, full registration will be done
-  // after successfull loading of the shared library
   int ScheduleRegister(AliHLTComponent* pSample );
 
-  // Register a component with the list of available components
+  /**
+   * Register a component.
+   * Registration is done by passing a sample object of the component to the
+   * handler. The object has to be valid during the whole runtime and should
+   * thus be a global object which is ONLY used for the purpose of registration.
+   * @param pSample  a sample object of the component
+   * @return neg. error code if failed
+   */
   int RegisterComponent(AliHLTComponent* pSample );
-  int DeregisterComponent( const char* componentID );
-
-  // Find the ID of a component with the given output data
-  // prevType can be used to iterate if there are multiple components with the same output data type.
-  const char* FindComponentType( AliHLTComponent_DataType, const char* prevType = NULL ) { return NULL;}
 
-  // Create a component of the given name
-  int CreateComponent( const char* componentType, void* environ_param, int argc, const char** argv, AliHLTComponent*& component );
-  int CreateComponent( const char* componentType, void* environ_param, AliHLTComponent*& component ) {
-    return CreateComponent( componentType, environ_param, 0, NULL, component );
-  }
+  /**
+   * Deregister a component.
+   * @param componentID   ID of the component
+   * @return neg. error code if failed
+   */
+  int DeregisterComponent( const char* componentID );
 
-  /* print registered components to stdout
+  /**
+   * Find the ID of a component with the given output data.
+   * @param dtype     data type descriptor
+   * @param prevType  can be used to iterate if there are multiple components
+   *                  with the same output data type.
+   * @return component id
+   */
+  //const char* FindComponentType( AliHLTComponent_DataType dtype,
+  //                               const char* prevType = NULL )
+  //  { return NULL;}
+
+  /**
+   * Create a component of the given name (ID).
+   * @param componentID  ID of the component to create
+   * @param pEnv         environment for the component
+   * @param argc         number of arguments in @ref argv
+   * @param argv         argument array like in main()
+   * @param component    reference to receive the create component instance
+   * @return component pointer in @ref component, neg. error code if failed
+   */
+  int CreateComponent( const char* componentID, void* pEnv, 
+                      int argc, const char** argv, AliHLTComponent*& component );
+
+  /**
+   * Create a component of the given name (ID).
+   * Introduced for backward compatibility.
+   * @param componentID  ID of the component to create
+   * @param pEnv         environment for the component
+   * @param component    reference to receive the create component instance
+   * @return component pointer in @ref component, neg. error code if failed
+   */
+  int CreateComponent( const char* componentID, void* pEnv, 
+                      AliHLTComponent*& component ) 
+    {
+    return CreateComponent( componentID, pEnv, 0, NULL, component );
+    }
+
+  /**
+   * Print registered components to stdout.
+   * @return none
    */
   void List();
+
+  /**
+   * Announce version and compilation info of the base library.
+   */
+  int AnnounceVersion();
+
  protected:
 
  private:
-  /* find a component
-     return index
-  */
+  /**
+   * Find a component.
+   * @param componentID  ID of the component to find
+   * @return index, neg. error code if failed
+   */
   int FindComponentIndex(const char* componentID);
 
-  /* find a component
-     return descriptor
-  */
+  /**
+   * Find a component.
+   * @param componentID  ID of the component to find
+   * @return descriptor
+   */
   AliHLTComponent* FindComponent(const char* componentID);
 
+  /**
+   * Insert component to the list
+   * @param pSample      sample object of the component
+   * @return neg. error code if failed
+   */
   int InsertComponent(AliHLTComponent* pSample);
 
-  // close all libraries
+  /**
+   * Close all libraries.
+   * @return neg. error code if failed
+   */
   int UnloadLibraries();
 
-  /* list of registered components
-   */
+  /** list of registered components */
   vector<AliHLTComponent*> fComponentList;
-
-  /* list of scheduled components
-   */
+  /** list of scheduled components */
   vector<AliHLTComponent*> fScheduleList;
-
-  /* list of libraries
-   */
+  /** list of libraries */
   vector<AliHLTLibHandle> fLibraryList;
-
+  /** running environment for the component */
   AliHLTComponentEnvironment fEnvironment;
 
-  ClassDef(AliHLTComponentHandler, 0)
+  ClassDef(AliHLTComponentHandler, 0);
 
-    };
+};
 #endif
 
index f8d477dca94f3a119eb8357f582ad13a590c67ae..14a5191298d1a430a40f4c882b519e7fab6a95cf 100644 (file)
@@ -44,6 +44,7 @@ int AliHLT_C_Component_InitSystem( AliHLTComponentEnvironment* environ )
   if ( !gComponentHandler_C )
     return EFAULT;
   gComponentHandler_C->SetEnvironment( environ );
+  gComponentHandler_C->AnnounceVersion();
   return 0;
 }
 
index 4653e2b53a2f926645ca4ca4b3ca5bcee3351c44..dc9c950e41e0259bfd40eb305356a1ac6d6a2d8a 100644 (file)
@@ -3,7 +3,7 @@
 
 MODULE                         = HLTbase
 
-AM_CPPFLAGS                    = 
+AM_CPPFLAGS                    = -DMODULE=$(MODULE)
 
 # library definition
 lib_LTLIBRARIES                        =  libHLTbase.la
@@ -43,10 +43,30 @@ noinst_HEADERS                      =  AliHLTStdIncludes.h
 # version info for the library
 libHLTbase_la_LDFLAGS          =  -version-info 1:0:0
 
+# automatic generation of data and time of library build
+COMPILE_INFO                   =  HLTBaseCompileInfo.cxx
+
 # set the file name for the generated root dictionary
 DICTCPP                                =  HLTbase-DICT.cxx
-nodist_libHLTbase_la_SOURCES    =  $(DICTCPP)
+nodist_libHLTbase_la_SOURCES    =  $(COMPILE_INFO) \
+                                  $(DICTCPP)
 
 CLEANFILES                     =
 
 include $(top_srcdir)/make.dict
+
+$(COMPILE_INFO): $(libHLTbase_la_SOURCES) $(pkginclude_HEADERS) $(noinst_HEADERS) Makefile.am
+       @echo '//automatically generated compilation info' > $@
+       @echo '//!!! DO NOT EDIT THIS FILE !!!' >> $@
+       @echo '//add changes in Makefile.am' >> $@
+       @echo 'void $(MODULE)CompileInfo( char*& date, char*& time)' >> $@
+       @echo '{date=__DATE__; time=__TIME__; return;}' >> $@
+
+#      @echo '//automatically generated compilation info' > $@
+#      @echo '//!!! DO NOT EDIT THIS FILE !!!' >> $@
+#      @echo '//add changes in Makefile.am' >> $@
+#      @echo 'void __$(MODULE)_compile_info(const char** pDate, const char** pDate)' >> $@
+#      @echo '{' >> $@
+#      @echo 'if (pDate) *pDate=__DATE__;' >> $@
+#      @echo 'if (pTime) *pTime=__TIME__;' >> $@
+#      @echo '}' >> $@
index edfb90cb3e846219d6a9e80fb20fd5e418ba471e..f3161b442b7c03fc2d5d67655d2d8b857c0295aa 100644 (file)
@@ -26,7 +26,7 @@ $(DICTCPP): $(DICTHEADERS:%=$(srcdir)/%) $(DICTDEF)
 $(DICTDEF): Makefile.am
        @echo '//automatically generated ROOT DICT definition' > $@
        @echo '//!!! DO NOT EDIT THIS FILE !!!' >> $@
-       @echo '//add further class definitions to the DICTHEADERS variable in Makefile.am' >> $@
+       @echo '//add further class definitions to the CLASS_HDRS variable in Makefile.am' >> $@
        @echo '#ifdef __CINT__' >> $@
        @echo '#pragma link off all globals;' >> $@
        @echo '#pragma link off all classes;' >> $@