Interior-point-optimisation  1.0-1
Interior-pointoptimisationlibrary
ipo::detail::SharedFunctionPtr Class Reference

Shared pointer to ipo::Function object. More...

#include <SharedFunctionPtr.hpp>

Collaboration diagram for ipo::detail::SharedFunctionPtr:
Collaboration graph

Public Member Functions

 SharedFunctionPtr ()
 The default constructor is only really useful for assigning to. More...
 
 SharedFunctionPtr (ipo_function::Function *function)
 Construct from a pointer to a function. More...
 
 SharedFunctionPtr (ipo_function::Function &function)
 Construct from a Function object. More...
 
 SharedFunctionPtr (SharedFunctionPtr const &v)
 The copy constructor. More...
 
SharedFunctionPtroperator= (SharedFunctionPtr const &v)
 The assignment operator. More...
 
 ~SharedFunctionPtr ()
 The destructor only deletes the pointers if count reaches zero. More...
 
 SharedFunctionPtr (SharedFunctionPtr &&v)
 Move constructor. More...
 
SharedFunctionPtroperator= (SharedFunctionPtr &&v)
 Move operator. More...
 
bool operator== (SharedFunctionPtr const &v) const
 Two SharedFunctionPtr are identically equal if they point to the same object. More...
 
bool operator!= (SharedFunctionPtr const &v) const
 Two SharedFunctionPtr are different equal if they point to different objectd. More...
 
void swap (SharedFunctionPtr &v)
 Swap two SharedFunctionPtr objects. More...
 
ipo_function::Functionoperator* () const
 Get a reference to the function. More...
 
ipo_function::Functionoperator-> () const
 Get a pointer to the function. More...
 
ipo_function::Functionget () const
 Get the gsl_SharedFunctionPtr. More...
 
bool unique () const
 Find if this is the only object sharing the gsl_SharedFunctionPtr. More...
 
size_t use_count () const
 Find how many SharedFunctionPtr objects share this pointer. More...
 
 operator bool () const
 Allow conversion to bool. More...
 

Private Attributes

ipo_function::Functionpointer
 The shared pointer. More...
 
size_t * count
 The shared reference count. More...
 
bool owner
 Ownership flag. More...
 

Detailed Description

Shared pointer to ipo::Function object.

Definition at line 31 of file SharedFunctionPtr.hpp.

Constructor & Destructor Documentation

ipo::detail::SharedFunctionPtr::SharedFunctionPtr ( )
inline

The default constructor is only really useful for assigning to.

Definition at line 36 of file SharedFunctionPtr.hpp.

References count, owner, and pointer.

Referenced by operator=().

ipo::detail::SharedFunctionPtr::SharedFunctionPtr ( ipo_function::Function function)
inlineexplicit

Construct from a pointer to a function.

This constructor should be used to with a pointer to a Function object that is not later explicitly deleted.

Parameters
functionA pointer to a Function object

Definition at line 47 of file SharedFunctionPtr.hpp.

References count, owner, and pointer.

ipo::detail::SharedFunctionPtr::SharedFunctionPtr ( ipo_function::Function function)
inlineexplicit

Construct from a Function object.

In this case the Function object must not go out of scope before this does.

Parameters
functionA Function object

Definition at line 63 of file SharedFunctionPtr.hpp.

References count, owner, and pointer.

ipo::detail::SharedFunctionPtr::SharedFunctionPtr ( SharedFunctionPtr const &  v)
inline

The copy constructor.

This creates a new reference to the SharedFunctionPtr.

Parameters
vThe SharedFunctionPtr to copy.

Definition at line 75 of file SharedFunctionPtr.hpp.

References count, owner, and pointer.

ipo::detail::SharedFunctionPtr::~SharedFunctionPtr ( )
inline

The destructor only deletes the pointers if count reaches zero.

Definition at line 95 of file SharedFunctionPtr.hpp.

References count, owner, and pointer.

ipo::detail::SharedFunctionPtr::SharedFunctionPtr ( SharedFunctionPtr &&  v)
inline

Move constructor.

Parameters
vThe SharedFunctionPtr to move.

Definition at line 107 of file SharedFunctionPtr.hpp.

References count, and ipo::swap().

Member Function Documentation

ipo_function::Function* ipo::detail::SharedFunctionPtr::get ( ) const
inline

Get the gsl_SharedFunctionPtr.

Returns
the gsl_SharedFunctionPtr

Definition at line 176 of file SharedFunctionPtr.hpp.

References pointer.

ipo::detail::SharedFunctionPtr::operator bool ( ) const
inlineexplicit

Allow conversion to bool.

Returns
true or false according as this contains a pointer to a gsl_SharedFunctionPtr

Definition at line 193 of file SharedFunctionPtr.hpp.

bool ipo::detail::SharedFunctionPtr::operator!= ( SharedFunctionPtr const &  v) const
inline

Two SharedFunctionPtr are different equal if they point to different objectd.

Parameters
vThe SharedFunctionPtr to be compared with this
Returns
false or true according as this and v do not point to the same object

Definition at line 136 of file SharedFunctionPtr.hpp.

References operator==().

ipo_function::Function& ipo::detail::SharedFunctionPtr::operator* ( ) const
inline

Get a reference to the function.

Returns
a reference to the function

Definition at line 151 of file SharedFunctionPtr.hpp.

References pointer.

ipo_function::Function* ipo::detail::SharedFunctionPtr::operator-> ( ) const
inline

Get a pointer to the function.

Returns
a pointer to the function

Definition at line 156 of file SharedFunctionPtr.hpp.

References pointer.

SharedFunctionPtr& ipo::detail::SharedFunctionPtr::operator= ( SharedFunctionPtr const &  v)
inline

The assignment operator.

This copies elementwise.

Parameters
vThe SharedFunctionPtr to copy

Definition at line 82 of file SharedFunctionPtr.hpp.

References count, owner, and pointer.

SharedFunctionPtr& ipo::detail::SharedFunctionPtr::operator= ( SharedFunctionPtr &&  v)
inline

Move operator.

Parameters
vThe SharedFunctionPtr to move.
Returns
A reference to this.

Definition at line 118 of file SharedFunctionPtr.hpp.

References SharedFunctionPtr().

bool ipo::detail::SharedFunctionPtr::operator== ( SharedFunctionPtr const &  v) const
inline

Two SharedFunctionPtr are identically equal if they point to the same object.

Parameters
vThe SharedFunctionPtr to be compared with this
Returns
true or false according as this and v point to the same object

Definition at line 128 of file SharedFunctionPtr.hpp.

References pointer.

Referenced by operator!=().

void ipo::detail::SharedFunctionPtr::swap ( SharedFunctionPtr v)
inline

Swap two SharedFunctionPtr objects.

This works even if the SharedFunctionPtr objects have different sizes because it swaps pointers.

Parameters
vThe SharedFunctionPtr to swap with this.

Definition at line 143 of file SharedFunctionPtr.hpp.

References count, pointer, and ipo::swap().

bool ipo::detail::SharedFunctionPtr::unique ( ) const
inline

Find if this is the only object sharing the gsl_SharedFunctionPtr.

Returns
true or falses according as this is the only SharedFunctionPtr object sharing the gsl_SharedFunctionPtr

Definition at line 182 of file SharedFunctionPtr.hpp.

size_t ipo::detail::SharedFunctionPtr::use_count ( ) const
inline

Find how many SharedFunctionPtr objects share this pointer.

Returns
the number of SharedFunctionPtr objects that share this pointer

Definition at line 187 of file SharedFunctionPtr.hpp.

References count.

Member Data Documentation

size_t* ipo::detail::SharedFunctionPtr::count
private

The shared reference count.

Definition at line 165 of file SharedFunctionPtr.hpp.

Referenced by operator=(), SharedFunctionPtr(), swap(), use_count(), and ~SharedFunctionPtr().

bool ipo::detail::SharedFunctionPtr::owner
private

Ownership flag.

Definition at line 169 of file SharedFunctionPtr.hpp.

Referenced by operator=(), SharedFunctionPtr(), and ~SharedFunctionPtr().

ipo_function::Function* ipo::detail::SharedFunctionPtr::pointer
private

The shared pointer.

Definition at line 161 of file SharedFunctionPtr.hpp.

Referenced by get(), operator*(), operator->(), operator=(), operator==(), SharedFunctionPtr(), swap(), and ~SharedFunctionPtr().


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