A Discrete-Event Network Simulator
API
ns3::ParameterLogger Class Reference

Insert , when streaming function arguments. More...

#include "log.h"

+ Collaboration diagram for ns3::ParameterLogger:

Public Member Functions

 ParameterLogger (std::ostream &os)
 Constructor. More...
 
ParameterLoggeroperator<< (const char *param)
 Overload for C-strings. More...
 
template<typename T >
ParameterLoggeroperator<< (const std::vector< T > &vector)
 Overload for vectors, to print each element. More...
 
template<typename T , typename U = std::enable_if_t<!std::is_arithmetic_v<T>>>
ParameterLoggeroperator<< (const T &param)
 Write a function parameter on the output stream, separating parameters after the first by , strings. More...
 
template<typename T , typename U = std::enable_if_t<std::is_arithmetic_v<T>>>
ParameterLoggeroperator<< (T param)
 Write a function parameter on the output stream, separating parameters after the first by , strings. More...
 

Private Member Functions

void CommaRest ()
 Add , before every parameter after the first. More...
 

Private Attributes

bool m_first {true}
 First argument flag, doesn't get ,. More...
 
std::ostream & m_os
 Underlying output stream. More...
 

Detailed Description

Insert , when streaming function arguments.

Definition at line 437 of file log.h.

Constructor & Destructor Documentation

◆ ParameterLogger()

ns3::ParameterLogger::ParameterLogger ( std::ostream &  os)

Constructor.

Parameters
[in]osUnderlying output stream.

Definition at line 540 of file log.cc.

Member Function Documentation

◆ CommaRest()

void ns3::ParameterLogger::CommaRest ( )
private

Add , before every parameter after the first.

Definition at line 546 of file log.cc.

References m_first, and m_os.

Referenced by operator<<().

+ Here is the caller graph for this function:

◆ operator<<() [1/4]

ParameterLogger & ns3::ParameterLogger::operator<< ( const char *  param)

Overload for C-strings.

Parameters
[in]paramThe C-string
Returns
This ParameterLogger, so it's chainable.

Definition at line 567 of file log.cc.

◆ operator<<() [2/4]

template<typename T >
ParameterLogger & ns3::ParameterLogger::operator<< ( const std::vector< T > &  vector)

Overload for vectors, to print each element.

Parameters
[in]vectorThe vector of parameters
Returns
This ParameterLogger, so it's chainable.

Definition at line 515 of file log.h.

◆ operator<<() [3/4]

template<typename T , typename U >
ParameterLogger & ns3::ParameterLogger::operator<< ( const T &  param)

Write a function parameter on the output stream, separating parameters after the first by , strings.

Overload for non-arithmetic types, enabling the parameter to be passed by reference.

Parameters
[in]paramThe function parameter.
Returns
This ParameterLogger, so it's chainable.

Definition at line 506 of file log.h.

References CommaRest(), and m_os.

+ Here is the call graph for this function:

◆ operator<<() [4/4]

template<typename T , typename U >
ParameterLogger & ns3::ParameterLogger::operator<< ( param)

Write a function parameter on the output stream, separating parameters after the first by , strings.

Overload for arithmetic types (integral type or floating point type), enabling the parameter to be passed by value.

Parameters
[in]paramThe function parameter.
Returns
This ParameterLogger, so it's chainable.

Definition at line 497 of file log.h.

References CommaRest(), and m_os.

+ Here is the call graph for this function:

Member Data Documentation

◆ m_first

bool ns3::ParameterLogger::m_first {true}
private

First argument flag, doesn't get ,.

Definition at line 492 of file log.h.

Referenced by CommaRest().

◆ m_os

std::ostream& ns3::ParameterLogger::m_os
private

Underlying output stream.

Definition at line 493 of file log.h.

Referenced by CommaRest(), and operator<<().


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