36#ifndef __YTLIB__ARRAY_H
37#define __YTLIB__ARRAY_H
42#include "lang/ytObject.h"
44#define ytArray_ERROR_VALUE ((size_t) -1)
52typedef struct ytArray_t {
61#define ytArray_new() ytArray_newm(__FILE__,__LINE__)
62ytArray * ytArray_newm(
const char * file,
int line);
66void ytArray_delete(
ytArray *
this);
67void ytArray_deletev(
void *
this);
69void ytArray_deleteAllv(
void *
this);
74void ytArray_dump(
const ytArray *
this, FILE * fp);
75void ytArray_dumpv(
const ytObject *
this, FILE * fp);
76size_t ytArray_size(
const ytArray *
this);
96int ytArray_sprint(
const ytArray *
this,
char * buff,
size_t size,
char * delim);
101size_t ytArray_memorySize(
const ytArray *
this);
102size_t ytArray_memorySizeI(
const ytObject *
this);
103ytByte * ytArray_serializeI(
const ytObject * obj, ytByte ** pptr);
104ytByte * ytArray_serialize(
const ytArray *
this, ytByte ** pptr);
105ytArray * ytArray_deserialize(ytByte **
const pptr);
106ytObject * ytArray_deserializeI(ytByte **
const ptr);
110void ytArray_MPI_BcastI(
ytObject ** pObject,
int root, MPI_Comm comm);
void ytArray_print(const ytArray *this, FILE *fp, char *delim)
Prints the elements in the array.
Definition: ytArray.c:480
void ytArray_MPI_Bcast(ytArray **pObject, int root, MPI_Comm comm)
Broadcasts the array with MPI.
Definition: ytArray.c:648
size_t ytArray_memSize(const ytArray *this)
Returns the size of memory where the specified instance occupies.
Definition: ytArray.c:258
ytArray * ytArray_clone(const ytArray *this)
Returns the clone of this ytArray instance.
Definition: ytArray.c:138
ytArray * ytArray_arrayNew(size_t size)
Creates the array of ytArray instances.
Definition: ytArray.c:180
void ytArray_arrayDelete(ytArray *this, size_t size)
Deletes the array of ytArray instances.
Definition: ytArray.c:197
ytArray * ytArray_setBuffSize(ytArray *this, size_t new_size)
Changes the size of buffer.
Definition: ytArray.c:239
size_t ytArray_buffSize(const ytArray *this)
Returns the current buffer size allocated.
Definition: ytArray.c:227
void ytArray_insert(ytArray *this, size_t index, ytObject *value)
Inserts a value at the specified position.
Definition: ytArray.c:369
ytArray * ytArray_new()
Creates a new ytArray instance.
Definition: ytArray.c:84
void ytArray_clear(ytArray *this)
Removes all the elements in the array.
Definition: ytArray.c:280
void ytArray_add(ytArray *this, ytObject *value)
Adds a value.
Definition: ytArray.c:288
void ytArray_setSize(ytArray *this, size_t size)
Changes the size of the array.
Definition: ytArray.c:357
void ytArray_set(ytArray *this, size_t index, ytObject *value)
Sets a value at the specified position.
Definition: ytArray.c:323
void ytArray_copyArray(ytArray *this, size_t index, const ytObject **array, size_t size)
Copies values in an array into this array.
Definition: ytArray.c:418
size_t ytArray_find(const ytArray *this, const ytObject *v)
Returns the index of the value identical to the given one.
Definition: ytArray.c:466
void ytArray_deleteAll(ytArray *this)
Releases the array and all the elements in the array.
Definition: ytArray.c:114
ytObject * ytArray_pop(ytArray *this)
Returns the last element.
Definition: ytArray.c:440
ytObject * ytArray_cloneI(const ytObject *this)
Returns the clone of this ytArray instance.
Definition: ytArray.c:153
void ytArray_copy(ytArray *this, const ytArray *src)
Copies values in another array into this.
Definition: ytArray.c:404
size_t ytArray_arrayMemSize(const ytArray *this, size_t n)
Returns the total size of memory used by the array of the array.
Definition: ytArray.c:266
ytObject * ytArray_remove(ytArray *this, size_t index)
Definition: ytArray.c:392
void ytArray_sort(ytArray *this)
Sorts the elements in ascending order.
Definition: ytArray.c:457