The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::log::DestinationManager Class Reference

Manages a set of destinations representing files or streams. All log messages will be written to at least one destination in this object. More...

#include <Destination.hpp>

Public Types

typedef std::vector< std::unique_ptr< Destination > > DestinationVector
 Vector of destination pointers.
 

Static Public Member Functions

template<class DestT >
static DestinationgetDestination (DestT &arg)
 Requests an existing Destination* from the manager and allocates a new one if it does not yet have a destination matching the input argument.
 
template<std::size_t N>
static DestinationcreateDestination (const char(&arg)[N])
 createDestination overload for handling const char[] strings
 
static DestinationcreateDestination (const char *&arg)
 createDestination overload for handling char* strings
 
template<class DestT >
static DestinationcreateDestination (const DestT &arg)
 
template<class DestT >
static DestinationcreateDestination (DestT &arg)
 
static const DestinationVectorgetDestinations ()
 Returns vector containing all destinations.
 
static uint32_t getNumDestinations ()
 Returns number of destinations contained in the DestinationManager.
 
static std::ostream & dumpDestinations (std::ostream &o, bool pretty=false)
 Dumps the destinations known by the destination manager to an ostream with each destination on a separate line.
 
static std::ostream & dumpFileExtensions (std::ostream &o, bool pretty=false)
 Dumps the supported file extensions for destinations instantiated through the destination manager based on strings (file paths) and describes the resulting file format used based on that extension.
 

Detailed Description

Manages a set of destinations representing files or streams. All log messages will be written to at least one destination in this object.

Definition at line 535 of file Destination.hpp.

Member Typedef Documentation

◆ DestinationVector

typedef std::vector<std::unique_ptr<Destination> > sparta::log::DestinationManager::DestinationVector

Vector of destination pointers.

Definition at line 540 of file Destination.hpp.

Member Function Documentation

◆ createDestination() [1/4]

static Destination * sparta::log::DestinationManager::createDestination ( const char *&  arg)
inlinestatic

createDestination overload for handling char* strings

Definition at line 586 of file Destination.hpp.

◆ createDestination() [2/4]

template<std::size_t N>
static Destination * sparta::log::DestinationManager::createDestination ( const char(&)  arg[N])
inlinestatic

createDestination overload for handling const char[] strings

Definition at line 581 of file Destination.hpp.

◆ createDestination() [3/4]

template<class DestT >
static Destination * sparta::log::DestinationManager::createDestination ( const DestT &  arg)
inlinestatic

Definition at line 591 of file Destination.hpp.

◆ createDestination() [4/4]

template<class DestT >
static Destination * sparta::log::DestinationManager::createDestination ( DestT &  arg)
inlinestatic

Definition at line 596 of file Destination.hpp.

◆ dumpDestinations()

static std::ostream & sparta::log::DestinationManager::dumpDestinations ( std::ostream &  o,
bool  pretty = false 
)
inlinestatic

Dumps the destinations known by the destination manager to an ostream with each destination on a separate line.

Definition at line 619 of file Destination.hpp.

◆ dumpFileExtensions()

static std::ostream & sparta::log::DestinationManager::dumpFileExtensions ( std::ostream &  o,
bool  pretty = false 
)
inlinestatic

Dumps the supported file extensions for destinations instantiated through the destination manager based on strings (file paths) and describes the resulting file format used based on that extension.

Definition at line 634 of file Destination.hpp.

◆ getDestination()

template<class DestT >
static Destination * sparta::log::DestinationManager::getDestination ( DestT &  arg)
inlinestatic

Requests an existing Destination* from the manager and allocates a new one if it does not yet have a destination matching the input argument.

Template Parameters
DestTDestination type. An specialization of DestinationInstance must exist for DestT. An overload of Destination::compare must also exist for DestT.
Parameters
argDestination identifier. This parameter is interpreted based on type and value. For example, const char*, std::string, and const char[] are interpreted to be filenames.
Returns
Destination that will write incoming messages to the destination described by arg.
Exceptions
Exceptionif arg cannot be interpreted to describe a Destination or a file cannot be opened.
Note
Not thread-safe. Destinations modifications must be protected outside of this method if thread-safety is needed \node Once a destination is constructed with an open file handle for "write", it will be appended to by this manager. \warn Filename comparisons may be performed by string comparison. Different paths referring to the same file can cause multiple destinations to be created writing to the same file.

Destinations can never be removed once constructed.

Definition at line 567 of file Destination.hpp.

Here is the call graph for this function:

◆ getDestinations()

static const DestinationVector & sparta::log::DestinationManager::getDestinations ( )
inlinestatic

Returns vector containing all destinations.

Definition at line 603 of file Destination.hpp.

◆ getNumDestinations()

static uint32_t sparta::log::DestinationManager::getNumDestinations ( )
inlinestatic

Returns number of destinations contained in the DestinationManager.

Definition at line 611 of file Destination.hpp.


The documentation for this class was generated from the following file: