FARGOS/VISTA Object Management Environment Core  ..
FARGOS/VISTA Object Management Environment Core Table of Contents
HTTPnotificationPublisher Class Reference

Base class for converting a LogManager into a publisher that outputs log event messages to multiple attached clients. More...

#include <HTTPembeddedServer.hpp>

+ Inheritance diagram for HTTPnotificationPublisher:

Public Member Functions

 HTTPnotificationPublisher (const char *name)
 
virtual ~HTTPnotificationPublisher ()
 
void addInterestedClient (HTTPnotificationReceiverInterface *client)
 
- Public Member Functions inherited from LogManager
void killProcessingThread ()
 
uint_fast32_t getLogPrefixMask () const OME_ALWAYS_INLINE
 Get current log prefix mask. It will be a combination of bits composed from LogMessageRecord::LogPrefixMask enums. More...
 
uint_fast32_t setLogPrefixMask (uint_fast32_t newMask) OME_ALWAYS_INLINE
 Set the log prefix mask. The new mask is defined as a combination of bits created by OR'ing together values from the LogMessageRecord::LogPrefixMask enum. More...
 
void setStripLeadingDirectories (uint_fast32_t dirCount)
 
BufferRegiongetBufferManager () const OME_ALWAYS_INLINE
 Provide access to the underlying BufferRegion. More...
 
IO_Processorget_IO_Manager () const OME_ALWAYS_INLINE
 Provide access to underlying IO_Processor. More...
 
 LogManager (SharedMemoryVariableNode *parentNode, OS_HANDLE_TYPE output_fd, uint_fast8_t useSeparateThread, const char *appName, uint_fast32_t logLinePrefixMask=~0U, uint_fast32_t maxLineSize=(LogManager::MAX_LOG_LINE_LENGTH - sizeof(SharedBufferAllocRecord)), unsigned char *region=nullptr, size_t bytes=(LogManager::MAX_LOG_LINE_LENGTH *64))
 Create anonymous buffer. More...
 
virtual ~LogManager ()
 
int closeLog ()
 Close the open log file. More...
 
SharedBufferAllocRecordallocateBuffer () OME_ALWAYS_INLINE
 Allocate a buffer for a log record. More...
 
void returnBuffer (SharedBufferAllocRecord *rec) OME_ALWAYS_INLINE
 Return a buffer previously allocated by allocateBuffer(). More...
 
unsigned char * bufferAddress (SharedBufferAllocRecord *rec, size_t *bufferLen=nullptr) const OME_ALWAYS_INLINE
 Obtain the physical address and length of a buffer from a SharedBufferAllocRecord, which are data structures intended for use in shared memory segments and utilize relative offsets, enabling simultaneous use by distinct processes that have a segment mapped to different address regions. More...
 
ssize_t writeDataToBuffer (SharedBufferAllocRecord *rec)
 Low-level routine to add a record to log buffer. More...
 
ssize_t copyAndWriteDataToBuffer (SharedBufferAllocRecord *rec, const void *data, size_t len)
 Low-level routine to copy data and add a record to log buffer. More...
 
ssize_t copyAndWriteData (const void *data, size_t len)
 Write block of data to the log buffer. More...
 
const TextBlock_struct pruneDirectoryPrefix (const char *fileName, const int_fast32_t fileNameLen)
 Return the source file name pruned of any leading directory components as indicated by settings imposed by setStripLeadingDirectories() and the stripFilePrefix table. More...
 
const char * getErrorCondition () const OME_ALWAYS_INLINE
 Return error condition text detected. This is normally used to obtain an explanation of errors reported by the operating system when attempting to write log records. More...
 
void setErrorCondition (const char *messageText) OME_ALWAYS_INLINE
 Set error condition text. More...
 
void setTimeAcquisitionRoutine (TimeAcquisitionFP routine)
 Set alternate timestamp acquisition routine. More...
 
TimeAcquisitionFP getTimeAcquisitionRoutine () const OME_ALWAYS_INLINE
 Return pointer to the time acquistion routine associated with the log. More...
 
void getTimestamp (struct timespec *timestamp) const OME_ALWAYS_INLINE
 Return the current time using the timestamp acquisition routine associated with the log. More...
 

Static Public Member Functions

static int forwardToClients (SharedBufferAllocRecord *rec, IO_Processor *controller)
 
- Static Public Member Functions inherited from LogManager
static void defaultGetTime (struct timespec *timestamp, const LogManager *logMgr)
 
static uint_fast32_t addLogComponent (const char *componentName, LogMaskType_t *maskLocation, LogMaskPrimitiveType_t initialMask=0)
 Add definition of new log component. More...
 
static int initializeLogSubsystem (int *newArgc, const char **newArgv, const int argc, const char *argv[], const char *componentName=nullptr, LogMaskType_t *appMaskLocation=nullptr, const uint_fast32_t maxLines=128, const LogMaskPrimitiveType_t logPrefixMask=~0U)
 Initialize logging-specific parameters by passing command line arguments. More...
 
static LogManagernewLogToFileDescriptor (SharedMemoryVariableNode *parentNode, OS_HANDLE_TYPE fd, LogMaskPrimitiveType_t logPrefixMask, uint_fast8_t useSeparateThreads, unsigned char *region, size_t bytes)
 
static LogManagernewLogFileForComponent (SharedMemoryVariableNode *parentNode, const char *app, uint_fast32_t filenameCreateFlags, LogMaskPrimitiveType_t logPrefixMask, uint_fast8_t enableMap, uint_fast8_t useSeparateThreads, size_t desiredRegionSize=0, size_t reserveAtEnd=0, const char *inDir=getenv(DEFAULT_LOG_DIRECTORY_ENVIRONMENT_VARIABLE))
 Create a new file and LogManager for a component. If desired, also create an auxilary backing file for the buffer and create a background thread to perform the actual output. More...
 
static LogManagernewStandardLogFile (const char *namedComponent=nullptr, LogMaskPrimitiveType_t filenameCreateFlags=~0U, SharedMemoryVariableNode *parentNode=nullptr)
 High-level routine to create a standard log file associated with a component. More...
 
static int commitLogRecord (SharedBufferAllocRecord *rec, IO_Processor *controller)
 IO_processor-compatible process routine used to write buffered data to an open file. More...
 
static void setSourceForCustomLogTime (POSIXtimeInNanoseconds *timeSource)
 Convenience routine to set location of a custom time value for log lines. More...
 
static void returnCustomLogTime (struct timespec *timestamp, const LogManager *logMgr)
 Convenience routine to retrieve a custom timestamp for log lines. More...
 

Public Attributes

SharedMemoryVariableNode namingNode
 
- Public Attributes inherited from LogManager
TimePointCache logTimePointCache
 
TimePointCacheTable argTimeCacheTable
 
char logFileName [256]
 

Protected Attributes

std::set< HTTPnotificationReceiverInterface * > interestedClients
 
- Protected Attributes inherited from LogManager
BufferRegionbfrMgr
 
IO_ProcessorioMgr
 
const char * errorCondition
 
size_t blockSize
 
uint_fast32_t logPrefixMask
 
uint32_t stripLeadingDirectories
 
uint32_t _explicitAlignmentPaddding
 
uint32_t cachedFileNameCount
 
TimeAcquisitionFP getTimestampRoutine
 
FileNameCacheEntry fileNameReplacementCache [FILENAME_CACHE_SIZE]
 

Additional Inherited Members

- Public Types inherited from LogManager
enum  { MAX_LOG_LINE_LENGTH =((16 * 4096) + (3 * 64)) }
 
typedef void(* TimeAcquisitionFP) (struct timespec *, const LogManager *)
 
- Static Public Attributes inherited from LogManager
static LogManagerDEFAULT_LogManager
 Default log manager used, set by newStandardLogFile() More...
 
static LogManagerSTDOUT_LogManager = &realize_STDOUT_Manager
 Created automatically. More...
 
static LogManagerSTDERR_LogManager = &realize_STDERR_Manager
 Created automatically. More...
 
- Protected Types inherited from LogManager
enum  { MAX_FILE_PREFIX_ENTRIES = 8, FILENAME_CACHE_SIZE = 4 }
 
- Static Protected Member Functions inherited from LogManager
static void initializePrefixTable ()
 Initializes the file name prefix tables. More...
 
- Static Protected Attributes inherited from LogManager
static uint16_t filePrefixLen [MAX_FILE_PREFIX_ENTRIES]
 
static uint16_t filePrefix2Len [MAX_FILE_PREFIX_ENTRIES]
 
static const char * stripFilePrefix [MAX_FILE_PREFIX_ENTRIES]
 
static const char * stripFilePrefix2 [MAX_FILE_PREFIX_ENTRIES]
 

Detailed Description

Base class for converting a LogManager into a publisher that outputs log event messages to multiple attached clients.

The actual interesting work must be done by a derived class of HTTPnotificationReceiverInterface. This class really provides very generic functionality and can be exploited for other purposes.

Constructor & Destructor Documentation

◆ HTTPnotificationPublisher()

HTTPnotificationPublisher::HTTPnotificationPublisher ( const char *  name)
inlineexplicit

◆ ~HTTPnotificationPublisher()

virtual HTTPnotificationPublisher::~HTTPnotificationPublisher ( )
inlinevirtual

Member Function Documentation

◆ addInterestedClient()

void HTTPnotificationPublisher::addInterestedClient ( HTTPnotificationReceiverInterface client)
inline

References interestedClients.

◆ forwardToClients()

int HTTPnotificationPublisher::forwardToClients ( SharedBufferAllocRecord rec,
IO_Processor controller 
)
static

Member Data Documentation

◆ interestedClients

std::set<HTTPnotificationReceiverInterface *> HTTPnotificationPublisher::interestedClients
protected

◆ namingNode

SharedMemoryVariableNode HTTPnotificationPublisher::namingNode

The documentation for this class was generated from the following files:
Generated: Tue Jul 28 2020 16:03:27
Support Information