DynamicByteArray.h 932 字节
Newer Older
A
Alex Duan 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
/**
 *  @file DynamicByteArray.h
 *  @author Sheng Di
 *  @date April, 2016
 *  @brief Header file for Dynamic Byte Array.
 *  (C) 2016 by Mathematics and Computer Science (MCS), Argonne National Laboratory.
 *      See COPYRIGHT in top-level directory.
 */

#ifndef _DynamicByteArray_H
#define _DynamicByteArray_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdio.h>
typedef struct DynamicByteArray
{	
	unsigned char* array;
	size_t size;
	size_t capacity;
} DynamicByteArray;

void new_DBA(DynamicByteArray **dba, size_t cap);
void convertDBAtoBytes(DynamicByteArray *dba, unsigned char** bytes);
void free_DBA(DynamicByteArray *dba);
unsigned char getDBA_Data(DynamicByteArray *dba, size_t pos);
void addDBA_Data(DynamicByteArray *dba, unsigned char value);
void memcpyDBA_Data(DynamicByteArray *dba, unsigned char* data, size_t length);

#ifdef __cplusplus
}
#endif

#endif /* ----- #ifndef _DynamicByteArray_H  ----- */