Data Structures | Defines | Functions | Variables

Vec.h File Reference

Vector and Set templates with qsort. More...

#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include "defalloc.h"
#include "ink_assert.h"
Include dependency graph for Vec.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

class  Vec< C, A, S >
class  Accum< C, A, S >
class  Intervals
class  UnionFind

Defines

#define VEC_INTEGRAL_SHIFT_DEFAULT   2
#define VEC_INTEGRAL_SIZE   (1 << (S))
#define VEC_INITIAL_SHIFT   ((S)+1)
#define VEC_INITIAL_SIZE   (1 << VEC_INITIAL_SHIFT)
#define SET_LINEAR_SIZE   4
#define SET_INITIAL_INDEX   2
#define forv_Vec(_c, _p, _v)
#define for_Vec(_c, _p, _v)
#define forvp_Vec(_c, _p, _v)

Functions

template<class C , class A , int S>
int marshal_size (Vec< C, A, S > &v)
template<class C , class A , int S>
int marshal (Vec< C, A, S > &v, char *buf)
template<class C , class A , int S>
int unmarshal (Vec< C, A, S > &v, char *buf)
template<class C >
void qsort_Vec (C *left, C *right, bool(*lt)(C, C))
template<class C >
void qsort_VecRef (C *left, C *right, bool(*lt)(C &, C &))
void test_vec ()

Variables

const uintptr_t prime2 []
const uintptr_t open_hash_primes [256]

Detailed Description

Vector and Set templates with qsort.

License

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Definition in file Vec.h.


Define Documentation

#define for_Vec (   _c,
  _p,
  _v 
)
Value:
if ((_v).n) for (_c *qq__##_p = (_c*)0, _p = (_v).v[0]; \
                    ((uintptr_t)(qq__##_p) < (_v).length()) && ((_p = (_v).v[(intptr_t)qq__##_p]) || 1); qq__##_p = (_c*)(((intptr_t)qq__##_p) + 1))

Definition at line 126 of file Vec.h.

#define forv_Vec (   _c,
  _p,
  _v 
)
Value:
if ((_v).n) for (_c *qq__##_p = (_c*)0, *_p = (_v).v[0]; \
                    ((uintptr_t)(qq__##_p) < (_v).length()) && ((_p = (_v).v[(intptr_t)qq__##_p]) || 1); qq__##_p = (_c*)(((intptr_t)qq__##_p) + 1))

Definition at line 124 of file Vec.h.

Referenced by ControlBase::CheckModifiers(), and ControlBase::findModOfType().

#define forvp_Vec (   _c,
  _p,
  _v 
)
Value:
if ((_v).n) for (_c *qq__##_p = (_c*)0, *_p = &(_v).v[0]; \
                    ((uintptr_t)(qq__##_p) < (_v).length()) && ((_p = &(_v).v[(intptr_t)qq__##_p]) || 1); qq__##_p = (_c*)(((intptr_t)qq__##_p) + 1))

Definition at line 128 of file Vec.h.

#define SET_INITIAL_INDEX   2

Definition at line 42 of file Vec.h.

Referenced by HashMap< K, AHashFns, C, A >::put(), and HashSet< K, AHashFns, C, A >::put().

#define SET_LINEAR_SIZE   4

Definition at line 41 of file Vec.h.

Referenced by Vec< C, A, S >::set_add(), and Vec< C, A, S >::set_in().

#define VEC_INITIAL_SHIFT   ((S)+1)

Definition at line 38 of file Vec.h.

#define VEC_INITIAL_SIZE   (1 << VEC_INITIAL_SHIFT)

Definition at line 39 of file Vec.h.

#define VEC_INTEGRAL_SHIFT_DEFAULT   2

Definition at line 36 of file Vec.h.

#define VEC_INTEGRAL_SIZE   (1 << (S))

Definition at line 37 of file Vec.h.

Referenced by Vec< C, A, S >::add(), and Vec< C, A, S >::set_to_vec().


Function Documentation

template<class C , class A , int S>
int marshal ( Vec< C, A, S > &  v,
char *  buf 
) [inline]

Definition at line 711 of file Vec.h.

References Vec< C, A, S >::i, Vec< C, A, S >::n, and Vec< C, A, S >::v.

Referenced by CoreUtils::load_http_hdr().

template<class C , class A , int S>
int marshal_size ( Vec< C, A, S > &  v  )  [inline]

Definition at line 703 of file Vec.h.

References Vec< C, A, S >::n, and Vec< C, A, S >::v.

template<class C >
void qsort_Vec ( C *  left,
C *  right,
bool(*)(C, C)  lt 
) [inline]

Definition at line 754 of file Vec.h.

template<class C >
void qsort_VecRef ( C *  left,
C *  right,
bool(*)(C &, C &)  lt 
) [inline]

Definition at line 790 of file Vec.h.

void test_vec (  ) 
template<class C , class A , int S>
int unmarshal ( Vec< C, A, S > &  v,
char *  buf 
) [inline]

Definition at line 721 of file Vec.h.

References Vec< C, A, S >::e, Vec< C, A, S >::i, Vec< C, A, S >::n, and Vec< C, A, S >::v.

Referenced by CacheVC::scanObject().


Variable Documentation

const uintptr_t open_hash_primes[256]
const uintptr_t prime2[]

Definition at line 28 of file Vec.cc.

Referenced by NBlockHash< C, AHashFns, N, A >::size(), and TSHashTable< H >::TSHashTable().