ns3::SatLog Class Reference

Class for simulator output logging such as warnings and error messages. More...

#include "satellite-log.h"

+ Inheritance diagram for ns3::SatLog:
+ Collaboration diagram for ns3::SatLog:

Public Types

typedef std::map< key_t, Ptr< SatOutputFileStreamStringContainer > > container_t
 typedef for map of containers More...
 
typedef std::pair< LogType_t, std::string > key_t
 typedef for container key More...
 
enum  LogType_t {
  LOG_GENERIC = 0 , LOG_INFO = 1 , LOG_WARNING = 2 , LOG_ERROR = 3 ,
  LOG_CUSTOM = 4
}
 Enum for log types. More...
 

Public Member Functions

 SatLog ()
 Constructor. More...
 
 ~SatLog ()
 Destructor. More...
 
void AddToLog (LogType_t logType, std::string fileTag, std::string message)
 Function for adding a line to a specific log. More...
 
void DoDispose ()
 Do needed dispose actions. More...
 
TypeId GetInstanceTypeId (void) const
 NS-3 instance type id function. More...
 
void Reset ()
 Function for resetting the variables. More...
 

Static Public Member Functions

static TypeId GetTypeId (void)
 NS-3 type id function. More...
 

Private Member Functions

Ptr< SatOutputFileStreamStringContainerCreateLog (LogType_t logType, std::string fileTag)
 Function for creating a log. More...
 
Ptr< SatOutputFileStreamStringContainerFindLog (LogType_t logType, std::string fileTag)
 Function for finding a log based on the key. More...
 
std::string GetFileTag (LogType_t logType)
 Function for getting the file tag for predefined log types. More...
 
void WriteToFile ()
 Write the contents of a container matching to the key into a file. More...
 

Private Attributes

container_t m_container
 Map for containers. More...
 

Detailed Description

Class for simulator output logging such as warnings and error messages.

The format for messages is (type, custom file tag, message). Custom file tag is in effect only with LOG_CUSTOM. With other types it does not matter and can be left empty. It is also possible to define a simulation specific tag, which is useful with simulation campaigns for avoiding log file overwrite.

The class specifies the following log types: LOG_GENERIC - for all messages LOG_INFO - for info messages LOG_WARNING - for warning messages LOG_ERROR - for error messages LOG_CUSTOM - for custom messages specified by the second parameter

The output files are located in contrib/satellite/data/logs folder. The output file format is the following: log<type><custom file tag><simulation tag>

With (LOG_CUSTOM, "_exampleTag", "Example message for custom log") and simulation tag "_ut30_beam1" the file log_exampleTag_ut30_beam1 would contain the message "Example message for custom log".

Definition at line 54 of file satellite-log.h.

Member Typedef Documentation

◆ container_t

typedef for map of containers

Definition at line 77 of file satellite-log.h.

◆ key_t

typedef std::pair<LogType_t, std::string> ns3::SatLog::key_t

typedef for container key

Definition at line 72 of file satellite-log.h.

Member Enumeration Documentation

◆ LogType_t

Enum for log types.

Enumerator
LOG_GENERIC 

LOG_GENERIC.

LOG_INFO 

LOG_INFO.

LOG_WARNING 

LOG_WARNING.

LOG_ERROR 

LOG_ERROR.

LOG_CUSTOM 

LOG_CUSTOM.

Definition at line 60 of file satellite-log.h.

Constructor & Destructor Documentation

◆ SatLog()

ns3::SatLog::SatLog ( )

Constructor.

Definition at line 51 of file satellite-log.cc.

◆ ~SatLog()

ns3::SatLog::~SatLog ( )

Destructor.

Definition at line 58 of file satellite-log.cc.

References Reset().

+ Here is the call graph for this function:

Member Function Documentation

◆ AddToLog()

void ns3::SatLog::AddToLog ( LogType_t  logType,
std::string  fileTag,
std::string  message 
)

Function for adding a line to a specific log.

Parameters
logTypelog type
fileTagfile tag for the filename
messageline to be added

Definition at line 143 of file satellite-log.cc.

References FindLog(), GetFileTag(), and LOG_CUSTOM.

+ Here is the call graph for this function:

◆ CreateLog()

Ptr< SatOutputFileStreamStringContainer > ns3::SatLog::CreateLog ( LogType_t  logType,
std::string  fileTag 
)
private

Function for creating a log.

Parameters
logTypelog type
fileTagfile tag for the filename
Returns
the created log

Definition at line 87 of file satellite-log.cc.

References m_container.

Referenced by FindLog().

+ Here is the caller graph for this function:

◆ DoDispose()

void ns3::SatLog::DoDispose ( void  )

Do needed dispose actions.

Definition at line 66 of file satellite-log.cc.

References Reset().

+ Here is the call graph for this function:

◆ FindLog()

Ptr< SatOutputFileStreamStringContainer > ns3::SatLog::FindLog ( LogType_t  logType,
std::string  fileTag 
)
private

Function for finding a log based on the key.

Parameters
logTypelog type
fileTagfile tag for the filename
Returns
the log

Definition at line 113 of file satellite-log.cc.

References CreateLog(), and m_container.

Referenced by AddToLog().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetFileTag()

std::string ns3::SatLog::GetFileTag ( LogType_t  logType)
private

Function for getting the file tag for predefined log types.

Parameters
logTypelog type
Returns
file tag

Definition at line 163 of file satellite-log.cc.

References LOG_CUSTOM, LOG_ERROR, LOG_GENERIC, LOG_INFO, and LOG_WARNING.

Referenced by AddToLog().

+ Here is the caller graph for this function:

◆ GetInstanceTypeId()

TypeId ns3::SatLog::GetInstanceTypeId ( void  ) const

NS-3 instance type id function.

Returns
Instance type is

Definition at line 44 of file satellite-log.cc.

References GetTypeId().

+ Here is the call graph for this function:

◆ GetTypeId()

TypeId ns3::SatLog::GetTypeId ( void  )
static

NS-3 type id function.

Returns
type id

Definition at line 37 of file satellite-log.cc.

Referenced by GetInstanceTypeId().

+ Here is the caller graph for this function:

◆ Reset()

void ns3::SatLog::Reset ( void  )

Function for resetting the variables.

Definition at line 74 of file satellite-log.cc.

References m_container, and WriteToFile().

Referenced by ~SatLog(), and DoDispose().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ WriteToFile()

void ns3::SatLog::WriteToFile ( )
private

Write the contents of a container matching to the key into a file.

Definition at line 130 of file satellite-log.cc.

References m_container.

Referenced by Reset().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_container

container_t ns3::SatLog::m_container
private

Map for containers.

Definition at line 151 of file satellite-log.h.

Referenced by CreateLog(), FindLog(), Reset(), and WriteToFile().


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