STK++ 1.0

STK::Proxy< TYPE > Class Template Reference

The Proxy classe allow to surdefine operators and methods for every kind of class without using dynamic_cast. More...

#include <STK_Proxy.h>

Inheritance diagram for STK::Proxy< TYPE >:

List of all members.

Public Member Functions

 Proxy (TYPE &x)
 Default constructor : create a reference of the Real x.
Proxyoperator= (TYPE const &x)
 overwrite with a TYPE.
virtual ~Proxy ()
 Virtual destructor.
Proxyoperator= (const Proxy< TYPE > &x)
 overwrite with a Proxy<TYPE>.
Proxyoperator= (const ConstProxy< TYPE > &x)
 overwrite with a ConstProxy<TYPE>.
 operator TYPE & ()
 Conversion operator to TYPE.
 operator TYPE const & () const
 Constant Conversion operator to TYPE.

Protected Attributes

TYPE & x_
 A reference on the object wrapped.

Detailed Description

template<class TYPE>
class STK::Proxy< TYPE >

The Proxy classe allow to surdefine operators and methods for every kind of class without using dynamic_cast.

This class allow:

  • To avoid the use of dynamic_cast
  • To surdefine the predefined operators (like << and >>) for the C++ fundamental types.
  • To handle in a transparent way the NA values.

Definition at line 96 of file STK_Proxy.h.


Constructor & Destructor Documentation

template<class TYPE>
STK::Proxy< TYPE >::Proxy ( TYPE &  x) [inline]

Default constructor : create a reference of the Real x.

Parameters:
xthe object to wrap

Definition at line 105 of file STK_Proxy.h.

                           : x_(x)
     { ;}
template<class TYPE>
virtual STK::Proxy< TYPE >::~Proxy ( ) [inline, virtual]

Virtual destructor.

Definition at line 119 of file STK_Proxy.h.

{}

Member Function Documentation

template<class TYPE>
Proxy& STK::Proxy< TYPE >::operator= ( TYPE const &  x) [inline]

overwrite with a TYPE.

Parameters:
xthe value to wrapp

Definition at line 111 of file STK_Proxy.h.

References STK::Proxy< TYPE >::x_.

     {
       x_ = x;
       return *this;
     }
template<class TYPE>
Proxy& STK::Proxy< TYPE >::operator= ( const Proxy< TYPE > &  x) [inline]

overwrite with a Proxy<TYPE>.

Parameters:
xa wrapped value to copy

Definition at line 124 of file STK_Proxy.h.

References STK::Proxy< TYPE >::x_.

     {
       x_ = x;
       return *this;
     }
template<class TYPE>
Proxy& STK::Proxy< TYPE >::operator= ( const ConstProxy< TYPE > &  x) [inline]

overwrite with a ConstProxy<TYPE>.

Parameters:
xa constant wrapped value to set

Definition at line 133 of file STK_Proxy.h.

References STK::Proxy< TYPE >::x_.

     {
       x_ = x;
       return *this;
     }
template<class TYPE>
STK::Proxy< TYPE >::operator TYPE & ( ) [inline]

Conversion operator to TYPE.

Definition at line 141 of file STK_Proxy.h.

References STK::Proxy< TYPE >::x_.

     { return x_;}
template<class TYPE>
STK::Proxy< TYPE >::operator TYPE const & ( ) const [inline]

Constant Conversion operator to TYPE.

Definition at line 146 of file STK_Proxy.h.

References STK::Proxy< TYPE >::x_.

     { return x_;}

Member Data Documentation

template<class TYPE>
TYPE& STK::Proxy< TYPE >::x_ [protected]

A reference on the object wrapped.

Definition at line 99 of file STK_Proxy.h.

Referenced by STK::Proxy< TYPE >::operator TYPE &(), STK::Proxy< TYPE >::operator TYPE const &(), and STK::Proxy< TYPE >::operator=().


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