Jpp 21.0.0-rc.3
the software that should make you happy
Loading...
Searching...
No Matches
JTOOLS::JAutoElement< JBase_t > Class Template Reference

Handler class for automatic pointer. More...

#include <JSelector.hh>

Inheritance diagram for JTOOLS::JAutoElement< JBase_t >:

Public Types

typedef JAutoElement< JBase_t > JAutoElement_t
 

Public Member Functions

 JAutoElement ()
 Default constructor.
 
template<class JDerived_t >
 JAutoElement (JType< JDerived_t > type)
 Constructor.
 
template<class JDerived_t >
 JAutoElement (JDerived_t *p)
 Constructor.
 
template<class JDerived_t >
void set ()
 Set the automatic pointer to the given data type.
 
template<class JDerived_t >
void set (JType< JDerived_t > type)
 Set the automatic pointer to the given data type.
 
template<class JDerived_t >
void set (JDerived_t *p)
 Set the automatic pointer to the given data type.
 
template<class JDerived_t >
JAutoElementoperator= (JType< JDerived_t > type)
 Assign given data type to the automatic pointer.
 
template<class JDerived_t >
JAutoElementoperator= (JDerived_t *p)
 Assign given data type to the automatic pointer.
 

Friends

std::istream & operator>> (std::istream &in, JAutoElement_t &element)
 Stream input.
 
std::ostream & operator<< (std::ostream &out, const JAutoElement_t &element)
 Stream output.
 

Detailed Description

template<class JBase_t>
class JTOOLS::JAutoElement< JBase_t >

Handler class for automatic pointer.

Definition at line 125 of file JTools/JSelector.hh.

Member Typedef Documentation

◆ JAutoElement_t

template<class JBase_t >
JAutoElement<JBase_t> JTOOLS::JAutoElement< JBase_t >::JAutoElement_t

Definition at line 130 of file JTools/JSelector.hh.

Constructor & Destructor Documentation

◆ JAutoElement() [1/3]

template<class JBase_t >
JTOOLS::JAutoElement< JBase_t >::JAutoElement ( )
inline

Default constructor.

Definition at line 136 of file JTools/JSelector.hh.

137 {}

◆ JAutoElement() [2/3]

template<class JBase_t >
template<class JDerived_t >
JTOOLS::JAutoElement< JBase_t >::JAutoElement ( JType< JDerived_t > type)
inline

Constructor.

Parameters
typedata type

Definition at line 146 of file JTools/JSelector.hh.

147 {
148 this->set(type);
149 }
void set()
Set the automatic pointer to the given data type.

◆ JAutoElement() [3/3]

template<class JBase_t >
template<class JDerived_t >
JTOOLS::JAutoElement< JBase_t >::JAutoElement ( JDerived_t * p)
inline

Constructor.

This class owns the pointer.

Parameters
ppointer to object

Definition at line 159 of file JTools/JSelector.hh.

160 {
161 this->set(p);
162 }

Member Function Documentation

◆ set() [1/3]

template<class JBase_t >
template<class JDerived_t >
void JTOOLS::JAutoElement< JBase_t >::set ( )
inline

Set the automatic pointer to the given data type.

Definition at line 169 of file JTools/JSelector.hh.

170 {
171 this->set(JType<JDerived_t>());
172 }

◆ set() [2/3]

template<class JBase_t >
template<class JDerived_t >
void JTOOLS::JAutoElement< JBase_t >::set ( JType< JDerived_t > type)
inline

Set the automatic pointer to the given data type.

Parameters
typedata type

Definition at line 181 of file JTools/JSelector.hh.

182 {
183 this->reset(new JAutoPointer<JDerived_t, JBase_t>());
184 }
void reset(T &value)
Reset value.

◆ set() [3/3]

template<class JBase_t >
template<class JDerived_t >
void JTOOLS::JAutoElement< JBase_t >::set ( JDerived_t * p)
inline

Set the automatic pointer to the given data type.

Parameters
ppointer to object

Definition at line 193 of file JTools/JSelector.hh.

194 {
195 this->reset(new JAutoPointer<JDerived_t, JBase_t>(p));
196 }

◆ operator=() [1/2]

template<class JBase_t >
template<class JDerived_t >
JAutoElement & JTOOLS::JAutoElement< JBase_t >::operator= ( JType< JDerived_t > type)
inline

Assign given data type to the automatic pointer.

Parameters
typedata type
Returns
this JAutoElement

Definition at line 206 of file JTools/JSelector.hh.

207 {
208 set(type);
209
210 return *this;
211 }

◆ operator=() [2/2]

template<class JBase_t >
template<class JDerived_t >
JAutoElement & JTOOLS::JAutoElement< JBase_t >::operator= ( JDerived_t * p)
inline

Assign given data type to the automatic pointer.

Parameters
ppointer to object
Returns
this JAutoElement

Definition at line 221 of file JTools/JSelector.hh.

222 {
223 set(p);
224
225 return *this;
226 }

Friends And Related Symbol Documentation

◆ operator>>

template<class JBase_t >
std::istream & operator>> ( std::istream & in,
JAutoElement_t & element )
friend

Stream input.

Parameters
ininput stream
elementelement
Returns
input stream

Definition at line 236 of file JTools/JSelector.hh.

237 {
238 if (element.is_valid())
239 return element.get()->read(in);
240 else
241 return in;
242 }

◆ operator<<

template<class JBase_t >
std::ostream & operator<< ( std::ostream & out,
const JAutoElement_t & element )
friend

Stream output.

Parameters
outoutput stream
elementelement
Returns
output stream

Definition at line 252 of file JTools/JSelector.hh.

253 {
254 if (element.is_valid())
255 return element.get()->write(out);
256 else
257 return out;
258 }

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