INGOR
Loading...
Searching...
No Matches
ytDoubleArray.h
1/*
2 ytDoubleArray.{h,c} : Expanable double Array
3 Copyright (C) 2016, Yoshinori Tamada <tamada A T ytlab.jp>
4 All rights reserved.
5
6 See LICENSE.txt for details of the licensing agreement.
7*/
8
9#ifndef __YTLIB_DOUBLE_ARRAY_H
10#define __YTLIB_DOUBLE_ARRAY_H
11
12#include <stdio.h>
13#include <stdlib.h>
14
15#include "lang/ytObject.h"
16
17#define ytDoubleArray_ERROR_VALUE ((size_t) -1)
18
23/*typedef struct ytDoubleArray_t ytDoubleArray;*/
24#ifndef DOXY
25typedef struct ytDoubleArray_t {
26 ytObject obj;
27 double * ptr;
28 size_t size;
29 size_t buff_size;
31#endif
32
33#ifdef YTLIB_MEMCHECK
34#define ytDoubleArray_new() ytDoubleArray_newm(__FILE__,__LINE__)
35ytDoubleArray * ytDoubleArray_newm(const char * file, int line);
36#else
37ytDoubleArray * ytDoubleArray_new();
38#endif
39void ytDoubleArray_delete(ytDoubleArray * this);
40void ytDoubleArray_deletev(void * this);
41void ytDoubleArray_deleteAll(ytDoubleArray * this);
42void ytDoubleArray_deleteAllv(void * this);
43ytDoubleArray * ytDoubleArray_clone(const ytDoubleArray * this);
44ytObject * ytDoubleArray_cloneI(const ytObject * this);
45ytDoubleArray * ytDoubleArray_arrayNew(size_t size);
46void ytDoubleArray_arrayDelete(ytDoubleArray * this, size_t size);
47void ytDoubleArray_dump(const ytDoubleArray * this, FILE * fp);
48void ytDoubleArray_dumpv(const ytObject * this, FILE * fp);
49size_t ytDoubleArray_size(const ytDoubleArray * this);
50size_t ytDoubleArray_buffSize(const ytDoubleArray * this);
51size_t ytDoubleArray_memSize(const ytDoubleArray * this);
52size_t ytDoubleArray_arrayMemSize(const ytDoubleArray * this, size_t n);
53void ytDoubleArray_clear(ytDoubleArray * this);
54ytDoubleArray * ytDoubleArray_setBuffSize(ytDoubleArray * this, size_t new_size);
55void ytDoubleArray_add(ytDoubleArray * this, double value);
56void ytDoubleArray_addDoubleArray(ytDoubleArray * this, const ytDoubleArray * values);
57void ytDoubleArray_set(ytDoubleArray * this, size_t index, double value);
58void ytDoubleArray_setSize(ytDoubleArray * this, size_t size);
59void ytDoubleArray_insert(ytDoubleArray * this, size_t index, double value);
60double ytDoubleArray_remove(ytDoubleArray * this, size_t index);
61void ytDoubleArray_copy(ytDoubleArray * this, const ytDoubleArray * src);
62void ytDoubleArray_copyArray(ytDoubleArray * this, size_t index, const double * array, size_t size);
63double ytDoubleArray_get(const ytDoubleArray * this, size_t index);
64double ytDoubleArray_pop(ytDoubleArray * this);
65double * ytDoubleArray_ptr(ytDoubleArray * this);
66void ytDoubleArray_sort(ytDoubleArray * this);
67size_t ytDoubleArray_find(const ytDoubleArray * this, const double v);
68void ytDoubleArray_print(const ytDoubleArray * this, FILE * fp, char * delim);
69int ytDoubleArray_sprint(const ytDoubleArray * this, char * buff, size_t size, char * delim);
70ytObject * ytDoubleArray_obj(ytDoubleArray * this);
71ytObject * ytDoubleArray_pObj(ytDoubleArray ** ptr);
72ytDoubleArray * ytDoubleArray_from(ytObject * this);
73ytDoubleArray ** ytDoubleArray_objP(ytObject * this);
74size_t ytDoubleArray_memorySize(const ytDoubleArray * this);
75size_t ytDoubleArray_memorySizeI(const ytObject * this);
76ytByte * ytDoubleArray_serializeI(const ytObject * obj, ytByte ** pptr);
77ytByte * ytDoubleArray_serialize(const ytDoubleArray * this, ytByte ** pptr);
78ytDoubleArray * ytDoubleArray_deserialize(ytByte ** const pptr);
79ytObject * ytDoubleArray_deserializeI(ytByte ** const ptr);
80#ifdef USE_MPI
81#include <mpi.h>
82void ytDoubleArray_MPI_Bcast(ytDoubleArray ** pObj, int root, MPI_Comm comm);
83void ytDoubleArray_MPI_BcastI(ytObject ** pObject, int root, MPI_Comm comm);
84#endif
85
86#endif /* __YTLIB_DOUBLE_ARRAY_H */
Expandable array.
The basis class.