INGOR
Loading...
Searching...
No Matches
ytStrArray.h
1/*
2 ytStrArray.{h,c} : Expanable char * 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_STR_ARRAY_H
10#define __YTLIB_STR_ARRAY_H
11
12#include <stdio.h>
13#include <stdlib.h>
14
15#include "lang/ytObject.h"
16
17#define ytStrArray_ERROR_VALUE ((size_t) -1)
18
23/*typedef struct ytStrArray_t ytStrArray;*/
24#ifndef DOXY
25typedef struct ytStrArray_t {
26 ytObject obj;
27 char * * ptr;
28 size_t size;
29 size_t buff_size;
31#endif
32
33#ifdef YTLIB_MEMCHECK
34#define ytStrArray_new() ytStrArray_newm(__FILE__,__LINE__)
35ytStrArray * ytStrArray_newm(const char * file, int line);
36#else
37ytStrArray * ytStrArray_new();
38#endif
39void ytStrArray_delete(ytStrArray * this);
40void ytStrArray_deletev(void * this);
41void ytStrArray_deleteAll(ytStrArray * this);
42void ytStrArray_deleteAllv(void * this);
43ytStrArray * ytStrArray_clone(const ytStrArray * this);
44ytObject * ytStrArray_cloneI(const ytObject * this);
45ytStrArray * ytStrArray_arrayNew(size_t size);
46void ytStrArray_arrayDelete(ytStrArray * this, size_t size);
47void ytStrArray_dump(const ytStrArray * this, FILE * fp);
48void ytStrArray_dumpv(const ytObject * this, FILE * fp);
49size_t ytStrArray_size(const ytStrArray * this);
50size_t ytStrArray_buffSize(const ytStrArray * this);
51size_t ytStrArray_memSize(const ytStrArray * this);
52size_t ytStrArray_arrayMemSize(const ytStrArray * this, size_t n);
53void ytStrArray_clear(ytStrArray * this);
54ytStrArray * ytStrArray_setBuffSize(ytStrArray * this, size_t new_size);
55void ytStrArray_add(ytStrArray * this, char * value);
56void ytStrArray_addStrArray(ytStrArray * this, const ytStrArray * values);
57void ytStrArray_set(ytStrArray * this, size_t index, char * value);
58void ytStrArray_setSize(ytStrArray * this, size_t size);
59void ytStrArray_insert(ytStrArray * this, size_t index, char * value);
60char * ytStrArray_remove(ytStrArray * this, size_t index);
61void ytStrArray_copy(ytStrArray * this, const ytStrArray * src);
62void ytStrArray_copyArray(ytStrArray * this, size_t index, const char * * array, size_t size);
63char * ytStrArray_get(const ytStrArray * this, size_t index);
64char * ytStrArray_pop(ytStrArray * this);
65char * * ytStrArray_ptr(ytStrArray * this);
66void ytStrArray_sort(ytStrArray * this);
67size_t ytStrArray_find(const ytStrArray * this, const char * v);
68void ytStrArray_print(const ytStrArray * this, FILE * fp, char * delim);
69int ytStrArray_sprint(const ytStrArray * this, char * buff, size_t size, char * delim);
70ytObject * ytStrArray_obj(ytStrArray * this);
71ytObject * ytStrArray_pObj(ytStrArray ** ptr);
72ytStrArray * ytStrArray_from(ytObject * this);
73ytStrArray ** ytStrArray_objP(ytObject * this);
74size_t ytStrArray_memorySize(const ytStrArray * this);
75size_t ytStrArray_memorySizeI(const ytObject * this);
76ytByte * ytStrArray_serializeI(const ytObject * obj, ytByte ** pptr);
77ytByte * ytStrArray_serialize(const ytStrArray * this, ytByte ** pptr);
78ytStrArray * ytStrArray_deserialize(ytByte ** const pptr);
79ytObject * ytStrArray_deserializeI(ytByte ** const ptr);
80#ifdef USE_MPI
81#include <mpi.h>
82void ytStrArray_MPI_Bcast(ytStrArray ** pObj, int root, MPI_Comm comm);
83void ytStrArray_MPI_BcastI(ytObject ** pObject, int root, MPI_Comm comm);
84#endif
85
86#endif /* __YTLIB_STR_ARRAY_H */
The basis class.
Expandable array.