Interior-point-optimisation  1.0-1
Interior-pointoptimisationlibrary
ipo::Array Class Reference

This class represents an array of Variable objects. More...

#include <Array.hpp>

Inheritance diagram for ipo::Array:
Inheritance graph
Collaboration diagram for ipo::Array:
Collaboration graph

Classes

struct  Data
 Struct to contain Array dataArray. More...
 

Public Types

typedef std::vector< Variable >
::value_type 
value_type
 Value type. More...
 
typedef std::vector< Variable >
::allocator_type 
allocator_type
 Allocator type. More...
 
typedef std::vector< Variable >
::size_type 
size_type
 Size type. More...
 
typedef std::vector< Variable >
::difference_type 
difference_type
 Difference type. More...
 
typedef std::vector< Variable >
::reference 
reference
 Reference type. More...
 
typedef std::vector< Variable >
::const_reference 
const_reference
 Const reference type. More...
 
typedef std::vector< Variable >
::pointer 
pointer
 Pointer type. More...
 
typedef std::vector< Variable >
::const_pointer 
const_pointer
 Const pointer type. More...
 
typedef std::vector< Variable >
::iterator 
iterator
 Iterator type. More...
 
typedef std::vector< Variable >
::const_iterator 
const_iterator
 Const iterator type. More...
 
typedef std::vector< Variable >
::reverse_iterator 
reverse_iterator
 Reverse iterator type. More...
 
typedef std::vector< Variable >
::const_reverse_iterator 
const_reverse_iterator
 Const reverse iterator type. More...
 

Public Member Functions

 Array (detail::ModelBase &model, allocator_type const &alloc=allocator_type(), char const *const name=nullptr)
 Default constructor. More...
 
 Array (detail::ModelBase &model, std::string const &name)
 Constructor. More...
 
 Array (detail::ModelBase &model, size_t const size, char const *const name=nullptr)
 Create a named array with the given name, initial values 0 and unbounded. More...
 
 Array (detail::ModelBase &model, size_t const size, std::string const &name)
 Create a named array with the given name, initial values 0 and unbounded. More...
 
 Array (detail::ModelBase &model, size_t const size, value_type const &val, allocator_type const &alloc, std::string const &name)
 Create a named array with the given name, initial values 0 and unbounded. More...
 
 Array (detail::ModelBase &model, size_t const size, value_type const &val, allocator_type const &alloc=allocator_type(), char const *const name=0)
 Create a named array with the given name, initial values 0 and unbounded. More...
 
 Array (detail::ModelBase &model, size_t const size, value_type const &val, std::string const &name)
 Create a named array with the given name, initial values 0 and unbounded. More...
 
 Array (detail::ModelBase &model, size_t const size, value_type const &val, char const *const name)
 Create a named array with the given name, initial values 0 and unbounded. More...
 
 Array (Array const &array)
 Copy constructor. More...
 
 Array (Array const &array, allocator_type const &alloc)
 Copy constructor. More...
 
 Array (Array &&array)
 Move constructor. More...
 
 Array (detail::ModelBase &model, std::initializer_list< Variable > init, std::vector< Variable >::allocator_type const &alloc=std::vector< Variable >::allocator_type(), char const *const name=0)
 Initialiser list constructor. More...
 
 Array (detail::ModelBase &model, std::initializer_list< Variable > init, std::vector< Variable >::allocator_type const &alloc, std::string const &name)
 Initialiser list constructor. More...
 
 Array (detail::ModelBase &model, std::initializer_list< Variable > init, char const *const name=0)
 Initialiser list constructor. More...
 
 Array (detail::ModelBase &model, std::initializer_list< Variable > init, std::string const &name)
 Initialiser list constructor. More...
 
Arrayoperator= (Array &&array)
 Move assignment operator. More...
 
Arrayoperator= (Array &array)
 Copy assignment operator. More...
 
std::string getName () const
 Get name of variable. More...
 
void setName (std::string const &name)
 Set name of variable. More...
 
void setName (char *const name)
 Set name of variable. More...
 
void assign (size_type count, value_type const &value)
 Assign values. More...
 
template<typename InputIterator >
void assign (InputIterator first, InputIterator last)
 Assign values. More...
 
void assign (std::initializer_list< Variable > init)
 Assign values. More...
 
allocator_type get_allocator () const
 Get allocator. More...
 
reference at (size_type pos)
 Get reference to Variable at position pos. More...
 
const_reference at (size_type pos) const
 Get reference to Variable at position pos. More...
 
reference operator[] (size_type pos)
 Get reference to Variable at position pos. More...
 
const_reference operator[] (size_type pos) const
 Get reference to Variable at position pos. More...
 
reference front ()
 Get reference to first Variable. More...
 
const_reference front () const
 Get reference to first Variable. More...
 
reference back ()
 Get reference to last Variable. More...
 
const_reference back () const
 Get reference to last Variable. More...
 
pointer data ()
 Get direct access to data. More...
 
const_pointer data () const
 Get direct access to data. More...
 
iterator begin ()
 Get iterator to beginning of range. More...
 
const_iterator begin () const
 Get iterator to beginning of range. More...
 
const_iterator cbegin () const
 Get iterator to beginning of range. More...
 
iterator end ()
 Get iterator to end of range. More...
 
const_iterator end () const
 Get iterator to end of range. More...
 
const_iterator cend () const
 Get iterator to end of range. More...
 
reverse_iterator rbegin ()
 Get reverse iterator to beginning of range. More...
 
const_reverse_iterator rbegin () const
 Get reverse iterator to beginning of range. More...
 
const_reverse_iterator crbegin () const
 Get reverse iterator to beginning of range. More...
 
reverse_iterator rend ()
 Get reverse iterator to end of range. More...
 
const_reverse_iterator rend () const
 Get reverse iterator to end of range. More...
 
const_reverse_iterator crend () const
 Get reverse iterator to end of range. More...
 
bool empty () const
 Check if array is empty. More...
 
size_type size () const
 Get size of array. More...
 
size_type max_size () const
 Get maximum size of array. More...
 
void reserve (size_type size)
 Reserve capacity. More...
 
size_type capacity () const
 Get capacity of array. More...
 
void shrink_to_fit ()
 Free unused memory. More...
 
void clear ()
 Clear array. More...
 
iterator insert (iterator pos, value_type const &value)
 Insert value before position given by iterator pos. More...
 
iterator insert (iterator pos, value_type &&value)
 Insert value before position given by iterator pos. More...
 
void insert (iterator pos, size_type count, const value_type &value)
 Insert count copies of value before position given by iterator pos. More...
 
template<typename InputIterator >
void insert (iterator pos, InputIterator first, InputIterator last)
 Insert count copies of value before position given by iterator pos. More...
 
void insert (iterator pos, std::initializer_list< Variable > ilist)
 Insert values before pos. More...
 
template<class... Args>
iterator emplace (const_iterator pos, Args &&...args)
 Insert new value construted in-place before pos. More...
 
iterator erase (iterator pos)
 Erase element specified by pos. More...
 
iterator erase (iterator first, iterator last)
 Erase elements in range [first, last). More...
 
void push_back (value_type const &value)
 Insert value at end of array. More...
 
void push_back (value_type &&value)
 Insert value at end of array. More...
 
template<typename... Args>
void emplace_back (Args &&...args)
 Insert value at end of array. More...
 
void pop_back ()
 Remove last element of array. More...
 
void resize (size_type count)
 Resize array. More...
 
void resize (size_type count, const value_type &value)
 Resize array. More...
 
void swap (Array &array)
 Swap contents of container with those of another. More...
 
bool contains (Variable const &variable) const
 Check whether or not array contains variable. More...
 
void setValue (gsl::vector const &vector)
 Set the value of this from a gsl::vector. More...
 
gsl::vector getValue () const
 Create a gsl::vector containing the values of this in order. More...
 
virtual void summary (std::ostream &ostream=std::cout, std::string const &prefix="") const override
 Create a summary of this Array object. More...
 
- Public Member Functions inherited from ipo::detail::Var
 Var (ModelBase &model)
 Constructor needs a model so that variable can only be attached to one model. More...
 
virtual ~Var ()=0
 Virtual destructor to make class abstract. More...
 
 Var (Var &var)
 Copy constructor. More...
 
Varoperator= (Var &var)
 Copy assignment operator. More...
 
 Var (Var &&var)
 Move constructor. More...
 
Varoperator= (Var &&var)
 Move assignment operator. More...
 
ModelBase const *const getModel () const
 Get pointer to model. More...
 

Private Attributes

std::shared_ptr< DatadataArray
 The Variable dataArray as a shared pointer. More...
 

Friends

bool ipo::operator== (Array const &, Array const &)
 
bool ipo::operator!= (Array const &, Array const &)
 
bool ipo::operator< (Array const &, Array const &)
 
bool ipo::operator<= (Array const &, Array const &)
 
bool ipo::operator> (Array const &, Array const &)
 
bool ipo::operator>= (Array const &, Array const &)
 

Additional Inherited Members

- Protected Attributes inherited from ipo::detail::Var
ModelBasemodel
 A Model to attach this to. More...
 

Detailed Description

This class represents an array of Variable objects.

An object of Array class has optionally a name. A Variable contains a shared pointer to its dataArray so that it is safe and inexpensive to copy Array objects, put them in arrays, pass them as function values, and the like.

This class acts as a random access container and can be used as if it were std::vector<Variable>. Thus, for example, for an object array, for( auto variable : array ){ ... } works as expected.

Definition at line 45 of file Array.hpp.

Member Typedef Documentation

Allocator type.

Definition at line 54 of file Array.hpp.

Const iterator type.

Definition at line 86 of file Array.hpp.

Const pointer type.

Definition at line 78 of file Array.hpp.

Const reference type.

Definition at line 70 of file Array.hpp.

Const reverse iterator type.

Definition at line 94 of file Array.hpp.

Difference type.

Definition at line 62 of file Array.hpp.

typedef std::vector<Variable>::iterator ipo::Array::iterator

Iterator type.

Definition at line 82 of file Array.hpp.

typedef std::vector<Variable>::pointer ipo::Array::pointer

Pointer type.

Definition at line 74 of file Array.hpp.

typedef std::vector<Variable>::reference ipo::Array::reference

Reference type.

Definition at line 66 of file Array.hpp.

Reverse iterator type.

Definition at line 90 of file Array.hpp.

typedef std::vector<Variable>::size_type ipo::Array::size_type

Size type.

Definition at line 58 of file Array.hpp.

Value type.

Definition at line 50 of file Array.hpp.

Constructor & Destructor Documentation

Array::Array ( detail::ModelBase model,
allocator_type const &  alloc = allocator_type(),
char const *const  name = nullptr 
)

Default constructor.

Parameters
modelThe Model
allocAn allocator
nameThe name

Definition at line 113 of file Array.cc.

References ipo::detail::Var::model.

Array::Array ( detail::ModelBase model,
std::string const &  name 
)

Constructor.

Parameters
modelThe Model
nameThe name

Definition at line 119 of file Array.cc.

Array::Array ( detail::ModelBase model,
size_t const  size,
char const *const  name = nullptr 
)
Initial value:
{
ModelBase & model
A Model to attach this to.
Definition: Var.hpp:101
virtual void notify()=0
Notify function that model must implement.

Create a named array with the given name, initial values 0 and unbounded.

Parameters
modelThe Model
sizeThe size of the array
nameThe name

Definition at line 126 of file Array.cc.

References ipo::detail::Var::model, and size().

Array::Array ( detail::ModelBase model,
size_t const  size,
std::string const &  name 
)

Create a named array with the given name, initial values 0 and unbounded.

Parameters
modelThe Model
sizeThe size of the array
nameThe name

Definition at line 132 of file Array.cc.

Array::Array ( detail::ModelBase model,
size_t const  size,
value_type const &  val,
allocator_type const &  alloc,
std::string const &  name 
)
Initial value:
{
ModelBase & model
A Model to attach this to.
Definition: Var.hpp:101
virtual void notify()=0
Notify function that model must implement.

Create a named array with the given name, initial values 0 and unbounded.

Parameters
modelThe Model
sizeThe size of the array
valA value
allocAn allocator
nameThe name

Definition at line 138 of file Array.cc.

Array::Array ( detail::ModelBase model,
size_t const  size,
value_type const &  val,
allocator_type const &  alloc = allocator_type(),
char const *const  name = 0 
)
Initial value:
{
ModelBase & model
A Model to attach this to.
Definition: Var.hpp:101
virtual void notify()=0
Notify function that model must implement.

Create a named array with the given name, initial values 0 and unbounded.

Parameters
modelThe Model
sizeThe size of the array
valA value
allocAn allocator
nameThe name

Definition at line 146 of file Array.cc.

Array::Array ( detail::ModelBase model,
size_t const  size,
value_type const &  val,
std::string const &  name 
)
Initial value:
{
ModelBase & model
A Model to attach this to.
Definition: Var.hpp:101
virtual void notify()=0
Notify function that model must implement.

Create a named array with the given name, initial values 0 and unbounded.

Parameters
modelThe Model
sizeThe size of the array
valA value
nameThe name

Definition at line 154 of file Array.cc.

Array::Array ( detail::ModelBase model,
size_t const  size,
value_type const &  val,
char const *const  name 
)
Initial value:
{
ModelBase & model
A Model to attach this to.
Definition: Var.hpp:101
virtual void notify()=0
Notify function that model must implement.

Create a named array with the given name, initial values 0 and unbounded.

Parameters
modelThe Model
sizeThe size of the array
valA value
nameThe name

Definition at line 162 of file Array.cc.

Array::Array ( Array const &  array)
Initial value:
{
ModelBase & model
A Model to attach this to.
Definition: Var.hpp:101
virtual void notify()=0
Notify function that model must implement.

Copy constructor.

Parameters
arrayAn Array object to copy

Definition at line 170 of file Array.cc.

References ipo::detail::Var::model.

Array::Array ( Array const &  array,
allocator_type const &  alloc 
)
Initial value:
{
ModelBase & model
A Model to attach this to.
Definition: Var.hpp:101
virtual void notify()=0
Notify function that model must implement.

Copy constructor.

Parameters
arrayAn Array object to copy
allocAn allocator

Definition at line 177 of file Array.cc.

References ipo::detail::Var::model.

ipo::Array::Array ( Array &&  array)
inline

Move constructor.

Parameters
arrayAn Array object to copy

Definition at line 182 of file Array.hpp.

Array::Array ( detail::ModelBase model,
std::initializer_list< Variable init,
std::vector< Variable >::allocator_type const &  alloc = std::vector<Variable>::allocator_type(),
char const *const  name = 0 
)
Initial value:
{
ModelBase & model
A Model to attach this to.
Definition: Var.hpp:101
virtual void notify()=0
Notify function that model must implement.

Initialiser list constructor.

Parameters
modelThe Model
initAn initialiser list
allocAn allocator
nameThe name of the array

Definition at line 184 of file Array.cc.

Array::Array ( detail::ModelBase model,
std::initializer_list< Variable init,
std::vector< Variable >::allocator_type const &  alloc,
std::string const &  name 
)
Initial value:
{
ModelBase & model
A Model to attach this to.
Definition: Var.hpp:101
virtual void notify()=0
Notify function that model must implement.

Initialiser list constructor.

Parameters
modelThe Model
initAn initialiser list
allocAn allocator
nameThe name of the array

Definition at line 193 of file Array.cc.

Array::Array ( detail::ModelBase model,
std::initializer_list< Variable init,
char const *const  name = 0 
)
Initial value:
{
ModelBase & model
A Model to attach this to.
Definition: Var.hpp:101
virtual void notify()=0
Notify function that model must implement.

Initialiser list constructor.

Parameters
modelThe Model
initAn initialiser list
nameThe name of the array

Definition at line 202 of file Array.cc.

Array::Array ( detail::ModelBase model,
std::initializer_list< Variable init,
std::string const &  name 
)
Initial value:
{
ModelBase & model
A Model to attach this to.
Definition: Var.hpp:101
virtual void notify()=0
Notify function that model must implement.

Initialiser list constructor.

Parameters
modelThe Model
initAn initialiser list
nameThe name of the array

Definition at line 209 of file Array.cc.

Member Function Documentation

void Array::assign ( size_type  count,
value_type const &  value 
)

Assign values.

Parameters
countThe new array size
valueThe initialising value

Definition at line 269 of file Array.cc.

References dataArray, ipo::detail::Var::getModel(), IPOE, ipo::detail::Var::model, and ipo::detail::ModelBase::notify().

template<typename InputIterator >
void ipo::Array::assign ( InputIterator  first,
InputIterator  last 
)
inline

Assign values.

Parameters
firstIterator dereferencable to first value
lastIterator dereferencable to last value

Definition at line 260 of file Array.hpp.

References dataArray, ipo::detail::Var::getModel(), and IPOE.

void Array::assign ( std::initializer_list< Variable init)

Assign values.

Parameters
initAn initialiser list

Definition at line 278 of file Array.cc.

References dataArray, ipo::detail::Var::getModel(), IPOE, ipo::detail::Var::model, and ipo::detail::ModelBase::notify().

reference ipo::Array::at ( size_type  pos)
inline

Get reference to Variable at position pos.

Throws std::out_of_range on error.

Parameters
posPosition of variable
Returns
reference to Variable at position pos

Definition at line 282 of file Array.hpp.

References dataArray.

const_reference ipo::Array::at ( size_type  pos) const
inline

Get reference to Variable at position pos.

Throws std::out_of_range on error.

Parameters
posPosition of variable
Returns
reference to Variable at position pos

Definition at line 288 of file Array.hpp.

References dataArray.

reference ipo::Array::back ( )
inline

Get reference to last Variable.

Returns
reference to last Variable

Definition at line 315 of file Array.hpp.

References dataArray.

Referenced by emplace_back().

const_reference ipo::Array::back ( ) const
inline

Get reference to last Variable.

Returns
reference to last Variable

Definition at line 320 of file Array.hpp.

References dataArray.

iterator ipo::Array::begin ( )
inline

Get iterator to beginning of range.

Returns
iterator to beginning of range

Definition at line 335 of file Array.hpp.

References dataArray.

Referenced by contains().

const_iterator ipo::Array::begin ( ) const
inline

Get iterator to beginning of range.

Returns
iterator to beginning of range

Definition at line 340 of file Array.hpp.

References dataArray.

size_type ipo::Array::capacity ( ) const
inline

Get capacity of array.

Returns
capacity of array

Definition at line 415 of file Array.hpp.

References dataArray.

const_iterator ipo::Array::cbegin ( ) const
inline

Get iterator to beginning of range.

Returns
iterator to beginning of range

Definition at line 345 of file Array.hpp.

References dataArray.

const_iterator ipo::Array::cend ( ) const
inline

Get iterator to end of range.

Returns
iterator to end of range

Definition at line 360 of file Array.hpp.

References dataArray.

void ipo::Array::clear ( )
inline

Clear array.

Definition at line 423 of file Array.hpp.

References dataArray.

bool Array::contains ( Variable const &  variable) const

Check whether or not array contains variable.

Returns
true or false according as this contains variable

Definition at line 350 of file Array.cc.

References begin(), and end().

const_reverse_iterator ipo::Array::crbegin ( ) const
inline

Get reverse iterator to beginning of range.

Returns
reverse iterator to beginning of range

Definition at line 375 of file Array.hpp.

References dataArray.

const_reverse_iterator ipo::Array::crend ( ) const
inline

Get reverse iterator to end of range.

Returns
reverse iterator to end of range

Definition at line 390 of file Array.hpp.

References dataArray.

pointer ipo::Array::data ( )
inline

Get direct access to data.

Returns
data

Definition at line 325 of file Array.hpp.

References dataArray.

const_pointer ipo::Array::data ( ) const
inline

Get direct access to data.

Returns
data

Definition at line 330 of file Array.hpp.

References dataArray.

template<class... Args>
iterator ipo::Array::emplace ( const_iterator  pos,
Args &&...  args 
)
inline

Insert new value construted in-place before pos.

Parameters
posAn iterator giving position for insertion
argsArguments to the element constructor
Returns
iterator to inserted value

Definition at line 472 of file Array.hpp.

References dataArray, ipo::detail::Var::getModel(), and IPOE.

template<typename... Args>
void ipo::Array::emplace_back ( Args &&...  args)
inline

Insert value at end of array.

Parameters
argsArguments to the element constructor

Definition at line 511 of file Array.hpp.

References back(), dataArray, ipo::detail::Var::getModel(), and IPOE.

bool ipo::Array::empty ( ) const
inline

Check if array is empty.

Returns
true or false according as array is empty or not

Definition at line 395 of file Array.hpp.

References dataArray.

iterator ipo::Array::end ( )
inline

Get iterator to end of range.

Returns
iterator to end of range

Definition at line 350 of file Array.hpp.

References dataArray.

Referenced by contains().

const_iterator ipo::Array::end ( ) const
inline

Get iterator to end of range.

Returns
iterator to end of range

Definition at line 355 of file Array.hpp.

References dataArray.

iterator ipo::Array::erase ( iterator  pos)
inline

Erase element specified by pos.

Parameters
posAn iterator giving position of element to be removed
Returns
iterator to element following removed element

Definition at line 487 of file Array.hpp.

References dataArray.

Referenced by ipo::Objective::removeArray().

iterator ipo::Array::erase ( iterator  first,
iterator  last 
)
inline

Erase elements in range [first, last).

Parameters
firstAn iterator giving position of element to be removed
lastAn iterator giving position of first element not to be removed
Returns
iterator to element following last removed element

Definition at line 494 of file Array.hpp.

References dataArray.

reference ipo::Array::front ( )
inline

Get reference to first Variable.

Returns
reference to first Variable

Definition at line 305 of file Array.hpp.

References dataArray.

Referenced by ipo::Model::setConstraintIndices().

const_reference ipo::Array::front ( ) const
inline

Get reference to first Variable.

Returns
reference to first Variable

Definition at line 310 of file Array.hpp.

References dataArray.

allocator_type ipo::Array::get_allocator ( ) const
inline

Get allocator.

Returns
allocator

Definition at line 276 of file Array.hpp.

References dataArray.

std::string Array::getName ( ) const
Initial value:
{
ModelBase & model
A Model to attach this to.
Definition: Var.hpp:101
virtual void notify()=0
Notify function that model must implement.

Get name of variable.

Returns
name of variable.

Definition at line 217 of file Array.cc.

References dataArray.

Referenced by ipo::Objective::addArray(), ipo::Objective::removeArray(), ipo::detail::PhaseIModel::setIndices(), and summary().

gsl::vector Array::getValue ( ) const

Create a gsl::vector containing the values of this in order.

Returns
The vector

Definition at line 364 of file Array.cc.

References size().

Array::iterator Array::insert ( iterator  pos,
value_type const &  value 
)

Insert value before position given by iterator pos.

Parameters
posAn iterator giving position for insertion
valueThe value to insert
Returns
iterator to inserted value

Definition at line 287 of file Array.cc.

References dataArray, ipo::detail::Var::getModel(), IPOE, ipo::detail::Var::model, and ipo::detail::ModelBase::notify().

Array::iterator Array::insert ( iterator  pos,
value_type &&  value 
)

Insert value before position given by iterator pos.

Parameters
posAn iterator giving position for insertion
valueThe value to insert
Returns
iterator to inserted value

Definition at line 296 of file Array.cc.

References dataArray, ipo::detail::Var::getModel(), IPOE, ipo::detail::Var::model, and ipo::detail::ModelBase::notify().

void Array::insert ( iterator  pos,
size_type  count,
const value_type value 
)

Insert count copies of value before position given by iterator pos.

Parameters
posAn iterator giving position for insertion
countThe number of copies to insert
valueThe value to insert

Definition at line 305 of file Array.cc.

References dataArray, ipo::detail::Var::getModel(), IPOE, ipo::detail::Var::model, and ipo::detail::ModelBase::notify().

template<typename InputIterator >
void ipo::Array::insert ( iterator  pos,
InputIterator  first,
InputIterator  last 
)
inline

Insert count copies of value before position given by iterator pos.

Parameters
posAn iterator giving position for insertion
firstIterator dereferencable to first value
lastIterator dereferencable to last value

Definition at line 452 of file Array.hpp.

References dataArray, ipo::detail::Var::getModel(), and IPOE.

void Array::insert ( iterator  pos,
std::initializer_list< Variable ilist 
)

Insert values before pos.

Parameters
posAn iterator giving position for insertion
ilistAn initialiser list

Definition at line 314 of file Array.cc.

References dataArray, ipo::detail::Var::getModel(), IPOE, ipo::detail::Var::model, and ipo::detail::ModelBase::notify().

size_type ipo::Array::max_size ( ) const
inline

Get maximum size of array.

Returns
maximum size of array

Definition at line 405 of file Array.hpp.

References dataArray.

Array & Array::operator= ( Array &&  array)

Move assignment operator.

Parameters
arrayThe array to be moved
Returns
*this

Definition at line 241 of file Array.cc.

References dataArray, IPOE, ipo::detail::Var::model, and ipo::swap().

Array & Array::operator= ( Array array)

Copy assignment operator.

Parameters
arrayThe array to be copied
Returns
*this

Definition at line 249 of file Array.cc.

References dataArray, IPOE, and ipo::detail::Var::model.

reference ipo::Array::operator[] ( size_type  pos)
inline

Get reference to Variable at position pos.

Parameters
posPosition of variable
Returns
reference to Variable at position pos

Definition at line 294 of file Array.hpp.

References dataArray.

const_reference ipo::Array::operator[] ( size_type  pos) const
inline

Get reference to Variable at position pos.

Parameters
posPosition of variable
Returns
reference to Variable at position pos

Definition at line 300 of file Array.hpp.

References dataArray.

void ipo::Array::pop_back ( )
inline

Remove last element of array.

Definition at line 523 of file Array.hpp.

References dataArray.

void Array::push_back ( value_type const &  value)

Insert value at end of array.

Parameters
valueVariable to add to end of array

Definition at line 323 of file Array.cc.

References dataArray, ipo::detail::Var::getModel(), IPOE, ipo::detail::Var::model, and ipo::detail::ModelBase::notify().

Referenced by ipo::Objective::addArray(), ipo::detail::ModelFunction::addVariable(), and ipo::detail::PhaseIModel::setIndices().

void Array::push_back ( value_type &&  value)

Insert value at end of array.

Parameters
valueVariable to add to end of array

Definition at line 332 of file Array.cc.

References dataArray, ipo::detail::Var::getModel(), IPOE, ipo::detail::Var::model, and ipo::detail::ModelBase::notify().

reverse_iterator ipo::Array::rbegin ( )
inline

Get reverse iterator to beginning of range.

Returns
reverse iterator to beginning of range

Definition at line 365 of file Array.hpp.

References dataArray.

const_reverse_iterator ipo::Array::rbegin ( ) const
inline

Get reverse iterator to beginning of range.

Returns
reverse iterator to beginning of range

Definition at line 370 of file Array.hpp.

References dataArray.

reverse_iterator ipo::Array::rend ( )
inline

Get reverse iterator to end of range.

Returns
reverse iterator to end of range

Definition at line 380 of file Array.hpp.

References dataArray.

const_reverse_iterator ipo::Array::rend ( ) const
inline

Get reverse iterator to end of range.

Returns
reverse iterator to end of range

Definition at line 385 of file Array.hpp.

References dataArray.

void ipo::Array::reserve ( size_type  size)
inline

Reserve capacity.

Parameters
sizeThe new size to reserve

Definition at line 410 of file Array.hpp.

References dataArray.

void ipo::Array::resize ( size_type  count)
inline

Resize array.

Parameters
countThe new size of the array

Definition at line 528 of file Array.hpp.

References dataArray.

void Array::resize ( size_type  count,
const value_type value 
)

Resize array.

Parameters
countThe new size of the array
valueThe value to insert in any new elements of the array

Definition at line 341 of file Array.cc.

References dataArray, ipo::detail::Var::getModel(), IPOE, ipo::detail::Var::model, and ipo::detail::ModelBase::notify().

void Array::setName ( std::string const &  name)

Set name of variable.

Parameters
nameThe new name.

Definition at line 222 of file Array.cc.

References dataArray, and name.

void Array::setName ( char *const  name)

Set name of variable.

Parameters
nameThe new name.

Definition at line 227 of file Array.cc.

References dataArray, and name.

void Array::setValue ( gsl::vector const &  vector)

Set the value of this from a gsl::vector.

Parameters
vectorThe vector
Exceptions
IPOExceptionif vector size and array size don’t match

Definition at line 355 of file Array.cc.

References IPOE, and size().

void ipo::Array::shrink_to_fit ( )
inline

Free unused memory.

Definition at line 419 of file Array.hpp.

References dataArray.

void Array::summary ( std::ostream &  ostream = std::cout,
std::string const &  prefix = "" 
) const
overridevirtual

Create a summary of this Array object.

Parameters
ostreamThe stream to print to.
prefixThis is put in front of every row of output, for example for indentation

Implements ipo::detail::Var.

Definition at line 372 of file Array.cc.

References getName().

void Array::swap ( Array array)

Swap contents of container with those of another.

Parameters
arrayArray to swap with

Definition at line 232 of file Array.cc.

References dataArray, ipo::detail::Var::getModel(), IPOE, ipo::detail::Var::model, ipo::detail::ModelBase::notify(), and ipo::swap().

Referenced by ipo::swap().

Friends And Related Function Documentation

bool ipo::operator!= ( Array const &  ,
Array const &   
)
friend
bool ipo::operator< ( Array const &  ,
Array const &   
)
friend
bool ipo::operator<= ( Array const &  ,
Array const &   
)
friend
bool ipo::operator== ( Array const &  ,
Array const &   
)
friend
bool ipo::operator> ( Array const &  ,
Array const &   
)
friend
bool ipo::operator>= ( Array const &  ,
Array const &   
)
friend

Member Data Documentation


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