delpi  0.0.1
DElta-complete LP solver
Loading...
Searching...
No Matches
delpi::qsopt_ex::MpqArray Class Reference

A wrapper around an array of mpq_t elements. More...

#include <qsopt_ex.h>

Public Member Functions

 MpqArray (size_t n_elements=0)
 Construct a new MpqArray object, allocating the array with n_elements elements.
 ~MpqArray ()
 Destroy the MpqArray object, freeing the array.
 operator const mpq_t *const * () const
 Obtain a constant pointer to the internal array_.
 operator mpq_t ** ()
 Obtain a constant pointer to the internal array_.
 operator const mpq_t * () const
 Obtain a constant pointer to the internal array_.
 operator mpq_t * ()
 Obtain a pointer to the internal array.
void Resize (size_t nElements)
 Resize the array to have nElements elements.

Private Member Functions

void AllocateMpqArray (size_t n_elements)
 Allocate the array with n_elements elements.
void FreeMpqArray ()
 Free the array of mpq_t.

Private Attributes

mpq_t * array_
 array of mpq_t. It is allocated by AllocateMpqArray() and freed by FreeMpqArray().

Detailed Description

A wrapper around an array of mpq_t elements.

It is used to pass around arrays of mpq_t, ensuring they are cleaned up after use. The array is allocated by AllocateMpqArray() and freed by FreeMpqArray().

Definition at line 66 of file qsopt_ex.h.

Constructor & Destructor Documentation

◆ MpqArray()

delpi::qsopt_ex::MpqArray::MpqArray ( size_t n_elements = 0)
explicit

Construct a new MpqArray object, allocating the array with n_elements elements.

Parameters
n_elementsThe number of elements in the array.

Definition at line 60 of file qsopt_ex.cpp.

Member Function Documentation

◆ AllocateMpqArray()

void delpi::qsopt_ex::MpqArray::AllocateMpqArray ( size_t n_elements)
private

Allocate the array with n_elements elements.

The array has a peculiar structure, where the element at index -1 is the size of the array. All the other n_elements elements are mpq_t.

Parameters
n_elementsThe number of elements in the array.

Definition at line 34 of file qsopt_ex.cpp.

◆ operator const mpq_t *()

delpi::qsopt_ex::MpqArray::operator const mpq_t * ( ) const
inline

Obtain a constant pointer to the internal array_.

Returns
internal mpq_t array as a constant pointer

Definition at line 95 of file qsopt_ex.h.

◆ operator const mpq_t *const *()

delpi::qsopt_ex::MpqArray::operator const mpq_t *const * ( ) const
inline

Obtain a constant pointer to the internal array_.

Returns
internal mpq_t array as a constant pointer

Definition at line 84 of file qsopt_ex.h.

◆ operator mpq_t *()

delpi::qsopt_ex::MpqArray::operator mpq_t * ( )
inline

Obtain a pointer to the internal array.

Returns
internal mpq_t array

Definition at line 101 of file qsopt_ex.h.

◆ operator mpq_t **()

delpi::qsopt_ex::MpqArray::operator mpq_t ** ( )
inline

Obtain a constant pointer to the internal array_.

Returns
internal mpq_t array as a constant pointer

Definition at line 89 of file qsopt_ex.h.

◆ Resize()

void delpi::qsopt_ex::MpqArray::Resize ( size_t nElements)

Resize the array to have nElements elements.

All the previous elements are lost.

Parameters
nElementsnew number of elements in the array

Definition at line 64 of file qsopt_ex.cpp.


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