40#ifndef __EST_TVector_H__
41#define __EST_TVector_H__
46#include "EST_rw_status.h"
48#include "instantiate/EST_TVectorI.h"
58extern const int EST_CURRENT;
59extern const int EST_ALL;
62#ifndef TVECTOR_BOUNDS_CHECKING
63# define TVECTOR_BOUNDS_CHECKING 0
66#if TVECTOR_BOUNDS_CHECKING
67#define A_CHECK a_check
69#define A_CHECK a_no_check
77#if defined(__GNUC__) && 0
78# define fast_a_v_gcc(C) \
80 (((char (*) [sizeof(T)*p_column_step])p_memory) + (C))\
82# define fast_a_v_x(C) (fast_a_v_gcc(C))
84# define fast_a_v_x(C) (fast_a_v(C))
161 unsigned int p_column_step;
168 unsigned int cs)
const
169 {
return cs==1?c:c*cs;}
171 INLINE
unsigned int vcell_pos(
unsigned int c)
const
177 INLINE
unsigned int vcell_pos_1(
unsigned int c)
const
187 INLINE
const T &fast_a_1(
int c)
const {
return p_memory[vcell_pos_1(c)]; }
188 INLINE T &fast_a_1(
int c) {
return p_memory[vcell_pos_1(c)]; }
191 void set_values(
const T *data,
int step,
int start_c,
int num_c);
192 void get_values(T *data,
int step,
int start_c,
int num_c)
const;
217 T *
memory,
int offset=0,
int free_when_destroyed=0);
272 const T &a(
int n)
const {
return A_CHECK(
n); }
273 T &a(
int n) {
return A_CHECK(
n); }
287 void set_memory(T *buffer,
int offset,
int columns,
288 int free_when_destroyed=0);
294 void fill(
const T &v);
303 {
return ! ((*this) == v); }
307 void copy_section(T* dest,
int offset=0,
int num=-1)
const;
308 void set_section(
const T* src,
int offset=0,
int num=-1);
316 for (i = 0; i < m.
n(); ++i)
325 void integrity()
const;
void empty()
Fill vector with default value.
unsigned int p_offset
How to access the memory.
INLINE const T & fast_a_v(int c) const
quick method for returning (x[n])
const T & a_check(int n) const
read-only const access operator: with bounds checking
friend ostream & operator<<(ostream &st, const EST_TVector< T > &m)
print out vector.
INLINE T & a_no_check(int n)
read/write non-const access operator: without bounds checking
void just_resize(int new_cols, T **old_vals)
resize the memory and reset the bounds, but don't set values.
void resize(int n, int set=1)
void default_vals()
sets data and length to default values (0 in both cases).
EST_TVector & operator=(const EST_TVector &s)
assignment operator
INLINE T & a_no_check_1(int n)
read/write non-const access operator: without bounds checking
void copy_data(const EST_TVector< T > &a)
just copy data, no resizing, no size check.
INLINE int num_columns() const
number of items in vector.
const T & operator()(int n) const
read-only const access operator: return reference to nth member
INLINE int length() const
number of items in vector.
void copy_section(T *dest, int offset=0, int num=-1) const
Copy data in and out. Subclassed by SimpleVector for speed.
void copy(const EST_TVector< T > &a)
private copy function, called from all other copying functions.
unsigned int p_num_columns
Visible shape.
INLINE int n() const
number of items in vector.
int operator==(const EST_TVector &v) const
is true if vectors are equal size and all elements are equal.
EST_TVector()
default constructor
void sub_vector(EST_TVector< T > &sv, int start_c=0, int len=-1)
Create a sub vector.
void fill(const T &v)
Fill entire array will value <parameter>v</parameter>.
INLINE const T & a_no_check_1(int n) const
read-only const access operator: without bounds checking
~EST_TVector()
destructor.
INLINE const T & a_no_check(int n) const
read-only const access operator: without bounds checking
T & operator[](int n)
read/write non const access operator: return reference to nth member
INLINE unsigned int vcell_pos(unsigned int c, unsigned int cs) const
The memory access rule, in one place for easy reference.
static const T * def_val
default value, used for filling matrix after resizing
int operator!=(const EST_TVector &v) const
is true if vectors are not equal size or a single elements isn't equal.
void set_values(const T *data, int step, int start_c, int num_c)
Get and set values from array.