STK++ 0.9.13
|
The Proxy class allow to surdefine operators and methods for every kind of class without using dynamic_cast. More...
#include <STK_Proxy.h>
Public Member Functions | |
template<typename U > | |
Proxy (typename hidden::If< hidden::isSame< Type const, U >::value_, Type, U >::Result &x) | |
constructor : create a reference of the Real x. | |
Proxy (Type const &x) | |
constructor : create a reference of the Real x. | |
Proxy (Proxy const &p) | |
copy constructor | |
Proxy & | operator= (Proxy const &p) |
copy operator | |
~Proxy () | |
destructor. | |
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. | |
Type const & | y_ |
A reference on the object wrapped. | |
Friends | |
istream & | operator>> (istream &is, Proxy< Type > p) |
Overloading of the operator >> for the type Type using a Proxy. | |
ostream & | operator<< (ostream &os, Proxy< Type > const &p) |
Overloading of the operator << for the type Type using a constant Proxy. | |
The Proxy class allow to surdefine operators and methods for every kind of class without using dynamic_cast.
This class allow:
dynamic_cast
Definition at line 51 of file STK_Proxy.h.
|
inline |
constructor : create a reference of the Real x.
Avoid the case x is of type Type const and (thus ambiguity in the choice of the constructor) using sfinae.
x | the object to wrap |
Definition at line 64 of file STK_Proxy.h.
|
inline |
constructor : create a reference of the Real x.
x | the object to wrap |
Definition at line 69 of file STK_Proxy.h.
|
inline |
|
inline |
|
inline |
Conversion operator to Type.
Definition at line 81 of file STK_Proxy.h.
References STK::Proxy< Type >::x_.
|
inline |
Constant Conversion operator to Type.
Definition at line 83 of file STK_Proxy.h.
References STK::Proxy< Type >::y_.
|
inline |
copy operator
p | the proxy to copy |
Definition at line 77 of file STK_Proxy.h.
References STK::Proxy< Type >::x_.
Overloading of the operator << for the type Type using a constant Proxy.
All output stream should use a Proxy in a STK application. For the enumerated types, we have also to define the standard output.
os | the output stream |
p | the value to send to the stream |
Definition at line 129 of file STK_Proxy.h.
Overloading of the operator >> for the type Type using a Proxy.
All input stream should use a Proxy in a STK application. For the enumerated and String types, we have to overload the method. Due to the instruction
this operator will only work for the fundamental C/C++ types. For the other types, the operator
have to be implemented.
is | the input stream |
p | the value to get from the stream |
Definition at line 100 of file STK_Proxy.h.
|
protected |
A reference on the object wrapped.
Definition at line 54 of file STK_Proxy.h.
Referenced by STK::Proxy< String >::operator String &(), STK::Proxy< Type >::operator Type &(), STK::Proxy< Type >::operator=(), and STK::Proxy< String >::operator=().
|
protected |
A reference on the object wrapped.
Definition at line 55 of file STK_Proxy.h.
Referenced by STK::Proxy< String >::operator String const &(), and STK::Proxy< Type >::operator Type const &().