ccgsl 2.7.2
C++wrappersforGnuScientificLibrary
gsl::ran::discrete_t Class Reference

Class for walker algorithm. More...

#include <randist.hpp>

Collaboration diagram for gsl::ran::discrete_t:
Collaboration graph

Public Member Functions

 discrete_t ()
 The default constructor is only really useful for assigning to. More...
 
template<typename ARRAY >
 discrete_t (ARRAY const &P)
 The standard constructor creates a new discrete_t. More...
 
 discrete_t (gsl_ran_discrete_t *v)
 Could construct from a gsl_ran_discrete_t. More...
 
 discrete_t (discrete_t const &v)
 The copy constructor. More...
 
discrete_toperator= (discrete_t const &v)
 The assignment operator. More...
 
 ~discrete_t ()
 The destructor only deletes the pointers if count reaches zero. More...
 
bool operator== (discrete_t const &v) const
 Two discrete_t are identically equal if their elements are identical. More...
 
bool operator!= (discrete_t const &v) const
 Two discrete_t are different equal if their elements are not identical. More...
 
bool operator< (discrete_t const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator> (discrete_t const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator<= (discrete_t const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator>= (discrete_t const &v) const
 A container needs to define an ordering for sorting. More...
 
bool empty () const
 Find if the discrete_t is empty. More...
 
void swap (discrete_t &v)
 Swap two discrete_t. More...
 
gsl_ran_discrete_t * get () const
 Get the gsl_ran_discrete_t. More...
 
bool unique () const
 Find if this is the only object sharing the gsl_ran_discrete_t. More...
 
size_t use_count () const
 Find how many discrete_t objects share this pointer. More...
 
 operator bool () const
 Allow conversion to bool. More...
 

Private Attributes

gsl_ran_discrete_t * ccgsl_pointer
 The shared pointer. More...
 
size_t * count
 The shared reference count. More...
 

Detailed Description

Class for walker algorithm.

Definition at line 39 of file randist.hpp.

Constructor & Destructor Documentation

◆ discrete_t() [1/4]

gsl::ran::discrete_t::discrete_t ( )
inline

The default constructor is only really useful for assigning to.

Definition at line 44 of file randist.hpp.

References ccgsl_pointer, and count.

◆ discrete_t() [2/4]

template<typename ARRAY >
gsl::ran::discrete_t::discrete_t ( ARRAY const &  P)
inlineexplicit

The standard constructor creates a new discrete_t.

Parameters
PAn array of real values

Definition at line 76 of file randist.hpp.

References ccgsl_pointer, count, and gsl::sf::ellint::P().

◆ discrete_t() [3/4]

gsl::ran::discrete_t::discrete_t ( gsl_ran_discrete_t *  v)
inlineexplicit

Could construct from a gsl_ran_discrete_t.

This is not usually a good idea. In this case you should not use gsl_ran_discrete_free() to deallocate the memory.

Parameters
vThe workspace

Definition at line 91 of file randist.hpp.

References ccgsl_pointer, and count.

◆ discrete_t() [4/4]

gsl::ran::discrete_t::discrete_t ( discrete_t const &  v)
inline

The copy constructor.

This creates a new reference to the discrete_t.

Parameters
vThe discrete_t to copy.

Definition at line 102 of file randist.hpp.

References ccgsl_pointer, and count.

◆ ~discrete_t()

gsl::ran::discrete_t::~discrete_t ( )
inline

The destructor only deletes the pointers if count reaches zero.

Definition at line 121 of file randist.hpp.

References ccgsl_pointer, and count.

Member Function Documentation

◆ empty()

bool gsl::ran::discrete_t::empty ( ) const
inline

Find if the discrete_t is empty.

Returns
true if has size zero; otherwise false

Definition at line 191 of file randist.hpp.

References ccgsl_pointer.

◆ get()

gsl_ran_discrete_t * gsl::ran::discrete_t::get ( ) const
inline

Get the gsl_ran_discrete_t.

Returns
the gsl_ran_discrete_t

Definition at line 216 of file randist.hpp.

References ccgsl_pointer.

Referenced by gsl::ran::discrete(), and gsl::ran::discrete_pdf().

◆ operator bool()

gsl::ran::discrete_t::operator bool ( ) const
inlineexplicit

Allow conversion to bool.

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

Definition at line 236 of file randist.hpp.

References ccgsl_pointer.

◆ operator!=()

bool gsl::ran::discrete_t::operator!= ( discrete_t const &  v) const
inline

Two discrete_t are different equal if their elements are not identical.

Parameters
vThe discrete_t to be compared with this
Returns
false or true according as this and v have identical elements or not

Definition at line 144 of file randist.hpp.

References operator==().

◆ operator<()

bool gsl::ran::discrete_t::operator< ( discrete_t const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for eaxmple, for checking, that a discrete_t is nonnegative.

Parameters
vThe discrete_t to be compared with this
Returns
false or true according as this is less than v lexicographically

Definition at line 156 of file randist.hpp.

References ccgsl_pointer.

◆ operator<=()

bool gsl::ran::discrete_t::operator<= ( discrete_t const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for example, for checking, that a discrete_t is nonnegative.

Parameters
vThe discrete_t to be compared with this
Returns
false or true according as this is less than or equal to v lexicographically

Definition at line 176 of file randist.hpp.

References ccgsl_pointer.

◆ operator=()

discrete_t & gsl::ran::discrete_t::operator= ( discrete_t const &  v)
inline

The assignment operator.

This copies elementwise.

Parameters
vThe discrete_t to copy

Definition at line 109 of file randist.hpp.

References ccgsl_pointer, and count.

◆ operator==()

bool gsl::ran::discrete_t::operator== ( discrete_t const &  v) const
inline

Two discrete_t are identically equal if their elements are identical.

Parameters
vThe discrete_t to be compared with this
Returns
true or false according as this and v have identical elements or not

Definition at line 136 of file randist.hpp.

References ccgsl_pointer.

Referenced by operator!=().

◆ operator>()

bool gsl::ran::discrete_t::operator> ( discrete_t const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for example, for checking, that a discrete_t is nonnegative.

Parameters
vThe discrete_t to be compared with this
Returns
false or true according as this is greater than v lexicographically

Definition at line 166 of file randist.hpp.

References ccgsl_pointer.

◆ operator>=()

bool gsl::ran::discrete_t::operator>= ( discrete_t const &  v) const
inline

A container needs to define an ordering for sorting.

This uses standard lexicographical ordering and so is not useful, for eaxmple, for checking, that a discrete_t is nonnegative.

Parameters
vThe discrete_t to be compared with this
Returns
false or true according as this is no less than v lexicographically

Definition at line 186 of file randist.hpp.

References ccgsl_pointer.

◆ swap()

void gsl::ran::discrete_t::swap ( discrete_t v)
inline

Swap two discrete_t.

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

Parameters
vThe discrete_t to swap with this.

Definition at line 198 of file randist.hpp.

References ccgsl_pointer, and count.

◆ unique()

bool gsl::ran::discrete_t::unique ( ) const
inline

Find if this is the only object sharing the gsl_ran_discrete_t.

Returns
true or falses according as this is the only discrete_t object sharing the gsl_ran_discrete_t

Definition at line 222 of file randist.hpp.

References count.

◆ use_count()

size_t gsl::ran::discrete_t::use_count ( ) const
inline

Find how many discrete_t objects share this pointer.

Returns
the number of discrete_t objects that share this pointer

Definition at line 227 of file randist.hpp.

References count.

Member Data Documentation

◆ ccgsl_pointer

gsl_ran_discrete_t* gsl::ran::discrete_t::ccgsl_pointer
private

◆ count

size_t* gsl::ran::discrete_t::count
private

The shared reference count.

Definition at line 209 of file randist.hpp.

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


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