Accelerator Independent Data Access / PVAccess 2.0
AIDA-PVA is the latest version of the AIDA framework. Built on top of EPICS 7 it enables client applications to programmatically access and manage any device or database on the SLAC Network using simple channel names.
|
The Header File for the memory management functions and macros. More...
#include "aida_pva.h"
Go to the source code of this file.
Macros | |
#define | ALLOCATE_AND_COPY_MEMORY(_env, _source, _size, _purpose) allocateMemory(_env, _source, _size, false, "Could not allocate space for " _purpose) |
Allocate memory and set its contents to the given buffer of given size. More... | |
#define | ALLOCATE_AND_TRACK_FIXED_LENGTH_STRING_AND_ON_ERROR_RETURN_(_env, _var, _string, _size, _purpose, _r) |
Allocate space for a fixed length string and copy date from the given string into the newly allocated space. More... | |
#define | ALLOCATE_AND_TRACK_MEMORY_AND_ON_ERROR_RETURN_(_env, _var, _size, _purpose, _r) |
Allocate memory and add it to the tracked memory list so that it can be freed automatically later. More... | |
#define | ALLOCATE_COPY_AND_TRACK_MEMORY_AND_ON_ERROR_RETURN_(_env, _var, _source, _size, _purpose, _r) |
Allocate memory and set its contents to the given buffer of given size. More... | |
#define | ALLOCATE_COPY_AND_TRACK_STRING_AND_ON_ERROR_RETURN_(_env, _var, _string, _purpose, _r) |
Allocate and track a string. More... | |
#define | ALLOCATE_FIXED_LENGTH_STRING(_env, _string, _size, _purpose) allocateMemory(_env, _string, _size, true, "Could not allocate space for " _purpose) |
Allocate space for a fixed length string and copy data from the given string into the newly allocated space. More... | |
#define | ALLOCATE_FIXED_LENGTH_STRING_AND_ON_ERROR_RETURN_VOID(_env, _var, _string, _size, _purpose) |
Allocate space for a fixed length string and copy date from the given string into the newly allocated space. More... | |
#define | ALLOCATE_MEMORY(_env, _size, _purpose) allocateMemory(_env, NULL, _size, false, "Could not allocate space for " _purpose) |
Allocate memory. More... | |
#define | ALLOCATE_MEMORY_AND_ON_ERROR_RETURN_(_env, _var, _size, _purpose, _r) |
Allocate memory and on error return the given value. More... | |
#define | ALLOCATE_STRING(_env, _string, _purpose) ALLOCATE_AND_COPY_MEMORY(_env, _string, strlen(_string)+1, _purpose) |
Allocate memory for a string and copy the given string into this allocated space. More... | |
#define | ALLOCATE_STRING_AND_ON_ERROR_RETURN_(_env, _var, _string, _purpose, _r) |
Allocate memory for a string and copy the given string into this allocated space. More... | |
#define | ALLOCATE_STRING_AND_ON_ERROR_RETURN_VOID(_env, _var, _string, _purpose) |
Allocate memory for a string and copy the given string into this allocated space The specified variable is set to point to the allocated memory The given purpose is a string that will be contained in the error message if the allocation fails. More... | |
#define | FREE_JSON |
Free any allocated json memory. More... | |
#define | FREE_MEMORY |
Free any allocated memory. More... | |
#define | FREE_TRACKED_MEMORY(_ptr) |
Free a single tracked memory allocation and remove from list. More... | |
#define | MAX_POINTERS 100 |
The maximum number of pointers that the Memory tracking and management functions can handle. More... | |
#define | TRACK_ALLOCATED_MEMORY |
Create tracking variables so that memory can be freed with FREE_MEMORY macro. More... | |
#define | TRACK_JSON(_ptr) if (_ptr) _jsonValuesToFree[_n_jsonValuesToFree++] = (_ptr); |
Register this newly allocated json value so that it will be freed by FREE_JSON_MEMORY. More... | |
#define | TRACK_MEMORY(_ptr) if (_ptr) _memoryAllocationsToFree[_nAllocationsToFree++] = (_ptr); |
Register this newly allocated memory so that it will be freed by FREE_MEMORY. More... | |
The Header File for the memory management functions and macros.
CMS=C_INC
Definition in file aida_pva_memory.h.
#define ALLOCATE_AND_COPY_MEMORY | ( | _env, | |
_source, | |||
_size, | |||
_purpose | |||
) | allocateMemory(_env, _source, _size, false, "Could not allocate space for " _purpose) |
Allocate memory and set its contents to the given buffer of given size.
_env | The JNI environment. Used in all functions involving JNI |
_source | buffer to copy contents from |
_size | size of memory to allocate |
_purpose | the given purpose is a string that will be contained in the error message if the allocation fails |
Definition at line 59 of file aida_pva_memory.h.
#define ALLOCATE_AND_TRACK_FIXED_LENGTH_STRING_AND_ON_ERROR_RETURN_ | ( | _env, | |
_var, | |||
_string, | |||
_size, | |||
_purpose, | |||
_r | |||
) |
Allocate space for a fixed length string and copy date from the given string into the newly allocated space.
You need to specify size as one bigger than the fixed length string so that it can be null terminated
_env | The JNI environment. Used in all functions involving JNI |
_var | the specified variable is set to point to the allocated memory |
_string | buffer to copy contents from |
_size | size of memory to allocate |
_purpose | the given purpose is a string that will be contained in the error message if the allocation fails |
_r | the specified return value |
Definition at line 160 of file aida_pva_memory.h.
#define ALLOCATE_AND_TRACK_MEMORY_AND_ON_ERROR_RETURN_ | ( | _env, | |
_var, | |||
_size, | |||
_purpose, | |||
_r | |||
) |
Allocate memory and add it to the tracked memory list so that it can be freed automatically later.
_env | The JNI environment. Used in all functions involving JNI |
_var | the specified variable is set to point to the allocated memory |
_size | size of memory to allocate |
_purpose | the given purpose is a string that will be contained in the error message if the allocation fails |
_r | the specified return value |
Definition at line 181 of file aida_pva_memory.h.
#define ALLOCATE_COPY_AND_TRACK_MEMORY_AND_ON_ERROR_RETURN_ | ( | _env, | |
_var, | |||
_source, | |||
_size, | |||
_purpose, | |||
_r | |||
) |
Allocate memory and set its contents to the given buffer of given size.
_env | The JNI environment. Used in all functions involving JNI |
_var | the specified variable is set to point to the allocated memory |
_source | buffer to copy contents from |
_size | size of memory to allocate |
_purpose | the given purpose is a string that will be contained in the error message if the allocation fails |
_r | the specified return value |
Definition at line 203 of file aida_pva_memory.h.
#define ALLOCATE_COPY_AND_TRACK_STRING_AND_ON_ERROR_RETURN_ | ( | _env, | |
_var, | |||
_string, | |||
_purpose, | |||
_r | |||
) |
Allocate and track a string.
_env | The JNI environment. Used in all functions involving JNI |
_var | the specified variable is set to point to the allocated memory |
_string | buffer to copy contents from |
_purpose | the given purpose is a string that will be contained in the error message if the allocation fails |
_r | the specified return value |
Definition at line 224 of file aida_pva_memory.h.
#define ALLOCATE_FIXED_LENGTH_STRING | ( | _env, | |
_string, | |||
_size, | |||
_purpose | |||
) | allocateMemory(_env, _string, _size, true, "Could not allocate space for " _purpose) |
Allocate space for a fixed length string and copy data from the given string into the newly allocated space.
You need to specify size as one bigger than the fixed length string so that it can be null terminated
_env | The JNI environment. Used in all functions involving JNI |
_string | buffer to copy contents from |
_size | size of memory to allocate |
_purpose | the given purpose is a string that will be contained in the error message if the allocation fails |
Definition at line 80 of file aida_pva_memory.h.
#define ALLOCATE_FIXED_LENGTH_STRING_AND_ON_ERROR_RETURN_VOID | ( | _env, | |
_var, | |||
_string, | |||
_size, | |||
_purpose | |||
) |
Allocate space for a fixed length string and copy date from the given string into the newly allocated space.
You need to specify size as one bigger than the fixed length string so that it can be null terminated
_env | The JNI environment. Used in all functions involving JNI |
_var | the specified variable is set to point to the allocated memory |
_string | buffer to copy contents from |
_size | size of memory to allocate |
_purpose | the given purpose is a string that will be contained in the error message if the allocation fails |
Definition at line 142 of file aida_pva_memory.h.
#define ALLOCATE_MEMORY | ( | _env, | |
_size, | |||
_purpose | |||
) | allocateMemory(_env, NULL, _size, false, "Could not allocate space for " _purpose) |
Allocate memory.
Allocates memory of the given size
_env | The JNI environment. Used in all functions involving JNI |
_size | size of memory to allocate |
_purpose | the given purpose is a string that will be contained in the error message if the allocation fails |
Definition at line 49 of file aida_pva_memory.h.
#define ALLOCATE_MEMORY_AND_ON_ERROR_RETURN_ | ( | _env, | |
_var, | |||
_size, | |||
_purpose, | |||
_r | |||
) |
Allocate memory and on error return the given value.
_env | The JNI environment. Used in all functions involving JNI |
_var | the specified variable is set to point to the allocated memory |
_size | size of memory to allocate |
_purpose | the given purpose is a string that will be contained in the error message if the allocation fails |
_r | the specified return value |
Definition at line 92 of file aida_pva_memory.h.
#define ALLOCATE_STRING | ( | _env, | |
_string, | |||
_purpose | |||
) | ALLOCATE_AND_COPY_MEMORY(_env, _string, strlen(_string)+1, _purpose) |
Allocate memory for a string and copy the given string into this allocated space.
_env | The JNI environment. Used in all functions involving JNI |
_string | buffer to copy contents from |
_purpose | the given purpose is a string that will be contained in the error message if the allocation fails |
Definition at line 68 of file aida_pva_memory.h.
#define ALLOCATE_STRING_AND_ON_ERROR_RETURN_ | ( | _env, | |
_var, | |||
_string, | |||
_purpose, | |||
_r | |||
) |
Allocate memory for a string and copy the given string into this allocated space.
_env | The JNI environment. Used in all functions involving JNI |
_var | the specified variable is set to point to the allocated memory |
_string | buffer to copy contents from |
_purpose | the given purpose is a string that will be contained in the error message if the allocation fails |
_r | the specified return value |
Definition at line 109 of file aida_pva_memory.h.
#define ALLOCATE_STRING_AND_ON_ERROR_RETURN_VOID | ( | _env, | |
_var, | |||
_string, | |||
_purpose | |||
) |
Allocate memory for a string and copy the given string into this allocated space The specified variable is set to point to the allocated memory The given purpose is a string that will be contained in the error message if the allocation fails.
_env | The JNI environment. Used in all functions involving JNI |
_var | the specified variable is set to point to the allocated memory |
_string | buffer to copy contents from |
_purpose | the given purpose is a string that will be contained in the error message if the allocation fails |
Definition at line 125 of file aida_pva_memory.h.
#define FREE_JSON |
Free any allocated json memory.
Definition at line 238 of file aida_pva_memory.h.
#define FREE_MEMORY |
Free any allocated memory.
Definition at line 249 of file aida_pva_memory.h.
#define FREE_TRACKED_MEMORY | ( | _ptr | ) |
Free a single tracked memory allocation and remove from list.
_ptr | name of a pointer that points to the memory to free |
Definition at line 263 of file aida_pva_memory.h.
#define MAX_POINTERS 100 |
The maximum number of pointers that the Memory tracking and management functions can handle.
Definition at line 16 of file aida_pva_memory.h.
#define TRACK_ALLOCATED_MEMORY |
Create tracking variables so that memory can be freed with FREE_MEMORY macro.
Creates up to MAX_POINTERS pointers to track all memory allocations so that they can be safely freed, when needed. Creates local variables to store the tracking information so these macros can only be used within a single block.
Definition at line 25 of file aida_pva_memory.h.
#define TRACK_JSON | ( | _ptr | ) | if (_ptr) _jsonValuesToFree[_n_jsonValuesToFree++] = (_ptr); |
Register this newly allocated json value so that it will be freed by FREE_JSON_MEMORY.
Definition at line 39 of file aida_pva_memory.h.
#define TRACK_MEMORY | ( | _ptr | ) | if (_ptr) _memoryAllocationsToFree[_nAllocationsToFree++] = (_ptr); |
Register this newly allocated memory so that it will be freed by FREE_MEMORY.
Definition at line 33 of file aida_pva_memory.h.