1#ifndef INC_GLOTONDEMAND_H
2#define INC_GLOTONDEMAND_H
49#include "EuException.h"
69 template <
typename Base,
typename Derived>
135 template <
typename U>
static Yes &
Test(
void( U::* )() );
136 template <
typename U>
static No &
Test(...);
157 &&
sizeof(
Test(
static_cast<Derived*
>( 0 ) ) ) ==
sizeof(
Yes);
206 #define SUPER Reference
308 int set(
const T * rObj );
309 int set(
const T & rObj );
310 int set(
const std::shared_ptr<T> & rObj );
367 int get( std::shared_ptr<T> & rRetVal );
495 throw eut::ErrorNException(
"TOndemand ctor(const ObjID &, Base &)", ERR_NOT_IMPLEMENTED_YET, __FILE__, __LINE__ );
507 #if defined(__GNUC__)
509 #pragma GCC diagnostic push
510 #pragma GCC diagnostic ignored "-Wunused-local-typedefs"
541 ( T::getStaticGloClassID() == pObj->getGloClassID()
543 T::isStaticSubClassID( pObj->getGloClassID() )
548 return SUPER::set( pObj );
550 return ERR_WRONG_TYPE;
556 if ( T::getStaticGloClassID() == rObj.getGloClassID()
558 T::isStaticSubClassID( rObj.getGloClassID() )
561 return SUPER::set( rObj );
563 return ERR_WRONG_TYPE;
569 return this->
set( spObj.get() );
579 ( T::getStaticGloClassID() == rObjID.
getClassID()
586 return SUPER::set( rObjID );
588 return ERR_WRONG_TYPE;
605 return SUPER::set( pObj->
getObjID() );
607 return ERR_WRONG_TYPE;
613 return this->
set( & rObj );
622 t_iErr = SUPER::getBasePersistent( t_pGetObj );
625 prObj =
dynamic_cast<T*
>( t_pGetObj );
629 t_iErr = ERR_WRONG_TYPE;
642 T * t_pPersObject =
nullptr;
643 int t_iErr = this->
get( t_pPersObject );
647 rRetVal.reset( t_pPersObject, Forgetter<T>() );
661 SUPER::operator=( rT );
667 template <
class T2 >
676 if ( (
void*)
this != & rT )
678 SUPER::operator=( rT );
686 return SUPER::operator==( rT );
692 return SUPER::operator!=( rT );
705 return SUPER::operator==( rT );
718 return SUPER::operator!=( rT );
721 #if defined(__GNUC__) && ! defined(__clang__)
723 #pragma GCC diagnostic pop
367 int get( std::shared_ptr<T> & rRetVal ); {
…}
310 int set(
const std::shared_ptr<T> & rObj ); {
…}
Header for BasePersistent
#define SUPER
A reference (as attribute) of a persistent object to another persistent object in the database.
Definition GloTOndemand.h:206
Abstract base class for Persistent and the generic GenericPersistent.
Definition GloBasePersistent.h:124
virtual unsigned int forget()
virtual ObjID getObjID() const
std::string m_strDebugInfo
Definition GloCallBack.h:111
Checks whether template parameters are classes and whether the class of the second template parameter...
Definition GloTOndemand.h:71
char Yes
Definition GloTOndemand.h:83
static const bool value
Definition GloTOndemand.h:155
An object ID consists of the class ID, a database ID and the actual unique object number (all unsigne...
Definition GloObjID.h:84
unsigned long getClassID() const
int set(const T *rObj)
Adopts the object ID of the passed object as reference.
Definition GloTOndemand.h:535
virtual int set(const BasePersistent *rObj) override
Adopts the object ID of the passed object as reference.
Definition GloTOndemand.h:592
bool operator==(const TOndemand &rT) const
Comparison operator.
Definition GloTOndemand.h:684
TOndemand(const TOndemand< T2 > &rT)
Copy constructor.
Definition GloTOndemand.h:515
int set(const T &rObj)
Adopts the object ID of the passed object as reference.
Definition GloTOndemand.h:554
int get(std::shared_ptr< T > &rRetVal)
Definition GloTOndemand.h:640
virtual ~TOndemand()
Definition GloTOndemand.h:530
virtual int set(const ObjID &rObj) override
Adopts the object ID of the passed object as reference.
Definition GloTOndemand.h:573
TOndemand()
Definition GloTOndemand.h:480
bool operator!=(const TOndemand &rT) const
Comparison operator.
Definition GloTOndemand.h:690
int set(const std::shared_ptr< T > &rObj)
Adopts the object ID of the passed object as reference.
Definition GloTOndemand.h:567
virtual int set(const BasePersistent &rObj) override
Adopts the object ID of the passed object as reference.
Definition GloTOndemand.h:611
TOndemand(const ObjID &rObjID)
Definition GloTOndemand.h:489
static unsigned long getStaticGloClassID()
Definition GloTOndemand.h:289
TOndemand< T > & operator=(const TOndemand &rT)
Assignment operator.
Definition GloTOndemand.h:657
TOndemand(const TOndemand &rT)
Copy constructor.
Definition GloTOndemand.h:499
int get(T *&prObj)
Definition GloTOndemand.h:617
Definition GloBasePersistent.h:60
Definition GloTOndemand.h:131
static const bool value
Definition GloTOndemand.h:138
char Yes[1]
Definition GloTOndemand.h:132
char No[2]
Definition GloTOndemand.h:133
static Yes & Test(void(U::*)())
Definition GloTOndemand.h:94
char dummy[2]
Definition GloTOndemand.h:94