blob: 9b284778470fd8a938e65b9e6b7d4f2b38ddaa29 [file] [log] [blame] [raw]
Hisham Muhammadf6e0b7d2006-06-06 20:28:42 +00001/* Do not edit this file. It was automatically generated. */
Hisham Muhammada853faa2006-05-30 13:45:40 +00002
3#ifndef HEADER_Vector
4#define HEADER_Vector
5/*
Hisham Muhammad84281bd2011-12-26 21:35:57 +00006htop - Vector.h
Hisham Muhammad300caa02011-05-26 16:35:07 +00007(C) 2004-2011 Hisham H. Muhammad
Hisham Muhammada853faa2006-05-30 13:45:40 +00008Released under the GNU GPL, see the COPYING file
9in the source distribution for its full text.
10*/
11
12#include "Object.h"
Hisham Muhammada853faa2006-05-30 13:45:40 +000013
Hisham Muhammad7ca10812011-11-18 06:08:56 +000014#define swap(a_,x_,y_) do{ void* tmp_ = a_[x_]; a_[x_] = a_[y_]; a_[y_] = tmp_; }while(0)
15
Hisham Muhammada853faa2006-05-30 13:45:40 +000016#ifndef DEFAULT_SIZE
17#define DEFAULT_SIZE -1
18#endif
19
Hisham Muhammada853faa2006-05-30 13:45:40 +000020typedef struct Vector_ {
21 Object **array;
Hisham Muhammad00b324b2012-12-05 15:12:20 +000022 ObjectClass* type;
Hisham Muhammada853faa2006-05-30 13:45:40 +000023 int arraySize;
24 int growthRate;
25 int items;
Hisham Muhammada853faa2006-05-30 13:45:40 +000026 bool owner;
27} Vector;
28
29
Hisham Muhammad00b324b2012-12-05 15:12:20 +000030Vector* Vector_new(ObjectClass* type, bool owner, int size);
Hisham Muhammada853faa2006-05-30 13:45:40 +000031
32void Vector_delete(Vector* this);
Hisham Muhammad5d48ab82006-07-11 06:13:32 +000033
34#ifdef DEBUG
35
Hisham Muhammad36848492006-11-12 21:52:14 +000036int Vector_count(Vector* this);
37
Hisham Muhammad5d48ab82006-07-11 06:13:32 +000038#endif
Hisham Muhammada853faa2006-05-30 13:45:40 +000039
40void Vector_prune(Vector* this);
41
Hisham Muhammad7ca10812011-11-18 06:08:56 +000042// If I were to use only one sorting algorithm for both cases, it would probably be this one:
43/*
44
45*/
46
47void Vector_quickSort(Vector* this);
48
49void Vector_insertionSort(Vector* this);
Hisham Muhammada853faa2006-05-30 13:45:40 +000050
Hisham Muhammad02a30bf2010-02-25 01:43:18 +000051void Vector_insert(Vector* this, int idx, void* data_);
Hisham Muhammada853faa2006-05-30 13:45:40 +000052
Hisham Muhammad02a30bf2010-02-25 01:43:18 +000053Object* Vector_take(Vector* this, int idx);
Hisham Muhammada853faa2006-05-30 13:45:40 +000054
Hisham Muhammad02a30bf2010-02-25 01:43:18 +000055Object* Vector_remove(Vector* this, int idx);
Hisham Muhammada853faa2006-05-30 13:45:40 +000056
Hisham Muhammad02a30bf2010-02-25 01:43:18 +000057void Vector_moveUp(Vector* this, int idx);
Hisham Muhammada853faa2006-05-30 13:45:40 +000058
Hisham Muhammad02a30bf2010-02-25 01:43:18 +000059void Vector_moveDown(Vector* this, int idx);
Hisham Muhammada853faa2006-05-30 13:45:40 +000060
Hisham Muhammad02a30bf2010-02-25 01:43:18 +000061void Vector_set(Vector* this, int idx, void* data_);
Hisham Muhammada853faa2006-05-30 13:45:40 +000062
Hisham Muhammad7ca10812011-11-18 06:08:56 +000063#ifdef DEBUG
64
Hisham Muhammad02a30bf2010-02-25 01:43:18 +000065extern Object* Vector_get(Vector* this, int idx);
Hisham Muhammada853faa2006-05-30 13:45:40 +000066
Hisham Muhammad7ca10812011-11-18 06:08:56 +000067#else
68
69#define Vector_get(v_, idx_) ((v_)->array[idx_])
70
71#endif
72
Hisham Muhammade685bde2007-08-10 05:59:36 +000073extern int Vector_size(Vector* this);
Hisham Muhammada853faa2006-05-30 13:45:40 +000074
Hisham Muhammadda23c8c2008-03-09 08:58:38 +000075/*
76
77*/
Hisham Muhammada853faa2006-05-30 13:45:40 +000078
79void Vector_add(Vector* this, void* data_);
80
Hisham Muhammade685bde2007-08-10 05:59:36 +000081extern int Vector_indexOf(Vector* this, void* search_, Object_Compare compare);
Hisham Muhammada853faa2006-05-30 13:45:40 +000082
83#endif