66 #define MAX_SMALL_VEC_SIZE 8 123 set(v, offset, limit);
170 return reset().
put(v, offset, limit);
179 size_t copy_to(
void* p,
size_t limit = 0x7fffffff)
const;
182 size_t copy_to(std::basic_string<unsigned char>& buffer,
size_t limit = 0x7fffffff)
const;
189 int cmp(
const cvec_t& v,
size_t* common_size = 0)
const;
191 int cmp(
const void* s,
size_t len)
const;
194 const cvec_t& v2,
size_t* common_size = 0) {
195 return v1.
cmp(v2, common_size);
283 void _grow(
int total_cnt);
295 #if W_DEBUG_LEVEL > 2 302 return (
count() == 0)
326 :
cvec_t(v, offset, limit) {};
333 const vec_t& copy_from(
336 size_t offset = 0)
const;
356 size_t myoffset = 0);
360 return (index >= 0 && index < _cnt) ?
361 _base[index].ptr : (
CADDR_T)
nullptr;
365 size_t len(
int index)
const {
366 return (index >= 0 && index < _cnt) ?
367 _base[index].len : 0;
373 void mkchunk(
int maxsize,
379 static vec_t& pos_inf;
388 cerr <<
"vec_t: disabled member called" << endl;
389 cerr <<
"failed at \"" << __FILE__ <<
":" << __LINE__ <<
"\"" << endl;
399 return v1.
cmp(v2) < 0;
403 return v1.
cmp(v2) <= 0;
407 return v1.
cmp(v2) >= 0;
411 return v1.
cmp(v2) > 0;
415 return (&v1 == &v2) || v1.
cmp(v2) == 0;
int cmp(const cvec_t &v, size_t *common_size=0) const
int count() const
return number of {p,l} pairs
Definition: vec_t.h:199
bool _is_large() const
Definition: vec_t.h:273
A helper class for VEC_t.
Definition: vec_t.h:78
cvec_t & put(const cvec_t &v, size_t offset, size_t nbytes)
bool is_zvec() const
Definition: vec_t.h:294
cvec_t(const cvec_t &v1, const cvec_t &v2)
Definition: vec_t.h:111
bool is_null() const
Definition: vec_t.h:243
static int cmp(const cvec_t &v1, const cvec_t &v2, size_t *common_size=0)
Definition: vec_t.h:193
void delparts()
Definition: vec_t.h:226
static CADDR_T zero_location
Definition: vec_t.h:98
void vecdelparts()
Definition: vec_t.h:217
cvec_t & reset()
Clear this vector.
Definition: vec_t.h:147
bool operator<=(const cvec_t &v1, const cvec_t &v2)
Definition: vec_t.h:402
cvec_t(const cvec_t &v, size_t offset, size_t limit)
Definition: vec_t.h:121
#define MAX_SMALL_VEC_SIZE
Definition: vec_t.h:66
static cvec_t neg_inf
Definition: vec_t.h:265
vec_pair_t _pair[MAX_SMALL_VEC_SIZE]
Definition: vec_t.h:90
cvec_t()
Definition: vec_t.h:105
static cvec_t pos_inf
Definition: vec_t.h:263
#define w_assert3(x)
Level 3 definitely adds significant time.
Definition: w_base.h:214
std::istream & operator>>(std::istream &is, ConfigFile &cf)
Definition: confparser.cpp:94
dummy_enumid
Definition: vec_t.h:101
Key string class which can represent a few special values.
Definition: w_key.h:47
bool is_neg_inf() const
Definition: vec_t.h:239
A constant vec_t (meaning things pointed to cannot be changed).
Definition: vec_t.h:95
size_t copy_to(void *p, size_t limit=0x7fffffff) const
bool operator==(const cvec_t &v1, const cvec_t &v2)
Definition: vec_t.h:414
vec_t(const vec_t &v, size_t offset, size_t limit)
Construct a vector from a memory location + offset and a length.
Definition: vec_t.h:325
A base class for vec_t.
Definition: vec_t.h:85
void split(size_t l1, cvec_t &v1, cvec_t &v2) const
bool operator!=(const cvec_t &v1, const cvec_t &v2)
Definition: vec_t.h:418
void init()
Definition: vec_t.h:207
bool is_pos_inf() const
Definition: vec_t.h:235
size_t size() const
returns # bytes this vector references
Definition: vec_t.h:174
vec_t(const cvec_t &v1, const cvec_t &v2)
Construct a vector that combines two others.
Definition: vec_t.h:319
size_t recalc_size() const
std::ostream & operator<<(std::ostream &os, const ConfigFile &cf)
Definition: confparser.cpp:83
CADDR_T ptr
Definition: vec_t.h:79
bool operator>=(const cvec_t &v1, const cvec_t &v2)
Definition: vec_t.h:406
bool operator>(const cvec_t &v1, const cvec_t &v2)
Definition: vec_t.h:410
bool operator<(const cvec_t &v1, const cvec_t &v2)
Definition: vec_t.h:398
vec_pair_t * _base
Definition: vec_t.h:88
void _grow(int total_cnt)
static vec_t & pos_inf
A constant vector representing infinity. Used for key-value pairs, scans.
Definition: vec_t.h:380
Vector: a set of {pointer,length} pairs for memory manipulation.
Definition: vec_t.h:313
size_t _size
Definition: vec_t.h:87
size_t len
Definition: vec_t.h:80
int _max_cnt() const
Definition: vec_t.h:278
vec_t(const vec_t &)
Definition: vec_t.h:387
static vec_t & neg_inf
A constant vector representing negative infinity. Used for key-value pairs, scans.
Definition: vec_t.h:383
vec_t(const void *p, size_t l)
Construct a vector from a memory location and a length.
Definition: vec_t.h:322
void calc_kvl(uint32_t &h) const
cvec_t(const void *p, size_t l)
Definition: vec_t.h:116
size_t len(int index) const
Return the length from the {pointer, length} pair at the given index.
Definition: vec_t.h:365
CADDR_T ptr(int index) const
Return the pointer from the {pointer, length} pair at the given index.
Definition: vec_t.h:359
#define W_FATAL(e)
Croak with the error code e.
Definition: w_rc.h:378
vec_t()
Construct empty vector.
Definition: vec_t.h:316
int _cnt
Definition: vec_t.h:86
const unsigned char * CADDR_T
Definition: vec_t.h:64