C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2

Two-dimensional array of objects. More...

#include <templ_array2.h>

+ Inheritance diagram for Array2< Type >:

Public Member Functions

 Array2 ()
 Constructor.
 
 Array2 (const uint16 &lsz, const uint16 &csz)
 The constructor of restricted dimension.
 
 Array2 (const Array2< Type > &)
 Copy-constructor.
 
 ~Array2 ()
 Destructor.
 
size_t Lines () const
 Count of rows.
 
size_t Columns () const
 Count of columns.
 
size_t Count () const
 Count of elements.

 
c3d::IndicesPair GetSize () const
 Give the size of the array.
 
bool SetSize (c3d::IndicesPair sz)
 Set size.
 
bool SetSize (size_t lsz, size_t csz)
 Set size.
 
bool SetSize (size_t n)
 Set size.
 
const Type & GetElem (size_t ln, size_t cn) const
 Get an element of the array.
 
void SetElem (size_t ln, size_t cn, const Type &v)
 Set an element of the array.
 
const Type & operator() (size_t i, size_t j) const
 Access by indices operator.
 
Array2< Type > & SetZero ()
 Assign zeros to array.
 
bool Init (const Array2< Type > &src)
 An assignment function.
 
Array2< Type > & operator= (const Array2< Type > &src)
 The assignment operator.
 
bool SwapLines (size_t ln1, size_t ln2)
 Swap lines.
 
Type & operator() (size_t i, size_t j)
 Access by indices operator.
 
const Type * GetLine (size_t i=0) const
 Get an address of the row start.
 
Type * SetLine (size_t i=0)
 Get an address of the row start.
 
void Init (size_t ln, size_t cn, const Type &v)
 Initiate an element.
 
bool InsertColumn (size_t i=0)
 Functions that allocate potentially large memory, return the operation result (success/error). More...
 
bool AddColumn ()
 Add column to the end of the array.
 
void RemoveColumn (size_t i=0)
 Delete column from array.
 
bool InsertLine (size_t i=0)
 Insert row before the specified one.
 
bool AddLine ()
 Add row to the end of the array.
 
void RemoveLine (size_t i=0)
 Delete row from array.
 

Static Public Member Functions

static Array2< Type > * Create (size_t lSize, size_t cSize)
 Create an array of a given dimension (returns nullptr in case of failure).
 

Protected Member Functions

 Array2 (size_t lsz, size_t csz)
 The constructor by a given dimension.
 
bool CatchLinePointers (size_t newCount)
 Allocate memory for the given count of pointers to rows.
 
TEMPLATE_FRIEND readeroperator>>TEMPLATE_SUFFIX (reader &in, Array2< Type > &ptr)
 Read operator.
 
TEMPLATE_FRIEND writeroperator<<TEMPLATE_SUFFIX (writer &out, const Array2< Type > &ref)
 Write operator.
 
TEMPLATE_FRIEND readeroperator>>TEMPLATE_SUFFIX (reader &in, Array2< Type > *&ptr)
 Read operator.
 
TEMPLATE_FRIEND writeroperator<<TEMPLATE_SUFFIX (writer &out, const Array2< Type > *ptr)
 Write operator.
 
TEMPLATE_FRIEND bool realloc_line TEMPLATE_SUFFIX (Type *&line, size_t oldSize, size_t newSize)
 Reallocate memory for one row.
 
TEMPLATE_FRIEND bool assign_to_array TEMPLATE_SUFFIX (Array2< Type > &, const Array2< Type > &src)
 Copy an array.
 
TEMPLATE_FRIEND bool set_array_size TEMPLATE_SUFFIX (Array2< Type > &, size_t lSize, size_t cSize)
 Set the size of the array.
 
TEMPLATE_FRIEND bool insert_column_to_array TEMPLATE_SUFFIX (Array2< Type > &, size_t ind)
 Insert column before the specified one and fill it with zeros.
 
TEMPLATE_FRIEND bool add_column_to_array TEMPLATE_SUFFIX (Array2< Type > &)
 Add column to array and fill it with zeros.
 
TEMPLATE_FRIEND void remove_column_from_array TEMPLATE_SUFFIX (Array2< Type > &, size_t ind)
 Delete column from array.
 
TEMPLATE_FRIEND void zero_array TEMPLATE_SUFFIX (Array2< Type > &)
 Fill the array with zeros.
 

Protected Attributes

Type ** parr
 Pointer to first element of array (elements of array are pointers to contents of rows).
 
size_t l
 Count of rows in the array.
 
size_t c
 Count of columns of array (i.e. length of each row).
 

Detailed Description

template<class Type>
class Array2< Type >

Two-dimensional array of objects.

Two-dimensional array of objects.

Member Function Documentation

◆ InsertColumn()

template<class Type >
bool Array2< Type >::InsertColumn ( size_t  i = 0)
inline

Functions that allocate potentially large memory, return the operation result (success/error).

Insert column before the specified one.


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