Lolly 1.4.27
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | Friends | List of all members
array_rep< T > Class Template Reference

A concrete struct representing the implementation of an array. More...

#include <array.hpp>

Inheritance diagram for array_rep< T >:
Inheritance graph
[legend]
Collaboration diagram for array_rep< T >:
Collaboration graph
[legend]

Public Member Functions

 array_rep ()
 Construct a new array representation object with length 0.
 
 array_rep (int n)
 Construct a new array representation object with specified length.
 
 ~array_rep ()
 Destroy the array representation object.
 
void resize (int n)
 Resize the array length to n.
 

Private Attributes

int n
 
T * a
 
- Private Attributes inherited from concrete_struct
int ref_count
 The reference count for the concrete object.
 

Friends

class array< T >
 
int N LESSGTR (array< T > a)
 
T *A LESSGTR (array< T > a)
 
array< T > copy LESSGTR (array< T > a)
 

Additional Inherited Members

- Private Member Functions inherited from concrete_struct
 concrete_struct ()
 Default constructor for the concrete object. Increments the reference count.
 
virtual ~concrete_struct ()
 Virtual destructor for the concrete object. Decrements the reference count.
 

Detailed Description

template<class T>
class array_rep< T >

A concrete struct representing the implementation of an array.

Template Parameters
TType of elements in the array.

Definition at line 53 of file array.hpp.

Constructor & Destructor Documentation

◆ array_rep() [1/2]

template<class T >
array_rep< T >::array_rep ( )
inline

Construct a new array representation object with length 0.

Definition at line 61 of file array.hpp.

61: n (0), a (NULL) {}
int n
Definition array.hpp:54
T * a
Definition array.hpp:55
The list class represents a linked list.
Definition list.hpp:48

◆ array_rep() [2/2]

template<class T >
array_rep< T >::array_rep ( int n)

Construct a new array representation object with specified length.

Parameters
nThe length of the array.

Definition at line 31 of file array.ipp.

32 : n (n2), a ((n == 0) ? ((T*) NULL)
33 : (tm_new_array<T> (round_length (n, sizeof (T))))) {}
int round_length(int n, size_t s)
Definition array.ipp:21
C * tm_new_array(int n)

◆ ~array_rep()

template<class T >
array_rep< T >::~array_rep ( )
inline

Destroy the array representation object.

Definition at line 73 of file array.hpp.

73 {
74 if (n != 0) tm_delete_array (a);
75 }
void tm_delete_array(C *Ptr)

Member Function Documentation

◆ resize()

template<class T >
void array_rep< T >::resize ( int n)

Resize the array length to n.

Parameters
n

Definition at line 37 of file array.ipp.

37 {
38 int nn= round_length (n, sizeof (T));
39 int mm= round_length (m, sizeof (T));
40 if (mm != nn) {
41 if (mm != 0) {
42 if (nn != 0) {
44 }
45 else {
47 }
48 }
49 else {
50 if (nn != 0) tm_delete_array (a);
51 a= NULL;
52 }
53 }
54 n= m;
55}

Friends And Related Symbol Documentation

◆ array< T >

template<class T >
friend class array< T >
friend

Definition at line 82 of file array.hpp.

◆ LESSGTR [1/3]

template<class T >
int N LESSGTR ( array< T > a)
friend

◆ LESSGTR [2/3]

template<class T >
T *A LESSGTR ( array< T > a)
friend

◆ LESSGTR [3/3]

template<class T >
array< T > copy LESSGTR ( array< T > a)
friend

Member Data Documentation

◆ n

template<class T >
int array_rep< T >::n
private

Definition at line 54 of file array.hpp.

◆ a

template<class T >
T* array_rep< T >::a
private

Definition at line 55 of file array.hpp.


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