Version: 8.3.0
FileTraceCollector Class Reference

See also other derived Classes in SALOMELocalTrace for usage without CORBA, see also derived Classes in SALOMETraceCollector for usage with CORBA. More...

#include <FileTraceCollector.hxx>

Inheritance diagram for FileTraceCollector:

Public Member Functions

 ~FileTraceCollector ()
 Destructor: wait until printing thread ends (FileTraceCollector::run) More...
 

Static Public Member Functions

static BaseTraceCollectorinstance (const char *fileName)
 This class is for use without CORBA, inside or outside SALOME. More...
 
static void * run (void *bid)
 In a separate thread, loop to print traces. More...
 

Protected Member Functions

 FileTraceCollector ()
 Constructor: no need of LocalTraceBufferPool object initialization here, thread safe singleton used in LocalTraceBufferPool::instance() More...
 

Static Protected Attributes

static std::string _fileName = ""
 
static int _threadToClose = 0
 
static BaseTraceCollector_singleton = 0
 
static pthread_mutex_t _singletonMutex
 
static pthread_t * _threadId = 0
 
static sem_t _sem
 

Detailed Description

See also other derived Classes in SALOMELocalTrace for usage without CORBA, see also derived Classes in SALOMETraceCollector for usage with CORBA.

Constructor & Destructor Documentation

FileTraceCollector::FileTraceCollector ( )
protected

Constructor: no need of LocalTraceBufferPool object initialization here, thread safe singleton used in LocalTraceBufferPool::instance()

References BaseTraceCollector::_threadId, and BaseTraceCollector::_threadToClose.

Referenced by instance().

Member Function Documentation

BaseTraceCollector * FileTraceCollector::instance ( const char fileName)
static

This class is for use without CORBA, inside or outside SALOME.

SALOME uses SALOMETraceCollector, to allow trace collection via CORBA. Type of trace (and corresponding class) is choosen in LocalTraceBufferPool.

Guarantees a unique object instance of the class (singleton thread safe) a separate thread for loop to print traces is launched.

References _fileName, BaseTraceCollector::_sem, BaseTraceCollector::_singleton, BaseTraceCollector::_singletonMutex, DEVTRACE, FileTraceCollector(), and run().

Referenced by LocalTraceBufferPool::instance().

void * FileTraceCollector::run ( void *  bid)
static

In a separate thread, loop to print traces.

Mutex garantees intialisation on instance method is done and only one run allowed (double check ...) Loop until there is no more buffer to print, and no ask for end from destructor. Get a buffer. If type = ABORT then exit application with message.

References _fileName, BaseTraceCollector::_sem, BaseTraceCollector::_threadId, BaseTraceCollector::_threadToClose, ABORT_MESS, DEVTRACE, LocalTraceBufferPool::instance(), out, LocalTraceBufferPool::retrieve(), LocalTrace_TraceInfo::threadId, LocalTraceBufferPool::toCollect(), LocalTrace_TraceInfo::trace, traceFile, and LocalTrace_TraceInfo::traceType.

Referenced by instance().

Field Documentation

std::string FileTraceCollector::_fileName = ""
staticprotected

Referenced by instance(), and run().