Public Types | Public Member Functions | Protected Member Functions | List of all members
ReferenceT< T > Class Template Reference

Intermediate class supporting link() in various forms. More...

#include <ReferenceT.h>

Inheritance diagram for ReferenceT< T >:
Inheritance graph
[legend]
Collaboration diagram for ReferenceT< T >:
Collaboration graph
[legend]

Public Types

typedef const drain::ReferenceT< T > reference_t
 
typedef std::pair< const char *, const drain::ReferenceT< T > > init_pair_t
 

Public Member Functions

virtual bool isLinkable () const
 Tells if the internal pointer can point to an external variable. More...
 
template<class T2 >
ReferenceTlink (ReferenceT< T2 > &x)
 
ReferenceTlink (VariableT< ReferenceT< Castable > > &x)
 Linkage for Reference, above all for copy constructor.
 
ReferenceTlink (VariableT< VariableInitializer< ReferenceT< VariableBase > > > &x)
 Linkage for a FlexibleVariable.
 
ReferenceTlink (VariableT< VariableInitializer< VariableBase > > &x)
 Linkage for a Variable - produces a warning, because internal variable has dynamic type.
 
template<class F >
ReferenceTlink (F &p)
 Set pointer to &p. More...
 
template<class F >
ReferenceTlink (F *p)
 Set pointer to &p. More...
 
ReferenceTlink (void *p, const std::type_info &t, size_t count=1)
 Set pointer to p, of given type.
 
ReferenceTlink (void *p)
 
ReferenceTlink (Castable &x)
 

Protected Member Functions

template<class D >
void init (D &dst)
 Copy constructor handler - important.
 
template<class S >
void init (const S &src)
 
template<class D >
void init (D *dst)
 
void init (void *p, const std::type_info &t, size_t count=1)
 
void init ()
 
void init (const S &src)
 

Detailed Description

template<class T>
class drain::ReferenceT< T >

Intermediate class supporting link() in various forms.

See also comparison of all the three variable classes:

See also
drain::VariableT

Constructors

Reference
Reference
Default constructor
V variable; null
Copy constructor
bool b=true; V var(b); V variable(var); true ®
char c='Y'; V var(c); V variable(var); Y ®
int i=123; V var(i); V variable(var); 123 ®
double d=45.678; V var(d); V variable(var); 45.678 ®
std::string str("Test"); V var(str); V variable(var); "Test" ®
UniTuple2i uni2i(INIT_2i); V var(uni2i); V variable(var); 12,34 ®
UniTuple3d uni3d(INIT_3d); V var(uni3d); V variable(var); 5.6,7.8,9 ®
Copy constructor variants
int i=123; Variable var(i); V variable(var); null
int i=123; FlexibleVariable var(i); V variable(var); null
int i=123; FlexibleVariable var; var.link(i); V variable(var); 123 ®
int i=123; Reference var(i); V variable(var); 123 ®
std::string str("Test"); Variable var(str); V variable(var); null
std::string str("Test"); FlexibleVariable var(str); V variable(var); null
std::string str("Test"); FlexibleVariable var; var.link(str); V variable(var); "Test" ®
std::string str("Test"); Reference var(str); V variable(var); "Test" ®
UniTuple3d uni3d(INIT_3d); Variable var(uni3d); V variable(var); null
UniTuple3d uni3d(INIT_3d); FlexibleVariable var(uni3d); V variable(var); null
UniTuple3d uni3d(INIT_3d); FlexibleVariable var; var.link(uni3d); V variable(var); 5.6,7.8,9 ®
UniTuple3d uni3d(INIT_3d); Reference var(uni3d); V variable(var); 5.6,7.8,9 ®
Non-const variable arg
bool b=true; V variable(b); true ®
char c='Y'; V variable(c); Y ®
int i=123; V variable(i); 123 ®
double d=45.678; V variable(d); 45.678 ®
std::string str("Test"); V variable(str); "Test" ®
UniTuple2i uni2i(INIT_2i) V variable(uni2i); 12,34 ®
UniTuple3d uni3d(INIT_3d) V variable(uni3d); 5.6,7.8,9 ®

Assignment

Reference - assignments
input Reference
type value bool unsigned char char short int unsigned long float double std::string
bool false false ® ® ® 0 ® 0 ® 0 ® 0 ® 0 ® "0" ®
bool true true ®  ®  ® 1 ® 1 ® 1 ® 1 ® 1 ® "1" ®
int 123 true ® { ® { ® 123 ® 123 ® 123 ® 123 ® 123 ® "123" ®
float 12.345f true ® ® ® 12 ® 12 ® 12 ® 12.345 ® 12.345 ® "12.345" ®
double 3.14159265358979323846 true ®  ®  ® 3 ® 3 ® 3 ® 3.14159 ® 3.14159 ® "3.14159" ®
double 314.15926E-02 true ®  ®  ® 3 ® 3 ® 3 ® 3.14159 ® 3.14159 ® "3.14159" ®
std::string "Hello!" false ® ® H ® 0 ® 0 ® 0 ® 0 ® 0 ® "Hello!" ®
std::string "true" true ® ® t ® 0 ® 0 ® 0 ® 0 ® 0 ® "true" ®
std::string "false" false ® ® f ® 0 ® 0 ® 0 ® 0 ® 0 ® "false" ®
std::string "3141592E-6" true ® Ø Â® 3 ® -4136 ® 3141592 ® 3141592 ® 3.14159 ® 3.14159 ® "3141592E-6" ®
const char * "Test" false ® ® T ® 0 ® 0 ® 0 ® 0 ® 0 ® "Test" ®
const char * "true" true ® ® t ® 0 ® 0 ® 0 ® 0 ® 0 ® "true" ®
const char * "false" false ® ® f ® 0 ® 0 ® 0 ® 0 ® 0 ® "false" ®
UniTuple<2,int> uni2i true ® ® ® 12 ® 12 ® 12 ® 12 ® 12 ® "12,34" ®
UniTuple<3,double> uni3d true ®  ®  ® 5 ® 5 ® 5 ® 5.6 ® 5.6 ® "5.6,7.8,9" ®
void * nullptr false ® ® n ® 0 ® 0 ® 0 ® 0 ® 0 ® "nullptr" ®
Variables...
int i=123 Variable(i) true ® { ® { ® 123 ® 123 ® 123 ® 123 ® 123 ® "123" ®
int i=123 FlexibleVariable(i) true ® { ® { ® 123 ® 123 ® 123 ® 123 ® 123 ® "123" ®
int i=123 Reference(i) true ® { ® { ® 123 ® 123 ® 123 ® 123 ® 123 ® "123" ®
std::string s("test") Variable(s) false ® ® t ® 0 ® 0 ® 0 ® 0 ® 0 ® "test" ®
std::string s("test") FlexibleVariable(s) false ® ® t ® 0 ® 0 ® 0 ® 0 ® 0 ® "test" ®
std::string s("test") Reference(s) false ® ® t ® 0 ® 0 ® 0 ® 0 ® 0 ® "test" ®
UniTuple Variable(uni3d) true ®  ®  ® 5 ® 5 ® 5 ® 5.6 ® 5.6 ® "5.6,7.8,9" ®
UniTuple FlexibleVariable(uni3d) true ®  ®  ® 5 ® 5 ® 5 ® 5.6 ® 5.6 ® "5.6,7.8,9" ®
UniTuple Reference(uni3d) true ®  ®  ® 5 ® 5 ® 5 ® 5.6 ® 5.6 ® "5.6,7.8,9" ®
Template Parameters
T- Castable or VariableBase

Member Function Documentation

◆ isLinkable()

virtual bool isLinkable ( ) const
inlinevirtual

Tells if the internal pointer can point to an external variable.

Returns
- true for Reference and Flexible, and false for Variable.

◆ link() [1/2]

ReferenceT& link ( F &  p)
inline

Set pointer to &p.

Template Parameters
T- target object (if Castable or Reference redirected to relink() )

◆ link() [2/2]

ReferenceT& link ( F *  p)
inline

Set pointer to &p.

Template Parameters
T- target object (if Castable or Reference redirected to relink() )

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