matador::object_ptr< T > Class Template Reference

The object_ptr holds a pointer to an serializable. More...

#include <object_ptr.hpp>

Inherits matador::object_holder.

Public Types

typedef T object_type
 
typedef object_ptr< T > self
 

Public Member Functions

 object_ptr ()=default
 
 object_ptr (const self &x)
 
 object_ptr (self &&x) noexcept
 
 object_ptr (T *o)
 
 object_ptr (std::nullptr_t)
 
 object_ptr (object_proxy *proxy)
 
object_ptroperator= (T *x)
 
object_ptroperator= (const self &x)
 Copy assignes an object_ptr from the given has_one object.
 
object_ptroperator= (self &&x) noexcept
 
object_ptroperator= (std::nullptr_t)
 
const char * type () const override
 
const T * operator-> () const
 Return the pointer to the serializable of type T.
 
const T * get () const
 Return the pointer to the serializable of type T.
 
T * get ()
 Return the pointer to the serializable of type T.
 
T * modify ()
 
const T & operator* () const
 Return the reference to the serializable of type T.
 
T & operator* ()
 Return the reference to the serializable of type T.
 
identifier create_identifier () const override
 
- Public Member Functions inherited from matador::object_holder
bool operator== (const object_holder &x) const
 
bool operator== (std::nullptr_t) const
 
bool operator!= (const object_holder &x) const
 
bool operator!= (std::nullptr_t) const
 
 operator bool () const noexcept
 
void reset (object_proxy *proxy, cascade_type cascade)
 
void reset (object_proxy *proxy, cascade_type cascade, bool notify_foreign_relation)
 
void reset (object_holder &holder)
 
void reset (const identifier &id) override
 
void clear ()
 
bool empty () const noexcept
 
bool valid () const noexcept
 
bool is_loaded () const
 
unsigned long long id () const
 
object_storestore () const
 
void * ptr ()
 
const void * ptr () const
 
void * lookup_object ()
 
void * lookup_object () const
 
bool is_internal () const
 
bool is_inserted () const
 
bool has_primary_key () const override
 
const identifierprimary_key () const override
 
identifierprimary_key () override
 
unsigned long reference_count () const
 
cascade_type cascade () const
 

Additional Inherited Members

- Protected Member Functions inherited from matador::object_holder
 object_holder ()=default
 Creates and empty base pointer.
 
 object_holder (const object_holder &x)
 
 object_holder (object_holder &&x) noexcept
 
object_holderoperator= (const object_holder &x)
 
object_holderoperator= (object_holder &&x) noexcept
 
 object_holder (object_proxy *proxy)
 Creates an object_holder with a given object_proxy.
 
 ~object_holder () override
 

Detailed Description

template<class T>
class matador::object_ptr< T >

The object_ptr holds a pointer to an serializable.

Template Parameters
TThe type of the serializable.

The object_ptr holds a pointer to an object. The object_ptr is a wrapper class for the object class It has a reference count mechanism. The objects inserted into the object_store are returned as a object_ptr and should be used through the object_ptr class.

Member Typedef Documentation

◆ object_type

template<class T >
typedef T matador::object_ptr< T >::object_type

Shortcut for serializable type.

◆ self

template<class T >
typedef object_ptr<T> matador::object_ptr< T >::self

Shortcut for self class.

Constructor & Destructor Documentation

◆ object_ptr() [1/6]

template<class T >
matador::object_ptr< T >::object_ptr ( )
default

Create an empty object_ptr

◆ object_ptr() [2/6]

template<class T >
matador::object_ptr< T >::object_ptr ( const self x)
inline

Copies object_ptr

Parameters
xThe object_ptr to copy

◆ object_ptr() [3/6]

template<class T >
matador::object_ptr< T >::object_ptr ( self &&  x)
inlinenoexcept

Move constructor

Parameters
xobject_ptr to move

◆ object_ptr() [4/6]

template<class T >
matador::object_ptr< T >::object_ptr ( T *  o)
inline

Create an object_ptr from an object

Parameters
oThe object.

◆ object_ptr() [5/6]

template<class T >
matador::object_ptr< T >::object_ptr ( std::nullptr_t  )
inline

Initializes the object_ptr with nullptr

◆ object_ptr() [6/6]

template<class T >
matador::object_ptr< T >::object_ptr ( object_proxy *  proxy)
inlineexplicit

Create an object_ptr from an object_proxy

Parameters
proxyThe object_proxy.

Member Function Documentation

◆ create_identifier()

template<class T >
identifier matador::object_ptr< T >::create_identifier ( ) const
inlineoverridevirtual

Creates a new identifier, represented by the identifier of the underlying type.

Returns
A new identifier.

Implements matador::identifiable_holder.

◆ get() [1/2]

template<class T >
T * matador::object_ptr< T >::get ( )
inline

Return the pointer to the serializable of type T.

Return the pointer to the serializable of type T. If there isn't a valid serializable 0 (null) is returned.

Returns
The pointer to the serializable of type T.

◆ get() [2/2]

template<class T >
const T * matador::object_ptr< T >::get ( ) const
inline

Return the pointer to the serializable of type T.

Return the pointer to the serializable of type T. If there isn't a valid serializable 0 (null) is returned.

Returns
The pointer to the serializable of type T.

◆ modify()

template<class T >
T * matador::object_ptr< T >::modify ( )

The modify method allows to modify the underlying object. It ensures that this object is marked as modified in the object_store and all registered observers are notified

Returns
Pointer to the underlying object

◆ operator*() [1/2]

template<class T >
T & matador::object_ptr< T >::operator* ( )
inline

Return the reference to the serializable of type T.

Return the reference to the serializable of type T. If there isn't a valid serializable 0 (null) is returned.

Returns
The reference to the serializable of type T.

◆ operator*() [2/2]

template<class T >
const T & matador::object_ptr< T >::operator* ( ) const
inline

Return the reference to the serializable of type T.

Return the reference to the serializable of type T. If there isn't a valid serializable 0 (null) is returned.

Returns
The reference to the serializable of type T.

◆ operator->()

template<class T >
const T * matador::object_ptr< T >::operator-> ( ) const
inline

Return the pointer to the serializable of type T.

Return the pointer to the serializable of type T. If there isn't a valid serializable 0 (null) is returned.

Returns
The pointer to the serializable of type T.

◆ operator=() [1/4]

template<class T >
object_ptr & matador::object_ptr< T >::operator= ( const self x)
inline

Copy assignes an object_ptr from the given has_one object.

Parameters
xThe has_one object to created the object_ptr from
Returns
A reference to the created object_ptr

◆ operator=() [2/4]

template<class T >
object_ptr & matador::object_ptr< T >::operator= ( self &&  x)
inlinenoexcept

Move assignment constructor

Parameters
xobject_ptr to be moved

◆ operator=() [3/4]

template<class T >
object_ptr & matador::object_ptr< T >::operator= ( std::nullptr_t  )
inline

Assigns nullptr to the object_ptr

Returns
Cleared reference to object_ptr

◆ operator=() [4/4]

template<class T >
object_ptr & matador::object_ptr< T >::operator= ( T *  x)
inline

Assign operator.

Parameters
xThe x serializable to assign from.

◆ type()

template<class T >
const char * matador::object_ptr< T >::type ( ) const
inlineoverridevirtual

Return the type string of the object

Returns
The type string of the object.

Implements matador::object_holder.


The documentation for this class was generated from the following files:
  • matador/object/abstract_container.hpp
  • matador/object/object_ptr.hpp