Loading...
Searching...
No Matches
handler.h File Reference
`#include "arc/std/bool.h"`
`#include <stdint.h>`

Go to the source code of this file.

## Typedefs

typedef struct ARC_Handler | ARC_Handler
| a handler type
typedef ARC_Bool(* | ARC_Handler_CompareDataFn) (void *a, void *b)
| data comparison function ptr
typedef void(* | ARC_Handler_DataFn) (void *data)
| a function that will take iterated data
typedef void(* | ARC_Handler_CleanDataFn) (void *data)
| a function that will be used during destruction of trash vector

## Functions

void | ARC_Handler_Create (ARC_Handler **handler, ARC_Handler_CompareDataFn *compareFn, ARC_Handler_CleanDataFn cleanFn)
| creates ARC_Handler type
void | ARC_Handler_Destroy (ARC_Handler *handler)
| destroyes ARC_Handler type
void | ARC_Handler_Add (ARC_Handler *handler, void *data)
| adds data to handler
void | ARC_Handler_Remove (ARC_Handler *handler, void *data)
| remove from handler
void | ARC_Handler_RemoveIndex (ARC_Handler *handler, uint32_t index)
| remove from handler
void | ARC_Handler_Iterate (ARC_Handler *handler, ARC_Handler_DataFn datafn)
| calls provided function on each element in handler
void | ARC_Handler_Clear (ARC_Handler *handler)
| clears all data from handler and puts it in trash vector
void | ARC_Handler_Clean (ARC_Handler *handler)
| clears trash from handler
uint32_t | ARC_Handler_GetSize (ARC_Handler *handler)
| gets size of vector

## Typedef Documentation

## ARC_Handler

typedef struct ARC_Handler ARC_Handler

a handler type

Definition at line 14 of file handler.h.

## ARC_Handler_CleanDataFn

typedef void(* ARC_Handler_CleanDataFn) (void *data)

a function that will be used during destruction of trash vector

Parameters

  data | data that is being destroyed from trash

Definition at line 40 of file handler.h.

## ARC_Handler_CompareDataFn

typedef ARC_Bool(* ARC_Handler_CompareDataFn) (void *a, void *b)

data comparison function ptr

Note
  this is used for comparison within vectors

Parameters

  a | first data struct
  b | second data struct

Returns
  0 when a == b

Definition at line 26 of file handler.h.

## ARC_Handler_DataFn

typedef void(* ARC_Handler_DataFn) (void *data)

a function that will take iterated data

Parameters

  data | iterated data from ARC_Handler_Iterate

Definition at line 33 of file handler.h.

## Function Documentation

## ARC_Handler_Add()

void ARC_Handler_Add | ( | ARC_Handler * | handler,
|  | void * | data )

adds data to handler

Parameters

  handler | ARC_Handler to add to
  data | data that is being added

## ARC_Handler_Clean()

void ARC_Handler_Clean | ( | ARC_Handler * | handler | ) |

clears trash from handler

Note
  cleanfn's main purpose is to help manage memory

Parameters

  handler | ARC_Handler to remove trash from

## ARC_Handler_Clear()

void ARC_Handler_Clear | ( | ARC_Handler * | handler | ) |

clears all data from handler and puts it in trash vector

Parameters

  handler | ARC_Handler to clear data from

## ARC_Handler_Create()

void ARC_Handler_Create | ( | ARC_Handler ** | handler,
|  | ARC_Handler_CompareDataFn * | compareFn,
|  | ARC_Handler_CleanDataFn | cleanFn )

creates ARC_Handler type

Parameters

  config | ARC_Handler to initialize
  compareFn | function to remove handler data
  cleanFn | function to clean data in handler can be null

## ARC_Handler_Destroy()

void ARC_Handler_Destroy | ( | ARC_Handler * | handler | ) |

destroyes ARC_Handler type

Parameters

  handler | ARC_Handler to destory

## ARC_Handler_GetSize()

uint32_t ARC_Handler_GetSize | ( | ARC_Handler * | handler | ) |

gets size of vector

Parameters

  handler | ARC_handler to get size from

## ARC_Handler_Iterate()

void ARC_Handler_Iterate | ( | ARC_Handler * | handler,
|  | ARC_Handler_DataFn | datafn )

calls provided function on each element in handler

Parameters

  handler | ARC_Handler to iterate through
  datafn | function that will be called on each element of data

## ARC_Handler_Remove()

void ARC_Handler_Remove | ( | ARC_Handler * | handler,
|  | void * | data )

remove from handler

Note
  the data that is removed is stored in a trash vector the ARC_Handler_Clean function must be called clean the trash vector the trash vector is to make sure a state is not deleted while being run

Parameters

  handler | ARC_Handler to remove from
  data | data that is being removed

## ARC_Handler_RemoveIndex()

void ARC_Handler_RemoveIndex | ( | ARC_Handler * | handler,
|  | uint32_t | index )

remove from handler

Note
  the data that is removed is stored in a trash vector the ARC_Handler_Clean function must be called clean the trash vector the trash vector is to make sure a state is not deleted while being run

Parameters

  handler | ARC_Handler to remove from
  index | index of data that is being removed