Jpp  18.0.0-rc.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
JLANG::JObject< T > Struct Template Reference

Auxiliary base class for inline creation of a static value or clone from a temporary object. More...

#include <JObject.hh>

Public Types

typedef T data_type
 

Public Member Functions

data_typegetInstance ()
 Get static instance from temporary object. More...
 
data_typeclone () const
 Get clone from temporary object. More...
 

Protected Member Functions

 JObject ()
 Default constructor. More...
 
 JObject (const JObject &)
 Copy constructor. More...
 

Private Member Functions

JObjectoperator= (const JObject &)
 

Detailed Description

template<class T>
struct JLANG::JObject< T >

Auxiliary base class for inline creation of a static value or clone from a temporary object.

Definition at line 18 of file JObject.hh.

Member Typedef Documentation

template<class T>
typedef T JLANG::JObject< T >::data_type

Definition at line 20 of file JObject.hh.

Constructor & Destructor Documentation

template<class T>
JLANG::JObject< T >::JObject ( )
inlineprotected

Default constructor.

Definition at line 53 of file JObject.hh.

54  {}
template<class T>
JLANG::JObject< T >::JObject ( const JObject< T > &  )
inlineprotected

Copy constructor.

Definition at line 60 of file JObject.hh.

61  {}

Member Function Documentation

template<class T>
data_type& JLANG::JObject< T >::getInstance ( )
inline

Get static instance from temporary object.

Returns
reference to static object

Definition at line 27 of file JObject.hh.

28  {
29  static char buffer[sizeof(T)];
30 
31  new (buffer) T(static_cast<const T&>(*this));
32 
33  T* p = reinterpret_cast<data_type*>(buffer);
34 
35  return *p;
36  }
do set_variable OUTPUT_DIRECTORY $WORKDIR T
template<class T>
data_type* JLANG::JObject< T >::clone ( ) const
inline

Get clone from temporary object.

Returns
pointer to newly created object

Definition at line 44 of file JObject.hh.

45  {
46  return new T(static_cast<const T&>(*this));
47  }
do set_variable OUTPUT_DIRECTORY $WORKDIR T
template<class T>
JObject& JLANG::JObject< T >::operator= ( const JObject< T > &  )
private

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