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;
}
} else {
// component already registered
- HLTInfo("component %s already registered, skipped", pSample->GetComponentID());
+ HLTDebug("component %s already registered, skipped", pSample->GetComponentID());
iResult=-EEXIST;
}
} else {
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) {
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;
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();
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
MODULE = HLTbase
-AM_CPPFLAGS =
+AM_CPPFLAGS = -DMODULE=$(MODULE)
# library definition
lib_LTLIBRARIES = libHLTbase.la
# 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 '}' >> $@