using namespace std;
#endif
-#include "AliHLTStdIncludes.h"
+//#include "AliHLTStdIncludes.h"
#include "AliHLTComponent.h"
#include "AliHLTComponentHandler.h"
#include "AliHLTMessage.h"
if (argc==0 && argv==NULL) {
// this is currently just to get rid of the warning "unused parameter"
}
+ fEventCount=0;
return 0;
}
int AliHLTComponent::DoDeinit()
{
// see header file for function documentation
+ fEventCount=0;
return 0;
}
void AliHLTComponent::PrintDataTypeContent(AliHLTComponentDataType& dt, const char* format) const
{
+ // see header file for function documentation
const char* fmt="publisher \'%s\'";
if (format) fmt=format;
HLTMessage(fmt, (DataType2Text(dt)).c_str());
return fEventCount;
}
-int AliHLTComponent::GetNumberOfInputBlocks()
+int AliHLTComponent::GetNumberOfInputBlocks() const
{
// see header file for function documentation
if (fpInputBlocks!=NULL) {
return pObj;
}
-int AliHLTComponent::FindInputBlock(const AliHLTComponentDataType& dt, int startIdx)
+int AliHLTComponent::FindInputBlock(const AliHLTComponentDataType& dt, int startIdx) const
{
// see header file for function documentation
int iResult=-ENOENT;
if (firstWord==fpInputBlocks[idx].fSize-sizeof(AliHLTUInt32_t)) {
HLTDebug("create object from block %d size %d", idx, fpInputBlocks[idx].fSize);
AliHLTMessage msg(fpInputBlocks[idx].fPtr, fpInputBlocks[idx].fSize);
- pObj=msg.ReadObject(msg.GetClass());
- if (pObj && msg.GetClass()) {
- HLTDebug("object %p type %s created", pObj, msg.GetClass()->GetName());
+ TClass* objclass=msg.GetClass();
+ pObj=msg.ReadObject(objclass);
+ if (pObj && objclass) {
+ HLTDebug("object %p type %s created", pObj, objclass->GetName());
} else {
}
} else {
int AliHLTComponent::CleanupInputObjects()
{
+ // see header file for function documentation
if (!fpInputObjects) return 0;
TObjArray* array=fpInputObjects;
fpInputObjects=NULL;
return pBlock;
}
-int AliHLTComponent::FindInputBlock(const AliHLTComponentBlockData* pBlock)
+int AliHLTComponent::FindInputBlock(const AliHLTComponentBlockData* pBlock) const
{
// see header file for function documentation
int iResult=-ENOENT;
int AliHLTComponent::EstimateObjectSize(TObject* pObject) const
{
+ // see header file for function documentation
if (!pObject) return -EINVAL;
AliHLTMessage msg(kMESS_OBJECT);
msg.WriteObject(pObject);
#include "AliHLTStdIncludes.h"
#include "AliHLTLogging.h"
#include "TString.h"
-#include "TArrayC.h"
#include "Varargs.h"
#include <string>
#include <sstream>
#include <iostream>
-/** target stream for AliRoot logging methods */
-ostringstream gLogstr;
-
#ifndef NOALIROOT_LOGGING
/**
* Notification callback for AliRoot logging methods
{
AliHLTLogging hltlog;
hltlog.SwitchAliLog(0);
- hltlog.Logging(kHLTLogInfo, "NotificationHandler", "AliLog", gLogstr.str().c_str());
- gLogstr.clear();
+ hltlog.Logging(kHLTLogInfo, "NotificationHandler", "AliLog", AliHLTLogging::fgLogstr.str().c_str());
+ AliHLTLogging::fgLogstr.clear();
string empty("");
- gLogstr.str(empty);
+ AliHLTLogging::fgLogstr.str(empty);
}
#endif
-/**
- * The global logging buffer.
- * The buffer is created with an initial size and grown dynamically on
- * demand.
- */
-TArrayC gAliHLTLoggingTarget(200);
-
-/** the maximum size of the buffer */
-const int gALIHLTLOGGING_MAXBUFFERSIZE=10000;
-
/** ROOT macro for the implementation of ROOT specific class methods */
ClassImp(AliHLTLogging)
return *this;
}
-AliHLTComponentLogSeverity AliHLTLogging::fGlobalLogFilter=kHLTLogAll;
-AliHLTfctLogging AliHLTLogging::fLoggingFunc=NULL;
+ostringstream AliHLTLogging::fgLogstr;
+AliHLTComponentLogSeverity AliHLTLogging::fgGlobalLogFilter=kHLTLogAll;
+AliHLTfctLogging AliHLTLogging::fgLoggingFunc=NULL;
int AliHLTLogging::fgUseAliLog=1;
AliHLTLogging::~AliHLTLogging()
// see header file for class documentation
}
+TArrayC AliHLTLogging::fgAliHLTLoggingTarget(200);
+const int AliHLTLogging::fgkALIHLTLOGGINGMAXBUFFERSIZE=10000;
+
int AliHLTLogging::Init(AliHLTfctLogging pFun)
{
// see header file for class documentation
- if (fLoggingFunc!=NULL && fLoggingFunc!=pFun) {
- (*fLoggingFunc)(NULL/*fParam*/, kHLTLogWarning, "AliHLTLogging::Init", "no key", "overriding previously initialized logging function");
+ if (fgLoggingFunc!=NULL && fgLoggingFunc!=pFun) {
+ (*fgLoggingFunc)(NULL/*fParam*/, kHLTLogWarning, "AliHLTLogging::Init", "no key", "overriding previously initialized logging function");
}
- fLoggingFunc=pFun;
+ fgLoggingFunc=pFun;
// older versions of AliLog does not support the notification callback and
// stringstreams, but they support the logging macros in general
#ifndef NOALIROOT_LOGGING
#ifndef NO_ALILOG_NOTIFICATION
AliLog* log=new AliLog;
log->SetLogNotification(LogNotification);
- log->SetStreamOutput(&gLogstr);
+ log->SetStreamOutput(&fgLogstr);
#endif // NO_ALILOG_NOTIFICATION
#endif // NOALIROOT_LOGGING
#ifndef NOALIROOT_LOGGING
int AliHLTLogging::AliMessage(AliHLTComponentLogSeverity severity,
- const char* origin_class, const char* origin_func,
+ const char* originClass, const char* originFunc,
const char* file, int line, const char* message)
{
// see header file for class documentation
switch (severity) {
case kHLTLogBenchmark:
- AliLog::Message(AliLog::kInfo, message, "HLT", origin_class, origin_func, file, line);
+ AliLog::Message(AliLog::kInfo, message, "HLT", originClass, originFunc, file, line);
break;
case kHLTLogDebug:
- AliLog::Message(AliLog::kDebug, message, "HLT", origin_class, origin_func, file, line);
+ AliLog::Message(AliLog::kDebug, message, "HLT", originClass, originFunc, file, line);
break;
case kHLTLogInfo:
- AliLog::Message(AliLog::kInfo, message, "HLT", origin_class, origin_func, file, line);
+ AliLog::Message(AliLog::kInfo, message, "HLT", originClass, originFunc, file, line);
break;
case kHLTLogWarning:
- AliLog::Message(AliLog::kWarning, message, "HLT", origin_class, origin_func, file, line);
+ AliLog::Message(AliLog::kWarning, message, "HLT", originClass, originFunc, file, line);
break;
case kHLTLogError:
- AliLog::Message(AliLog::kError, message, "HLT", origin_class, origin_func, file, line);
+ AliLog::Message(AliLog::kError, message, "HLT", originClass, originFunc, file, line);
break;
case kHLTLogFatal:
- AliLog::Message(AliLog::kWarning, message, "HLT", origin_class, origin_func, file, line);
+ AliLog::Message(AliLog::kWarning, message, "HLT", originClass, originFunc, file, line);
break;
default:
break;
const char* fmt = format;
if (fmt==NULL) fmt=va_arg(ap, const char*);
- gAliHLTLoggingTarget[0]=0;
+ fgAliHLTLoggingTarget[0]=0;
while (fmt!=NULL) {
- iResult=vsnprintf(gAliHLTLoggingTarget.GetArray(), gAliHLTLoggingTarget.GetSize(), fmt, ap);
+ iResult=vsnprintf(fgAliHLTLoggingTarget.GetArray(), fgAliHLTLoggingTarget.GetSize(), fmt, ap);
if (iResult==-1)
// for compatibility with older version of vsnprintf
- iResult=gAliHLTLoggingTarget.GetSize()*2;
- else if (iResult<gAliHLTLoggingTarget.GetSize())
+ iResult=fgAliHLTLoggingTarget.GetSize()*2;
+ else if (iResult<fgAliHLTLoggingTarget.GetSize())
break;
// terminate if buffer is already at the limit
- if (gAliHLTLoggingTarget.GetSize()>=gALIHLTLOGGING_MAXBUFFERSIZE)
+ if (fgAliHLTLoggingTarget.GetSize()>=fgkALIHLTLOGGINGMAXBUFFERSIZE)
{
- gAliHLTLoggingTarget[gAliHLTLoggingTarget.GetSize()-1]=0;
+ fgAliHLTLoggingTarget[fgAliHLTLoggingTarget.GetSize()-1]=0;
break;
}
// check limitation and grow the buffer
- if (iResult>gALIHLTLOGGING_MAXBUFFERSIZE) iResult=gALIHLTLOGGING_MAXBUFFERSIZE;
- gAliHLTLoggingTarget.Set(iResult+1);
+ if (iResult>fgkALIHLTLOGGINGMAXBUFFERSIZE) iResult=fgkALIHLTLOGGINGMAXBUFFERSIZE;
+ fgAliHLTLoggingTarget.Set(iResult+1);
// copy the original list and skip the first argument if this was the format string
#ifdef R__VA_COPY
va_end(ap);
R__VA_COPY(ap, bap);
#else
- gAliHLTLoggingTarget[gAliHLTLoggingTarget.GetSize()-1]=0;
+ fgAliHLTLoggingTarget[fgAliHLTLoggingTarget.GetSize()-1]=0;
break;
#endif //R__VA_COPY
if (format==NULL) va_arg(ap, const char*);
va_end(bap);
#endif //R__VA_COPY
- return gAliHLTLoggingTarget.GetArray();
+ return fgAliHLTLoggingTarget.GetArray();
}
int AliHLTLogging::Logging(AliHLTComponentLogSeverity severity,
if (iResult>0) {
va_list args;
va_start(args, format);
- if (fLoggingFunc) {
- iResult = (*fLoggingFunc)(NULL/*fParam*/, severity, origin, keyword, AliHLTLogging::BuildLogString(format, args ));
+ if (fgLoggingFunc) {
+ iResult = (*fgLoggingFunc)(NULL/*fParam*/, severity, origin, keyword, AliHLTLogging::BuildLogString(format, args ));
} else {
#ifndef NOALIROOT_LOGGING
if (fgUseAliLog)
}
int AliHLTLogging::LoggingVarargs(AliHLTComponentLogSeverity severity,
- const char* origin_class, const char* origin_func,
+ const char* originClass, const char* originFunc,
const char* file, int line, ... ) const
{
// see header file for class documentation
if (iResult>0) {
const char* separator="";
TString origin;
- if (origin_class) {
- origin+=origin_class;
+ if (originClass) {
+ origin+=originClass;
separator="::";
}
- if (origin_func) {
+ if (originFunc) {
origin+=separator;
- origin+=origin_func;
+ origin+=originFunc;
}
va_list args;
va_start(args, line);
- if (fLoggingFunc) {
- iResult=(*fLoggingFunc)(NULL/*fParam*/, severity, origin.Data(), GetKeyword(), AliHLTLogging::BuildLogString(NULL, args ));
+ if (fgLoggingFunc) {
+ iResult=(*fgLoggingFunc)(NULL/*fParam*/, severity, origin.Data(), GetKeyword(), AliHLTLogging::BuildLogString(NULL, args ));
} else {
#ifndef NOALIROOT_LOGGING
if (fgUseAliLog)
- iResult=AliMessage(severity, origin_class, origin_func, file, line, AliHLTLogging::BuildLogString(NULL, args ));
+ iResult=AliMessage(severity, originClass, originFunc, file, line, AliHLTLogging::BuildLogString(NULL, args ));
else
#endif
iResult=Message(NULL/*fParam*/, severity, origin.Data(), GetKeyword(), AliHLTLogging::BuildLogString(NULL, args ));
{
// see header file for class documentation
- int iResult=severity==kHLTLogNone || (severity&fGlobalLogFilter)>0 && (severity&fLocalLogFilter)>0;
+ int iResult=severity==kHLTLogNone || (severity&fgGlobalLogFilter)>0 && (severity&fLocalLogFilter)>0;
return iResult;
}
{
// see header file for class documentation
- fGlobalLogFilter=level;
+ fgGlobalLogFilter=level;
}
void AliHLTLogging::SetLocalLoggingLevel(AliHLTComponentLogSeverity level)
#include "AliHLTDataTypes.h"
#include "AliHLTStdIncludes.h"
#include "TObject.h"
+#include "TArrayC.h"
//#define LOG_PREFIX "" // logging prefix, for later extensions
// logging function with two origin parameters, used by the log macros
//
int LoggingVarargs(AliHLTComponentLogSeverity severity,
- const char* origin_class, const char* origin_func,
+ const char* originClass, const char* originFunc,
const char* file, int line, ... ) const;
// apply filter, return 1 if message should pass
* Print message through AliRoot log channels.
*/
static int AliMessage(AliHLTComponentLogSeverity severity,
- const char* origin_class, const char* origin_func,
+ const char* originClass, const char* originFunc,
const char* file, int line, const char* message);
#endif
*/
static const char* BuildLogString(const char *format, va_list ap);
- virtual void* GetParameter() {return NULL;}
+ /**
+ * Get parameter given by the external caller.
+ * This functionality is not yet implemented. It is intended
+ * to pass the parameter pointer given to the component at
+ * initialization back to the caller.
+ */
+ virtual void* GetParameter() const {return NULL;}
/**
* Switch logging through AliLog on or off
*/
void SwitchAliLog(int sw) {fgUseAliLog=(sw!=0);}
+ /** target stream for AliRoot logging methods */
+ static ostringstream fgLogstr; //! transient
+
protected:
private:
/** the global logging filter */
- static AliHLTComponentLogSeverity fGlobalLogFilter; // see above
+ static AliHLTComponentLogSeverity fgGlobalLogFilter; // see above
/** the local logging filter for one class */
AliHLTComponentLogSeverity fLocalLogFilter; // see above
/** logging callback from the framework */
- static AliHLTfctLogging fLoggingFunc; // see above
+ static AliHLTfctLogging fgLoggingFunc; // see above
/** default keyword */
const char* fpDefaultKeyword; //! transient
/** current keyword */
const char* fpCurrentKeyword; //! transient
/** switch for logging through AliLog, default on */
static int fgUseAliLog; // see above
+ /**
+ * The global logging buffer.
+ * The buffer is created with an initial size and grown dynamically on
+ * demand.
+ */
+ static TArrayC fgAliHLTLoggingTarget; //! transient
+
+ /** the maximum size of the buffer */
+ static const int fgkALIHLTLOGGINGMAXBUFFERSIZE; //! transient
- ClassDef(AliHLTLogging, 1)
+ ClassDef(AliHLTLogging, 2)
};
/* the class AliHLTKeyword is a simple helper class used by the HLTLogKeyword macro
}
private:
- AliHLTLogging* fpParent;
- const char* fpOriginal;
+ AliHLTLogging* fpParent; //! transient
+ const char* fpOriginal; //! transient
};
#endif