dlinear  0.0.1
Delta-complete SMT solver for linear programming
Loading...
Searching...
No Matches
dlinear::qsopt_ex::MpqArray Class Reference

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

#include <libqsopt_ex.h>

Public Member Functions

 MpqArray (size_t n_elements)
 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
 Obtain a constant pointer to the internal array_.
 
 operator mpq_t * ()
 Obtain a pointer to the internal array.
 
size_t size () const
 Get read-only access to the size of the 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 libqsopt_ex.h.

Constructor & Destructor Documentation

◆ MpqArray()

dlinear::qsopt_ex::MpqArray::MpqArray ( size_t n_elements)
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 57 of file libqsopt_ex.cpp.

Member Function Documentation

◆ AllocateMpqArray()

void dlinear::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 30 of file libqsopt_ex.cpp.

◆ operator const mpq_t *()

dlinear::qsopt_ex::MpqArray::operator const mpq_t * ( ) const
inlineexplicit

Obtain a constant pointer to the internal array_.

Returns
internal mpq_t array as a constant pointer

Definition at line 83 of file libqsopt_ex.h.

◆ operator mpq_t *()

dlinear::qsopt_ex::MpqArray::operator mpq_t * ( )
inlineexplicit

Obtain a pointer to the internal array.

Returns
internal mpq_t array

Definition at line 89 of file libqsopt_ex.h.

◆ Resize()

void dlinear::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 61 of file libqsopt_ex.cpp.

◆ size()

size_t dlinear::qsopt_ex::MpqArray::size ( ) const
inlinenodiscard

Get read-only access to the size of the array.

Returns
size of the array

Definition at line 96 of file libqsopt_ex.h.


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