Chain< HeadType, TailType > Class Template Reference

Expandable statically-typed container for values and references. More...

#include <Chain.h>

List of all members.

Public Member Functions

 Chain (HeadType head, const TailType &tail)
 Constructor. Sets the head and the tail of the new chain.
 Chain (const Chain< HeadType, TailType > &aChain)
 Copy constructor. Sets the head and the tail of the new chain.
Chain< HeadType, TailType > & operator= (const Chain< HeadType, TailType > &aChain)
 Copy assignment operator.
HeadType GetHead () const
 Returns the m_head attribute.
const TailType & GetTail () const
 Returns the m_tail attribute.
template<typename T >
boost::enable_if_c
< boost::is_arithmetic< T >
::value, Chain< T, Chain
< HeadType, TailType >
> >::type 
operator+ (T head)
 Returns the new Chain with head argument as a new m_head and the original Chain as a m_tail.
template<typename T >
boost::disable_if_c
< boost::is_arithmetic< T >
::value, Chain< const T
&, Chain< HeadType, TailType >
> >::type 
operator+ (const T &head)
 Returns the new Chain with head argument as a new m_head and the original Chain as a m_tail.

Private Attributes

HeadType m_head
 First value of the chain.
const TailType & m_tail
 Rest of the chain.

Friends

class Chain


Detailed Description

template<typename HeadType, typename TailType>
class Nvidia::Logging::Chain< HeadType, TailType >

Expandable statically-typed container for values and references.

Serves as a container for values that user wants to display in a log message. After being wrapped in a ChainLoggable or FormattedChainLoggable it can be passed to the logging pipeline via ScopeLogger::Log().

Chain works like a list from functional programming languages - each instance contains the first value on the m_head attribute, and the rest of the chain - which can be empty - on the m_tail attribute.

Template Parameters:
HeadType Type of the head. Can be a reference or a pointer.
TailType Type of the tail. Has to be a direct type, as m_tail is always stored via reference.

Definition at line 45 of file Chain.h.


Member Function Documentation

boost::disable_if_c<boost::is_arithmetic<T>::value, Chain<const T&, Chain<HeadType, TailType> > >::type operator+ ( const T &  head  )  [inline]

Returns the new Chain with head argument as a new m_head and the original Chain as a m_tail.

This overloaded version of the operator+ is used to add non-arithmetic values (strings, containers, loggables etc.) to the chain. Reference to the head argument will be stored in the chain.

Definition at line 110 of file Chain.h.

boost::enable_if_c<boost::is_arithmetic<T>::value, Chain<T, Chain<HeadType, TailType> > >::type operator+ ( head  )  [inline]

Returns the new Chain with head argument as a new m_head and the original Chain as a m_tail.

This overloaded version of the operator+ is used to add arithmetic values to the chain. Copy of the head argument will be stored in the chain.

Definition at line 96 of file Chain.h.


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

Generated on Thu Sep 17 15:05:17 2009 for Logging by  doxygen 1.5.8