Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
parameter.h File Reference
#include "uuid_defs.h"
#include "linked_list.h"
#include "grassroots_service_library.h"
#include "data_resource.h"
#include "hash_table.h"
#include "schema_version.h"
#include "parameter_type.h"
#include "remote_parameter_details.h"
#include "jansson.h"
Include dependency graph for parameter.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  NamedParameterType
 This is a datatype that stores a read-only c-style string along with a ParameterType. More...
 
struct  Parameter
 The datatype that stores all of the information about a Parameter. More...
 
struct  ParameterNode
 A datatype for storing Parameters in a LinkedList. More...
 

Macros

#define SET_NAMED_PARAMETER_TYPE_TAGS(a, b)   ({ .npt_name_s = a, .npt_type = b})
 A macro to provide a quick way to set the name and ParameterType for NamedParameterType objects. More...
 

Enumerations

enum  ParameterLevel { PL_SIMPLE, PL_ADVANCED, PL_ALL }
 The ParameterLevel defines the level that a user should be to adjust the Parameter. More...
 

Functions

const PARAMETER_PREFIX char *const PA_TABLE_COLUMN_HEADERS_PLACEMENT_S PARAMETER_VAL ("Column Headers Placement")
 
const PARAMETER_PREFIX char *const PA_TABLE_COLUMN_HEADINGS_S PARAMETER_VAL ("Column Headings")
 
const PARAMETER_PREFIX char *const PA_TABLE_ROW_HEADINGS_S PARAMETER_VAL ("Row Headings")
 
const PARAMETER_PREFIX char *const PA_TABLE_COLUMN_DELIMITER_S PARAMETER_VAL ("Column Delimiter")
 
const PARAMETER_PREFIX char *const PA_TABLE_ADD_COLUMNS_FLAG_S PARAMETER_VAL ("Add User-Definable Columns")
 
const PARAMETER_PREFIX char *const PA_TABLE_ROW_DELIMITER_S PARAMETER_VAL ("Row Delimiter")
 
const PARAMETER_PREFIX char *const PA_TABLE_DEFAULT_COLUMN_DELIMITER_S PARAMETER_VAL (",")
 
const PARAMETER_PREFIX char *const PA_TABLE_DEFAULT_ROW_DELIMITER_S PARAMETER_VAL ("\n")
 
const PARAMETER_PREFIX char *const PA_DOUBLE_PRECISION_S PARAMETER_VAL ("precision")
 
const PARAMETER_PREFIX char *const PA_TYPE_STRING_ARRAY_S PARAMETER_VAL ("string_array")
 
const PARAMETER_PREFIX char *const PA_TYPE_TIME_ARRAY_S PARAMETER_VAL ("time_array")
 
const PARAMETER_PREFIX char *const PA_TYPE_STRING_S PARAMETER_VAL ("string")
 
const PARAMETER_PREFIX char *const PA_TYPE_BOOLEAN_S PARAMETER_VAL ("boolean")
 
const PARAMETER_PREFIX char *const PA_TYPE_INTEGER_S PARAMETER_VAL ("integer")
 
const PARAMETER_PREFIX char *const PA_TYPE_NUMBER_S PARAMETER_VAL ("number")
 
const PARAMETER_PREFIX char *const PA_TYPE_CHARACTER_S PARAMETER_VAL ("character")
 
const PARAMETER_PREFIX char *const PA_TABLE_COLUMN_HEADERS_PLACEMENT_FIRST_ROW_S PARAMETER_VAL ("Column Headers Placement On First Row")
 
bool InitParameterFromJSON (Parameter *param_p, const json_t *const root_p, const struct Service *service_p, const bool concise_flag, const ParameterType *pt_p)
 
bool AddParameterValuesToJSON (const Parameter *param_p, json_t *param_json_p, const bool full_definition_flag)
 
bool CompareParameterLevels (const ParameterLevel param_level, const ParameterLevel threshold)
 Test whether a given ParameterLevel matches or exceeds another. More...
 
bool AddParameterKeyJSONValuePair (Parameter *const parameter_p, const char *key_s, const json_t *value_p)
 
bool AddColumnParameterHint (const char *name_s, const char *description_s, const ParameterType param_type, const bool required_flag, json_t *array_p)
 
const char * GetGrassrootsTypeAsString (const ParameterType param_type)
 Get the human-readable name for a given ParameterType. More...
 
bool GetGrassrootsTypeFromString (const char *param_type_s, ParameterType *param_type_p)
 Get the ParameterType from its human-readable name. More...
 
bool AddParameterLevelToJSON (const ParameterLevel level, json_t *root_p, const SchemaVersion *const sv_p)
 
void SetParameterCallbacks (Parameter *param_p, void(*clear_fn)(Parameter *param_p), bool(*add_values_to_json_fn)(const Parameter *param_p, json_t *param_json_p, const bool full_definition_flag), Parameter *(*clone_fn)(const Parameter *param_p, const struct ServiceData *data_p), bool(*set_value_from_string_fn)(Parameter *param_p, const char *value_s))
 
const json_t * GetParameterFromConfig (const json_t *service_config_p, const char *const param_name_s)
 
bool SetParameterCurrentValueFromJSON (Parameter *param_p, const json_t *value_p)
 
const char * GetNamedParameterDefaultValueFromJSON (const char *id_param_s, const json_t *params_json_p)
 
LinkedListGetParameterStringMultiOptions (Parameter *param_p)
 

Function Documentation

◆ PARAMETER_VAL() [1/17]

const PARAMETER_PREFIX char* const PA_TABLE_COLUMN_HEADERS_PLACEMENT_S PARAMETER_VAL ( "Column Headers Placement"  )

◆ PARAMETER_VAL() [2/17]

const PARAMETER_PREFIX char* const PA_TABLE_COLUMN_HEADINGS_S PARAMETER_VAL ( "Column Headings"  )

◆ PARAMETER_VAL() [3/17]

const PARAMETER_PREFIX char* const PA_TABLE_ROW_HEADINGS_S PARAMETER_VAL ( "Row Headings"  )

◆ PARAMETER_VAL() [4/17]

const PARAMETER_PREFIX char* const PA_TABLE_COLUMN_DELIMITER_S PARAMETER_VAL ( "Column Delimiter"  )

◆ PARAMETER_VAL() [5/17]

const PARAMETER_PREFIX char* const PA_TABLE_ADD_COLUMNS_FLAG_S PARAMETER_VAL ( "Add User-Definable Columns"  )

◆ PARAMETER_VAL() [6/17]

const PARAMETER_PREFIX char* const PA_TABLE_ROW_DELIMITER_S PARAMETER_VAL ( "Row Delimiter"  )

◆ PARAMETER_VAL() [7/17]

const PARAMETER_PREFIX char* const PA_TABLE_DEFAULT_COLUMN_DELIMITER_S PARAMETER_VAL ( ,
 
)

◆ PARAMETER_VAL() [8/17]

const PARAMETER_PREFIX char* const PA_TABLE_DEFAULT_ROW_DELIMITER_S PARAMETER_VAL ( "\n"  )

◆ PARAMETER_VAL() [9/17]

const PARAMETER_PREFIX char* const PA_DOUBLE_PRECISION_S PARAMETER_VAL ( "precision"  )

◆ PARAMETER_VAL() [10/17]

const PARAMETER_PREFIX char* const PA_TYPE_STRING_ARRAY_S PARAMETER_VAL ( "string_array"  )

◆ PARAMETER_VAL() [11/17]

const PARAMETER_PREFIX char* const PA_TYPE_TIME_ARRAY_S PARAMETER_VAL ( "time_array"  )

◆ PARAMETER_VAL() [12/17]

const PARAMETER_PREFIX char* const PA_TYPE_STRING_S PARAMETER_VAL ( "string"  )

◆ PARAMETER_VAL() [13/17]

const PARAMETER_PREFIX char* const PA_TYPE_BOOLEAN_S PARAMETER_VAL ( "boolean"  )

◆ PARAMETER_VAL() [14/17]

const PARAMETER_PREFIX char* const PA_TYPE_INTEGER_S PARAMETER_VAL ( "integer"  )

◆ PARAMETER_VAL() [15/17]

const PARAMETER_PREFIX char* const PA_TYPE_NUMBER_S PARAMETER_VAL ( "number"  )

◆ PARAMETER_VAL() [16/17]

const PARAMETER_PREFIX char* const PA_TYPE_CHARACTER_S PARAMETER_VAL ( "character"  )

◆ PARAMETER_VAL() [17/17]

const PARAMETER_PREFIX char* const PA_TABLE_COLUMN_HEADERS_PLACEMENT_FIRST_ROW_S PARAMETER_VAL ( "Column Headers Placement On First Row )

◆ InitParameterFromJSON()

bool InitParameterFromJSON ( Parameter param_p,
const json_t *const  root_p,
const struct Service service_p,
const bool  concise_flag,
const ParameterType pt_p 
)

◆ AddParameterValuesToJSON()

bool AddParameterValuesToJSON ( const Parameter param_p,
json_t *  param_json_p,
const bool  full_definition_flag 
)

◆ CompareParameterLevels()

bool CompareParameterLevels ( const ParameterLevel  param_level,
const ParameterLevel  threshold 
)

Test whether a given ParameterLevel matches or exceeds another.

Parameters
param_levelThe level to check.
thresholdThe level to check against.
Returns
true if the param_level matched or exceeded the threshold, false otherwise.

◆ AddParameterKeyJSONValuePair()

bool AddParameterKeyJSONValuePair ( Parameter *const  parameter_p,
const char *  key_s,
const json_t *  value_p 
)

◆ AddColumnParameterHint()

bool AddColumnParameterHint ( const char *  name_s,
const char *  description_s,
const ParameterType  param_type,
const bool  required_flag,
json_t *  array_p 
)

◆ GetGrassrootsTypeAsString()

const char* GetGrassrootsTypeAsString ( const ParameterType  param_type)

Get the human-readable name for a given ParameterType.

Parameters
param_typeThe ParameterType to get the name for.
Returns
The human-readable name or NULL upon error.

◆ GetGrassrootsTypeFromString()

bool GetGrassrootsTypeFromString ( const char *  param_type_s,
ParameterType param_type_p 
)

Get the ParameterType from its human-readable name.

Parameters
param_type_sThe human-readable name of a ParameterType.
param_type_pPointer to where the ParameterType will be set.
Returns
true if the ParameterType was set successfully, false otherwise.

◆ AddParameterLevelToJSON()

bool AddParameterLevelToJSON ( const ParameterLevel  level,
json_t *  root_p,
const SchemaVersion *const  sv_p 
)

◆ SetParameterCallbacks()

void SetParameterCallbacks ( Parameter param_p,
void(*)(Parameter *param_p)  clear_fn,
bool(*)(const Parameter *param_p, json_t *param_json_p, const bool full_definition_flag)  add_values_to_json_fn,
Parameter *(*)(const Parameter *param_p, const struct ServiceData *data_p)  clone_fn,
bool(*)(Parameter *param_p, const char *value_s)  set_value_from_string_fn 
)

◆ GetParameterFromConfig()

const json_t* GetParameterFromConfig ( const json_t *  service_config_p,
const char *const  param_name_s 
)

◆ SetParameterCurrentValueFromJSON()

bool SetParameterCurrentValueFromJSON ( Parameter param_p,
const json_t *  value_p 
)

◆ GetNamedParameterDefaultValueFromJSON()

const char* GetNamedParameterDefaultValueFromJSON ( const char *  id_param_s,
const json_t *  params_json_p 
)

◆ GetParameterStringMultiOptions()

LinkedList* GetParameterStringMultiOptions ( Parameter param_p)