Phosphor
phosphor::TraceArgument Union Reference

#include <trace_argument.h>

Public Types

enum  Type : char {
  is_bool, is_uint, is_int, is_double,
  is_pointer, is_string, is_istring, is_none
}
 

Public Member Functions

 TraceArgument ()=default
 
template<class T >
constexpr TraceArgument (T src)
 
std::string to_string (TraceArgument::Type type) const
 

Public Attributes

bool as_bool
 
unsigned long long as_uint
 
long long as_int
 
double as_double
 
const char * as_string
 
const void * as_pointer
 
inline_zstring< 8 > as_istring
 
NoneType as_none
 

Detailed Description

A union which represents a single trace argument.

Has various methods / constructors for tidily creating and printing the TraceArgument.

Member Enumeration Documentation

enum phosphor::TraceArgument::Type : char
strong

Enumeration of the possible types of a TraceArgument

Constructor & Destructor Documentation

phosphor::TraceArgument::TraceArgument ( )
default

Default constructor

template<class T >
constexpr phosphor::TraceArgument::TraceArgument ( src)
inline

Templated conversion constructor

Parameters
srcValue to be converted to a TraceArgument

Usage:

TraceArgument trace_arg = TraceArgument(arg);

Where arg is one of many primitive types, e.g. int.

Member Function Documentation

std::string phosphor::TraceArgument::to_string ( TraceArgument::Type  type) const
inline

Converts the TraceArgument to string

Parameters
typeThe enum which describes the type of the TraceArgument
Returns
String form of the TraceArgument as the given type

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