Skip to content

Commit

Permalink
20540: Removes all non-JSON label appender/setter/getters, MAJOR (#150)
Browse files Browse the repository at this point in the history
Removed from the AmalgamAPI, and the EntityExternalInterface
  • Loading branch information
cademack authored Jun 13, 2024
1 parent ba637e9 commit 3efc0c3
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 612 deletions.
21 changes: 0 additions & 21 deletions src/Amalgam/Amalgam.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,27 +54,6 @@ extern "C"
//sets num_entities to the number of entities and allocates an array of string pointers for the handles loaded
AMALGAM_EXPORT char **GetEntities(uint64_t *num_entities);

AMALGAM_EXPORT double GetNumberValue(char *handle, char *label);
AMALGAM_EXPORT void AppendNumberValue(char *handle, char *label, double value);
AMALGAM_EXPORT void SetNumberValue(char *handle, char *label, double value);

AMALGAM_EXPORT void AppendStringValue(char *handle, char *label, char *value);
AMALGAM_EXPORT void SetStringValue(char *handle, char *label, char *value);

AMALGAM_EXPORT double *GetNumberListPtr(char *handle, char *label);
AMALGAM_EXPORT size_t GetNumberListLength(char *handle, char *label);
AMALGAM_EXPORT void GetNumberList(char *handle, char *label, double *out_list);
AMALGAM_EXPORT void AppendNumberList(char *handle, char *label, double *list, size_t len);
AMALGAM_EXPORT void SetNumberList(char *handle, char *label, double *list, size_t len);

// IMPORTANT: GetStringList assumes that the char ** array is unallocated
// If there are allocated char *s inside, they will become inacessable and be a memory leak.
AMALGAM_EXPORT size_t GetStringListLength(char *handle, char *label);
AMALGAM_EXPORT wchar_t **GetStringListPtrWide(char *handle, char *label);
AMALGAM_EXPORT char **GetStringListPtr(char *handle, char *label);
AMALGAM_EXPORT void AppendStringList(char *handle, char *label, char **list, size_t len);
AMALGAM_EXPORT void SetStringList(char *handle, char *label, char **list, size_t len);

AMALGAM_EXPORT void SetJSONToLabel(char *handle, char *label, char *json);

AMALGAM_EXPORT wchar_t *GetJSONPtrFromLabelWide(char *handle, char *label);
Expand Down
204 changes: 0 additions & 204 deletions src/Amalgam/AmalgamAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,210 +238,6 @@ extern "C"
return return_entities;
}

// ************************************
// get, set, and append numbers
// ************************************

double GetNumberValue(char *handle, char *label)
{
std::string h(handle);
std::string l(label);

return entint.GetNumber(h, l);
}

void AppendNumberValue(char *handle, char *label, double value)
{
std::string h(handle);
std::string l(label);

entint.AppendToLabel(h, l, value);
}

void SetNumberValue(char *handle, char *label, double value)
{
std::string h(handle);
std::string l(label);

entint.SetLabel(h, l, value);
}

void AppendStringValue(char *handle, char *label, char *value)
{
std::string h(handle);
std::string l(label);
std::string v(value);

entint.AppendToLabel(h, l, v);
}

void SetStringValue(char *handle, char *label, char *value)
{
std::string h(handle);
std::string l(label);
std::string v(value);

entint.SetLabel(h, l, v);
}

void AppendNumberList(char *handle, char *label, double *list, size_t len)
{
std::string h(handle);
std::string l(label);

for(size_t i = 0; i < len; i++)
{
entint.AppendToLabel(h, l, list[i]);
}
}

void SetNumberList(char *handle, char *label, double *list, size_t len)
{
std::string h(handle);
std::string l(label);

entint.SetNumberList(h, l, list, len);
}

void SetNumberMatrix(char *handle, char *label, double *list, size_t rows, size_t columns)
{
std::string h(handle);
std::string l(label);

entint.SetNumberMatrix(h, l, list, rows, columns);
}

size_t GetNumberListLength(char *handle, char *label)
{
std::string h(handle);
std::string l(label);

return entint.GetNumberListLength(h, l);
}

size_t GetNumberMatrixWidth(char *handle, char *label)
{
std::string h(handle);
std::string l(label);

return entint.GetNumberMatrixWidth(h, l);
}

size_t GetNumberMatrixHeight(char *handle, char *label)
{
std::string h(handle);
std::string l(label);

return entint.GetNumberMatrixHeight(h, l);
}

double *GetNumberListPtr(char *handle, char *label)
{
std::string h(handle);
std::string l(label);

size_t len = GetNumberListLength(handle, label);

double *ret = new double[len];

entint.GetNumberList(h, l, ret, len);
return ret;
}

double *GetNumberMatrixPtr(char *handle, char *label)
{
std::string h(handle);
std::string l(label);

size_t width = GetNumberMatrixWidth(handle, label);
size_t height = GetNumberMatrixHeight(handle, label);

double *ret = new double[width*height];

entint.GetNumberMatrix(h, l, ret, width, height);
return ret;
}

void GetNumberList(char *handle, char *label, double *out_list)
{
std::string h(handle);
std::string l(label);

size_t len = GetNumberListLength(handle, label);

entint.GetNumberList(h, l, out_list, len);
}

void AppendStringList(char *handle, char *label, char **list, size_t len)
{
std::string h(handle);
std::string l(label);

for(size_t i = 0; i < len; i++)
{
std::string to_append(list[i]);
entint.AppendToLabel(h, l, to_append);
}
}

void SetStringList(char *handle, char *label, char **list, size_t len)
{
std::string h(handle);
std::string l(label);

entint.SetStringList(h, l, list, len);
}

size_t GetStringListLength(char *handle, char *label)
{
std::string h(handle);
std::string l(label);

return entint.GetStringListLength(h, l);
}

// IMPORTANT: GetStringList assumes that the char ** array is unallocated
// If there are allocated char *s inside, they will become inacessable and be a memory leak.
wchar_t **GetStringListPtrWide(char *handle, char *label)
{
std::string h(handle);
std::string l(label);

size_t len = GetStringListLength(handle, label);

std::string *str_list = new std::string[len];

entint.GetStringList(h, l, str_list, len);

wchar_t **wct = new wchar_t *[len];
for(size_t i = 0; i < len; i++)
{
wct[i] = StringToWCharPtr(str_list[i]);
}

return wct;
}

// IMPORTANT: GetStringList assumes that the char ** array is unallocated
// If there are allocated char *s inside, they will become inacessable and be a memory leak.
char **GetStringListPtr(char *handle, char *label)
{
std::string h(handle);
std::string l(label);

size_t len = GetStringListLength(handle, label);

std::string *str_list = new std::string[len];

entint.GetStringList(h, l, str_list, len);

char **ct = new char *[len];
for(size_t i = 0; i < len; i++)
ct[i] = StringToCharPtr(str_list[i]);

return ct;
}

void DeleteString(char *p)
{
delete[] p;
Expand Down
Loading

0 comments on commit 3efc0c3

Please sign in to comment.