ccgsl 2.7.2
C++wrappersforGnuScientificLibrary
gsl::block_ushort Class Reference

This class handles vector_ushorts as shared handles. More...

#include <block_ushort.hpp>

Collaboration diagram for gsl::block_ushort:
Collaboration graph

Classes

class  const_iterator_t
 A class template for the const iterators. More...
 
class  iterator_base
 The container must have iterator types. More...
 
class  iterator_t
 A class template for the two non-const iterators. More...
 

Public Types

typedef unsigned short value_type
 A container must have a value_type. More...
 
typedef value_typereference
 A container must have a reference type. More...
 
typedef value_type const & const_reference
 A container must have a constant reference type. More...
 
typedef value_typepointer
 A container must have a pointer type. More...
 
typedef value_type const * const_pointer
 A container must have a constant pointer type. More...
 
typedef const_iterator_t< false > const_iterator
 The const_iterator type. More...
 
typedef iterator_t< false > iterator
 The iterator type. More...
 
typedef const_iterator_t< true > const_reverse_iterator
 The const_reverse_iterator type. More...
 
typedef iterator_t< true > reverse_iterator
 The reverse_iterator type. More...
 
typedef const_iterator::difference_type difference_type
 A container must have a difference_type. More...
 
typedef size_t size_type
 A container must have a size_type. More...
 

Public Member Functions

 block_ushort ()
 The default constructor is only really useful for assigning to. More...
 
 block_ushort (size_t const n)
 The default constructor creates a new block_ushort with n elements. More...
 
 block_ushort (gsl_block_ushort *v)
 Could construct from a gsl_block_ushort. More...
 
 block_ushort (std::initializer_list< unsigned short > initializer_list)
 Could construct from a std::initializer_list in C++11. More...
 
 block_ushort (block_ushort const &v)
 The copy constructor. More...
 
block_ushortoperator= (block_ushort const &v)
 The assignment operator. More...
 
block_ushort clone () const
 The clone function. More...
 
 ~block_ushort ()
 The destructor only deletes the pointers if count reaches zero. More...
 
void reset ()
 Stop sharing ownership of the shared pointer. More...
 
 block_ushort (block_ushort &&v)
 Move constructor. More...
 
block_ushortoperator= (block_ushort &&v)
 Move operator. More...
 
bool operator== (block_ushort const &v) const
 Two block_ushort objects are identically equal if their elements are identical. More...
 
bool operator!= (block_ushort const &v) const
 Two block_ushort objects are different equal if their elements are not identical. More...
 
bool operator< (block_ushort const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator> (block_ushort const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator<= (block_ushort const &v) const
 A container needs to define an ordering for sorting. More...
 
bool operator>= (block_ushort const &v) const
 A container needs to define an ordering for sorting. More...
 
iterator begin ()
 Get iterator pointing to first block_ushort element. More...
 
const_iterator begin () const
 Get iterator pointing to first block_ushort element. More...
 
iterator end ()
 Get iterator pointing beyond last block_ushort element. More...
 
const_iterator end () const
 Get iterator pointing beyond last block_ushort element. More...
 
size_type size () const
 The size (number of elements) of the block_ushort. More...
 
unsigned short * data ()
 Give access to the data block_ushort. More...
 
unsigned short const * data () const
 Give access to the data block_ushort. More...
 
size_type max_size () const
 The max size (number of elements) of the block_ushort. More...
 
bool empty () const
 Find if the block_ushort is empty. More...
 
void swap (block_ushort &v)
 Swap two block_ushort objects. More...
 
reverse_iterator rbegin ()
 Get iterator pointing to first block_ushort element. More...
 
const_reverse_iterator rbegin () const
 Get iterator pointing to first block_ushort element. More...
 
reverse_iterator rend ()
 Get iterator pointing beyond last block_ushort element. More...
 
const_reverse_iterator rend () const
 Get iterator pointing beyond last block_ushort element. More...
 
unsigned short & operator[] (size_t const n)
 Get element at position n by reference ([] operator). More...
 
unsigned short const & operator[] (size_t const n) const
 Get element at position n by reference ([] operator). More...
 
gsl_block_ushort * get () const
 Get the gsl_block_ushort. More...
 
bool unique () const
 Find if this is the only object sharing the gsl_block_ushort. More...
 
size_t use_count () const
 Find how many block_ushort objects share this pointer. More...
 
 operator bool () const
 Allow conversion to bool. More...
 

Private Attributes

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

Detailed Description

This class handles vector_ushorts as shared handles.

It models a random access container so that STL functions work with block_ushort.

Definition at line 41 of file block_ushort.hpp.

Member Typedef Documentation

◆ const_iterator

The const_iterator type.

Definition at line 982 of file block_ushort.hpp.

◆ const_pointer

A container must have a constant pointer type.

Definition at line 314 of file block_ushort.hpp.

◆ const_reference

A container must have a constant reference type.

Definition at line 304 of file block_ushort.hpp.

◆ const_reverse_iterator

The const_reverse_iterator type.

Definition at line 990 of file block_ushort.hpp.

◆ difference_type

A container must have a difference_type.

Definition at line 999 of file block_ushort.hpp.

◆ iterator

The iterator type.

Definition at line 986 of file block_ushort.hpp.

◆ pointer

A container must have a pointer type.

Definition at line 309 of file block_ushort.hpp.

◆ reference

A container must have a reference type.

Definition at line 299 of file block_ushort.hpp.

◆ reverse_iterator

The reverse_iterator type.

Definition at line 994 of file block_ushort.hpp.

◆ size_type

A container must have a size_type.

Definition at line 1004 of file block_ushort.hpp.

◆ value_type

typedef unsigned short gsl::block_ushort::value_type

A container must have a value_type.

Definition at line 294 of file block_ushort.hpp.

Constructor & Destructor Documentation

◆ block_ushort() [1/6]

gsl::block_ushort::block_ushort ( )
inline

The default constructor is only really useful for assigning to.

Definition at line 46 of file block_ushort.hpp.

References ccgsl_pointer, and count.

Referenced by operator=(), and reset().

◆ block_ushort() [2/6]

gsl::block_ushort::block_ushort ( size_t const  n)
inlineexplicit

The default constructor creates a new block_ushort with n elements.

Parameters
nThe number of elements in the block_ushort

Definition at line 56 of file block_ushort.hpp.

References ccgsl_pointer, count, and gsl::rstat::n().

◆ block_ushort() [3/6]

gsl::block_ushort::block_ushort ( gsl_block_ushort *  v)
inlineexplicit

Could construct from a gsl_block_ushort.

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

Parameters
vThe block_ushort

Definition at line 78 of file block_ushort.hpp.

References ccgsl_pointer, and count.

◆ block_ushort() [4/6]

gsl::block_ushort::block_ushort ( std::initializer_list< unsigned short >  initializer_list)
inline

Could construct from a std::initializer_list in C++11.

Parameters
initializer_listThe initializer_list.

Definition at line 89 of file block_ushort.hpp.

References begin(), ccgsl_pointer, count, and gsl::rstat::n().

◆ block_ushort() [5/6]

gsl::block_ushort::block_ushort ( block_ushort const &  v)
inline

The copy constructor.

This shares the block_ushort. Use clone() if you want a full copy.

Parameters
vThe block_ushort to copy.

Definition at line 110 of file block_ushort.hpp.

References count.

◆ ~block_ushort()

gsl::block_ushort::~block_ushort ( )
inline

The destructor only deletes the pointers if count reaches zero.

Definition at line 149 of file block_ushort.hpp.

References ccgsl_pointer, and count.

◆ block_ushort() [6/6]

gsl::block_ushort::block_ushort ( block_ushort &&  v)
inline

Move constructor.

Parameters
vThe block_ushort to move.

Definition at line 167 of file block_ushort.hpp.

References count.

Member Function Documentation

◆ begin() [1/2]

iterator gsl::block_ushort::begin ( )
inline

Get iterator pointing to first block_ushort element.

Returns
iterator pointing to first block_ushort element

Definition at line 1010 of file block_ushort.hpp.

Referenced by block_ushort().

◆ begin() [2/2]

const_iterator gsl::block_ushort::begin ( ) const
inline

Get iterator pointing to first block_ushort element.

Returns
iterator pointing to first block_ushort element

Definition at line 1017 of file block_ushort.hpp.

◆ clone()

block_ushort gsl::block_ushort::clone ( ) const
inline

The clone function.

Use this if you want a copy of the block_ushort that does not share the underlying data.

Returns
a new copy of this.

Definition at line 138 of file block_ushort.hpp.

References ccgsl_pointer.

◆ data() [1/2]

unsigned short * gsl::block_ushort::data ( )
inline

Give access to the data block_ushort.

The data() and size() functions mimic the functions of std::array<T> and std::vector<T>.

Returns
The data block_ushort.

Definition at line 1048 of file block_ushort.hpp.

References ccgsl_pointer.

◆ data() [2/2]

unsigned short const * gsl::block_ushort::data ( ) const
inline

Give access to the data block_ushort.

The data() and size() functions mimic the functions of std::array<T> and std::vector<T>.

Returns
The data block_ushort.

Definition at line 1056 of file block_ushort.hpp.

References ccgsl_pointer.

◆ empty()

bool gsl::block_ushort::empty ( ) const
inline

Find if the block_ushort is empty.

Returns
true if has size zero; otherwise false

Definition at line 1071 of file block_ushort.hpp.

References ccgsl_pointer.

◆ end() [1/2]

iterator gsl::block_ushort::end ( )
inline

Get iterator pointing beyond last block_ushort element.

Returns
iterator pointing beyond last block_ushort element

Definition at line 1025 of file block_ushort.hpp.

References ccgsl_pointer, and size().

◆ end() [2/2]

const_iterator gsl::block_ushort::end ( ) const
inline

Get iterator pointing beyond last block_ushort element.

Returns
iterator pointing beyond last block_ushort element

Definition at line 1033 of file block_ushort.hpp.

References ccgsl_pointer, and size().

◆ get()

gsl_block_ushort * gsl::block_ushort::get ( ) const
inline

Get the gsl_block_ushort.

Returns
the gsl_block_ushort

Definition at line 1177 of file block_ushort.hpp.

References ccgsl_pointer.

◆ max_size()

size_type gsl::block_ushort::max_size ( ) const
inline

The max size (number of elements) of the block_ushort.

Identical to size but required for a container.

Returns
The size of the block_ushort

Definition at line 1065 of file block_ushort.hpp.

References ccgsl_pointer.

◆ operator bool()

gsl::block_ushort::operator bool ( ) const
inlineexplicit

Allow conversion to bool.

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

Definition at line 1197 of file block_ushort.hpp.

References ccgsl_pointer.

◆ operator!=()

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

Two block_ushort objects are different equal if their elements are not identical.

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

Definition at line 208 of file block_ushort.hpp.

References operator==().

◆ operator<()

bool gsl::block_ushort::operator< ( block_ushort 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 block_ushort is nonnegative.

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

Definition at line 220 of file block_ushort.hpp.

References ccgsl_pointer, gsl::movstat::min(), and size().

Referenced by operator<=().

◆ operator<=()

bool gsl::block_ushort::operator<= ( block_ushort 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 block_ushort is nonnegative.

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

Definition at line 274 of file block_ushort.hpp.

References operator<(), and operator==().

◆ operator=() [1/2]

block_ushort & gsl::block_ushort::operator= ( block_ushort &&  v)
inline

Move operator.

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

Definition at line 176 of file block_ushort.hpp.

References block_ushort().

◆ operator=() [2/2]

block_ushort & gsl::block_ushort::operator= ( block_ushort const &  v)
inline

The assignment operator.

This makes a shared copy.

Parameters
vThe block_ushort to copy

Definition at line 118 of file block_ushort.hpp.

References ccgsl_pointer, and count.

◆ operator==()

bool gsl::block_ushort::operator== ( block_ushort const &  v) const
inline

Two block_ushort objects are identically equal if their elements are identical.

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

Definition at line 189 of file block_ushort.hpp.

References ccgsl_pointer.

Referenced by operator!=(), operator<=(), and operator>=().

◆ operator>()

bool gsl::block_ushort::operator> ( block_ushort 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 block_ushort is nonnegative.

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

Definition at line 247 of file block_ushort.hpp.

References ccgsl_pointer, gsl::movstat::min(), and size().

Referenced by operator>=().

◆ operator>=()

bool gsl::block_ushort::operator>= ( block_ushort 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 block_ushort is nonnegative.

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

Definition at line 286 of file block_ushort.hpp.

References operator==(), and operator>().

◆ operator[]() [1/2]

unsigned short & gsl::block_ushort::operator[] ( size_t const  n)
inline

Get element at position n by reference ([] operator).

Parameters
nThe position of the element
Returns
a reference to a unsigned short

Definition at line 1121 of file block_ushort.hpp.

References ccgsl_pointer, gsl::exception::GSL_EFAULT, gsl::exception::GSL_EINVAL, gsl::rstat::n(), and size().

◆ operator[]() [2/2]

unsigned short const & gsl::block_ushort::operator[] ( size_t const  n) const
inline

Get element at position n by reference ([] operator).

Parameters
nThe position of the element
Returns
a reference to a unsigned short

Definition at line 1144 of file block_ushort.hpp.

References ccgsl_pointer, gsl::exception::GSL_EFAULT, gsl::exception::GSL_EINVAL, gsl::rstat::n(), and size().

◆ rbegin() [1/2]

reverse_iterator gsl::block_ushort::rbegin ( )
inline

Get iterator pointing to first block_ushort element.

Returns
iterator pointing to first block_ushort element

Definition at line 1088 of file block_ushort.hpp.

References ccgsl_pointer, and size().

◆ rbegin() [2/2]

const_reverse_iterator gsl::block_ushort::rbegin ( ) const
inline

Get iterator pointing to first block_ushort element.

Returns
iterator pointing to first block_ushort element

Definition at line 1096 of file block_ushort.hpp.

References ccgsl_pointer, and size().

◆ rend() [1/2]

reverse_iterator gsl::block_ushort::rend ( )
inline

Get iterator pointing beyond last block_ushort element.

Returns
iterator pointing beyond last block_ushort element

Definition at line 1105 of file block_ushort.hpp.

◆ rend() [2/2]

const_reverse_iterator gsl::block_ushort::rend ( ) const
inline

Get iterator pointing beyond last block_ushort element.

Returns
iterator pointing beyond last block_ushort element

Definition at line 1112 of file block_ushort.hpp.

◆ reset()

void gsl::block_ushort::reset ( )
inline

Stop sharing ownership of the shared pointer.

Definition at line 161 of file block_ushort.hpp.

References block_ushort().

◆ size()

size_type gsl::block_ushort::size ( ) const
inline

The size (number of elements) of the block_ushort.

Returns
The size of the block_ushort

Definition at line 1042 of file block_ushort.hpp.

References ccgsl_pointer.

Referenced by end(), operator<(), operator>(), operator[](), and rbegin().

◆ swap()

void gsl::block_ushort::swap ( block_ushort v)
inline

Swap two block_ushort objects.

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

Parameters
vThe block_ushort to swap with this.

Definition at line 1078 of file block_ushort.hpp.

References ccgsl_pointer, and count.

◆ unique()

bool gsl::block_ushort::unique ( ) const
inline

Find if this is the only object sharing the gsl_block_ushort.

Returns
true or falses according as this is the only block_ushort object sharing the gsl_block_ushort

Definition at line 1183 of file block_ushort.hpp.

References count.

◆ use_count()

size_t gsl::block_ushort::use_count ( ) const
inline

Find how many block_ushort objects share this pointer.

Returns
the number of block_ushort objects that share this pointer

Definition at line 1188 of file block_ushort.hpp.

References count.

Member Data Documentation

◆ ccgsl_pointer

◆ count

size_t* gsl::block_ushort::count
private

The shared reference count.

Definition at line 1170 of file block_ushort.hpp.

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


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