PBoxing< T > Class Template Reference

Detailed Description

template<typename T>
class PBoxing< T >

Generic container to box primitive data types, like int (PInt32), bool (PBool) or double (PDouble), so that they can be used as PObject; PBoxing instances are immutable (thread-safe).

The correspondence is the following:

C++ data type papillon object (PObject)
bool PBool
signed char / papillon::int8 PInt8
unsigned char / papillon::uint8 PUInt8
signed short / papillon::int16 PInt16
unsigned short / papillon::uint16 PUInt16
int / papillon::int32 PInt32
unsigned int / papillon::uint32 PUInt32
long long / papillon::int64 PInt64
unsigned long long / papillon::int64 PUInt64
float PFloat
double PDouble

Example:

papillon::int32 i = 42;
papillon::PInt32 iObject(i);
i = iObject.GetValue();

Definition at line 50 of file PBoxing.h.

#include <PBoxing.h>

Constructor & Destructor Documentation

◆ PBoxing() [1/2]

template<typename T>
PBoxing< T >::PBoxing ( const T &  value = T(0))

Boxes a value from a primitive data type.

◆ PBoxing() [2/2]

template<typename T>
PBoxing< T >::PBoxing ( const PBoxing< T > &  other)

Constructs a shared copy of other.

Member Function Documentation

◆ GetValue()

template<typename T>
T PBoxing< T >::GetValue ( ) const

Gets the value (unboxing).

◆ operator!=() [1/2]

template<typename T>
bool PBoxing< T >::operator!= ( value) const

Returns true if this is different from the specified value, false otherwise.

◆ operator!=() [2/2]

template<typename T>
bool PBoxing< T >::operator!= ( const PBoxing< T > &  value) const

Returns true if this is different from the specified value, false otherwise.

◆ operator<() [1/2]

template<typename T>
bool PBoxing< T >::operator< ( value) const

Returns true if this is smaller than the specified value, false otherwise.

◆ operator<() [2/2]

template<typename T>
bool PBoxing< T >::operator< ( const PBoxing< T > &  value) const

Returns true if this is smaller than the specified value, false otherwise.

◆ operator<=() [1/2]

template<typename T>
bool PBoxing< T >::operator<= ( value) const

Returns true if this is smaller or equal than the specified value, false otherwise.

◆ operator<=() [2/2]

template<typename T>
bool PBoxing< T >::operator<= ( const PBoxing< T > &  value) const

Returns true if this is smaller or equal than the specified value, false otherwise.

◆ operator=()

template<typename T>
PBoxing<T>& PBoxing< T >::operator= ( const PBoxing< T > &  other)

Performs a shared copy of other to this object.

◆ operator==() [1/2]

template<typename T>
bool PBoxing< T >::operator== ( value) const

Returns true if this is equal than the specified value, false otherwise.

◆ operator==() [2/2]

template<typename T>
bool PBoxing< T >::operator== ( const PBoxing< T > &  value) const

Returns true if this is equal than the specified value, false otherwise.

◆ operator>() [1/2]

template<typename T>
bool PBoxing< T >::operator> ( value) const

Returns true if this is greater than the specified value, false otherwise.

◆ operator>() [2/2]

template<typename T>
bool PBoxing< T >::operator> ( const PBoxing< T > &  value) const

Returns true if this is greater than the specified value, false otherwise.

◆ operator>=() [1/2]

template<typename T>
bool PBoxing< T >::operator>= ( value) const

Returns true if this is greater or equal than the specified value, false otherwise.

◆ operator>=() [2/2]

template<typename T>
bool PBoxing< T >::operator>= ( const PBoxing< T > &  value) const

Returns true if this is greater or equal than the specified value, false otherwise.