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.
dfw_util.h File Reference
Include dependency graph for dfw_util.h:

Go to the source code of this file.

Functions

DFW_UTIL_PREFIX NamedParameterType FT_TIMESTAMP DFW_UTIL_STRUCT_VAL ("PR Timestamp", PT_STRING)
 
const DFW_UTIL_PREFIX char *const FT_DEFAULT_TIMESTAMP_S DFW_UTIL_VAL ("current")
 
const DFW_UTIL_PREFIX char *const FT_EMPTY_LIST_OPTION_S DFW_UTIL_VAL ("<empty>")
 
const DFW_UTIL_PREFIX char *const FT_USER_S DFW_UTIL_VAL ("user")
 
const DFW_UTIL_PREFIX char *const FT_PERMISSIONS_S DFW_UTIL_VAL ("permissions")
 
void * GetDFWObjectById (const bson_oid_t *id_p, FieldTrialDatatype collection_type, void *(*get_obj_from_json_fn)(const json_t *json_p, const ViewFormat format, const FieldTrialServiceData *data_p), const ViewFormat format, const FieldTrialServiceData *data_p)
 
void * GetDFWObjectByNamedId (const bson_oid_t *id_p, FieldTrialDatatype collection_type, const char *id_key_s, void *(*get_obj_from_json_fn)(const json_t *json_p, const ViewFormat format, const FieldTrialServiceData *data_p), const ViewFormat format, const FieldTrialServiceData *data_p)
 
void * GetDFWObjectByIdString (const char *object_id_s, FieldTrialDatatype collection_type, void *(*get_obj_from_json_fn)(const json_t *json_p, const ViewFormat format, const FieldTrialServiceData *data_p), const ViewFormat format, const FieldTrialServiceData *data_p)
 
void * GetDFWObjectByNamedIdString (const char *object_id_s, FieldTrialDatatype collection_type, const char *id_key_s, void *(*get_obj_from_json_fn)(const json_t *json_p, const ViewFormat format, const FieldTrialServiceData *data_p), const ViewFormat format, const FieldTrialServiceData *data_p)
 
bool CopyValidDate (const struct tm *src_p, struct tm **dest_pp)
 
bool CopyValidReal (const double64 *src_p, double64 **dest_pp)
 
bool CopyValidUnsignedInteger (const uint32 *src_p, uint32 **dest_pp)
 
bool CopyValidInteger (const int32 *src_p, int32 **dest_pp)
 
bool CreateValidDateFromJSON (const json_t *json_p, const char *key_s, struct tm **time_pp)
 
bool AddValidDateToJSON (struct tm *time_p, json_t *json_p, const char *key_s, const bool add_time_flag)
 
bool AddValidDateAsEpochToJSON (struct tm *time_p, json_t *json_p, const char *key_s)
 
bool AddContext (json_t *data_p)
 
bool AddImage (json_t *doc_p, const FieldTrialDatatype data_type, const FieldTrialServiceData *data_p)
 
bool AddDatatype (json_t *doc_p, const FieldTrialDatatype data_type)
 
LinkedListSearchObjects (const FieldTrialServiceData *data_p, const FieldTrialDatatype collection_type, const char **keys_ss, const char **values_ss, void(*free_list_item_fn)(ListItem *const item_p), bool(*add_result_to_list_fn)(const json_t *result_p, LinkedList *list_p, const FieldTrialServiceData *service_data_p))
 
bool CacheStudy (const char *id_s, const json_t *study_json_p, const FieldTrialServiceData *data_p)
 
json_t * GetCachedStudy (const char *id_s, const FieldTrialServiceData *data_p)
 
bool ClearCachedStudy (const char *id_s, const FieldTrialServiceData *data_p)
 
bool FindAndAddResultToServiceJob (const char *id_s, const ViewFormat format, ServiceJob *job_p, JSONProcessor *processor_p, json_t *(get_json_fn)(const char *id_s, const ViewFormat format, JSONProcessor *processor_p, char **name_ss, const FieldTrialServiceData *data_p), const FieldTrialDatatype datatype, const FieldTrialServiceData *data_p)
 
bool GetValidRealFromJSON (const json_t *study_json_p, const char *key_s, double64 **ph_pp)
 
bool GetValidUnsignedIntFromJSON (const json_t *study_json_p, const char *key_s, uint32 **value_pp)
 
json_t * GetImageObject (const char *image_url_s, const char *thumbnail_url_s)
 
char * GetFrictionlessDataFilename (const char *const name_s, const FieldTrialServiceData *data_p)
 
char * GetFrictionlessDataURL (const char *const name_s, const FieldTrialServiceData *data_p)
 
char * GetStudyHandbookURL (const char *const name_s, const FieldTrialServiceData *data_p)
 
char * GetBackupFilename (const char *id_s, const FieldTrialServiceData *data_p)
 
char * GetPlotsUploadsFilename (const char *id_s, const FieldTrialServiceData *data_p)
 
bool SetFieldTrialServiceJobURL (ServiceJob *job_p, const char *const url_prefix_s, const char *const id_s)
 
const char * GetStringDefaultValueFromJSON (const char *param_s, const json_t *params_json_p)
 
json_t * GetAllJSONVersionsOfObject (const char *id_s, FieldTrialDatatype collection_type, const FieldTrialServiceData *data_p)
 
json_t * GetSpecificJSONVersionOfObject (const char *id_s, const char *timestamp_s, FieldTrialDatatype collection_type, const FieldTrialServiceData *data_p)
 
void * GetVersionedObject (const char *id_s, const char *timestamp_s, const ViewFormat format, const FieldTrialDatatype dt, const FieldTrialServiceData *data_p, void *(*callback_fn)(json_t *json_p, ViewFormat format, const FieldTrialServiceData *data_p))
 
void * GetVersionedObjectFromResource (DataResource *resource_p, const NamedParameterType param_type, const char **original_id_ss, FieldTrialServiceData *ft_data_p, void *(*get_versioned_obj_fn)(const char *id_s, const char *timestamp_s, const ViewFormat vf, FieldTrialServiceData *ft_data_p), void *(*get_obj_by_id_fn)(const char *id_s, const ViewFormat vf, FieldTrialServiceData *ft_data_p))
 
bool SetUpListParameterFromJSON (const FieldTrialServiceData *data_p, StringParameter *param_p, const char *active_id_s, const char *empty_option_s, const char *name_key_s, json_t *objects_p)
 

Function Documentation

◆ DFW_UTIL_STRUCT_VAL()

DFW_UTIL_PREFIX NamedParameterType FT_TIMESTAMP DFW_UTIL_STRUCT_VAL ( "PR Timestamp"  ,
PT_STRING   
)

◆ DFW_UTIL_VAL() [1/4]

const DFW_UTIL_PREFIX char* const FT_DEFAULT_TIMESTAMP_S DFW_UTIL_VAL ( "current"  )

◆ DFW_UTIL_VAL() [2/4]

const DFW_UTIL_PREFIX char* const FT_EMPTY_LIST_OPTION_S DFW_UTIL_VAL ( "<empty>"  )

◆ DFW_UTIL_VAL() [3/4]

const DFW_UTIL_PREFIX char* const FT_USER_S DFW_UTIL_VAL ( "user"  )

◆ DFW_UTIL_VAL() [4/4]

const DFW_UTIL_PREFIX char* const FT_PERMISSIONS_S DFW_UTIL_VAL ( "permissions"  )

◆ GetDFWObjectById()

void* GetDFWObjectById ( const bson_oid_t *  id_p,
FieldTrialDatatype  collection_type,
void *(*)(const json_t *json_p, const ViewFormat format, const FieldTrialServiceData *data_p)  get_obj_from_json_fn,
const ViewFormat  format,
const FieldTrialServiceData data_p 
)

◆ GetDFWObjectByNamedId()

void* GetDFWObjectByNamedId ( const bson_oid_t *  id_p,
FieldTrialDatatype  collection_type,
const char *  id_key_s,
void *(*)(const json_t *json_p, const ViewFormat format, const FieldTrialServiceData *data_p)  get_obj_from_json_fn,
const ViewFormat  format,
const FieldTrialServiceData data_p 
)

◆ GetDFWObjectByIdString()

void* GetDFWObjectByIdString ( const char *  object_id_s,
FieldTrialDatatype  collection_type,
void *(*)(const json_t *json_p, const ViewFormat format, const FieldTrialServiceData *data_p)  get_obj_from_json_fn,
const ViewFormat  format,
const FieldTrialServiceData data_p 
)

◆ GetDFWObjectByNamedIdString()

void* GetDFWObjectByNamedIdString ( const char *  object_id_s,
FieldTrialDatatype  collection_type,
const char *  id_key_s,
void *(*)(const json_t *json_p, const ViewFormat format, const FieldTrialServiceData *data_p)  get_obj_from_json_fn,
const ViewFormat  format,
const FieldTrialServiceData data_p 
)

◆ CopyValidDate()

bool CopyValidDate ( const struct tm *  src_p,
struct tm **  dest_pp 
)

◆ CopyValidReal()

bool CopyValidReal ( const double64 *  src_p,
double64 **  dest_pp 
)

◆ CopyValidUnsignedInteger()

bool CopyValidUnsignedInteger ( const uint32 *  src_p,
uint32 **  dest_pp 
)

◆ CopyValidInteger()

bool CopyValidInteger ( const int32 *  src_p,
int32 **  dest_pp 
)

◆ CreateValidDateFromJSON()

bool CreateValidDateFromJSON ( const json_t *  json_p,
const char *  key_s,
struct tm **  time_pp 
)

◆ AddValidDateToJSON()

bool AddValidDateToJSON ( struct tm *  time_p,
json_t *  json_p,
const char *  key_s,
const bool  add_time_flag 
)

◆ AddValidDateAsEpochToJSON()

bool AddValidDateAsEpochToJSON ( struct tm *  time_p,
json_t *  json_p,
const char *  key_s 
)

◆ AddContext()

bool AddContext ( json_t *  data_p)

◆ AddImage()

bool AddImage ( json_t *  doc_p,
const FieldTrialDatatype  data_type,
const FieldTrialServiceData data_p 
)

◆ AddDatatype()

bool AddDatatype ( json_t *  doc_p,
const FieldTrialDatatype  data_type 
)

◆ SearchObjects()

LinkedList* SearchObjects ( const FieldTrialServiceData data_p,
const FieldTrialDatatype  collection_type,
const char **  keys_ss,
const char **  values_ss,
void(*)(ListItem *const item_p)  free_list_item_fn,
bool(*)(const json_t *result_p, LinkedList *list_p, const FieldTrialServiceData *service_data_p)  add_result_to_list_fn 
)

◆ CacheStudy()

bool CacheStudy ( const char *  id_s,
const json_t *  study_json_p,
const FieldTrialServiceData data_p 
)

◆ GetCachedStudy()

json_t* GetCachedStudy ( const char *  id_s,
const FieldTrialServiceData data_p 
)

◆ ClearCachedStudy()

bool ClearCachedStudy ( const char *  id_s,
const FieldTrialServiceData data_p 
)

◆ FindAndAddResultToServiceJob()

bool FindAndAddResultToServiceJob ( const char *  id_s,
const ViewFormat  format,
ServiceJob job_p,
JSONProcessor processor_p,
json_t *  get_json_fn)(const char *id_s, const ViewFormat format, JSONProcessor *processor_p, char **name_ss, const FieldTrialServiceData *data_p,
const FieldTrialDatatype  datatype,
const FieldTrialServiceData data_p 
)

◆ GetValidRealFromJSON()

bool GetValidRealFromJSON ( const json_t *  study_json_p,
const char *  key_s,
double64 **  ph_pp 
)

◆ GetValidUnsignedIntFromJSON()

bool GetValidUnsignedIntFromJSON ( const json_t *  study_json_p,
const char *  key_s,
uint32 **  value_pp 
)

◆ GetImageObject()

json_t* GetImageObject ( const char *  image_url_s,
const char *  thumbnail_url_s 
)

◆ GetFrictionlessDataFilename()

char* GetFrictionlessDataFilename ( const char *const  name_s,
const FieldTrialServiceData data_p 
)

◆ GetFrictionlessDataURL()

char* GetFrictionlessDataURL ( const char *const  name_s,
const FieldTrialServiceData data_p 
)

◆ GetStudyHandbookURL()

char* GetStudyHandbookURL ( const char *const  name_s,
const FieldTrialServiceData data_p 
)

◆ GetBackupFilename()

char* GetBackupFilename ( const char *  id_s,
const FieldTrialServiceData data_p 
)

◆ GetPlotsUploadsFilename()

char* GetPlotsUploadsFilename ( const char *  id_s,
const FieldTrialServiceData data_p 
)

◆ SetFieldTrialServiceJobURL()

bool SetFieldTrialServiceJobURL ( ServiceJob job_p,
const char *const  url_prefix_s,
const char *const  id_s 
)

◆ GetStringDefaultValueFromJSON()

const char* GetStringDefaultValueFromJSON ( const char *  param_s,
const json_t *  params_json_p 
)

◆ GetAllJSONVersionsOfObject()

json_t* GetAllJSONVersionsOfObject ( const char *  id_s,
FieldTrialDatatype  collection_type,
const FieldTrialServiceData data_p 
)

◆ GetSpecificJSONVersionOfObject()

json_t* GetSpecificJSONVersionOfObject ( const char *  id_s,
const char *  timestamp_s,
FieldTrialDatatype  collection_type,
const FieldTrialServiceData data_p 
)

◆ GetVersionedObject()

void* GetVersionedObject ( const char *  id_s,
const char *  timestamp_s,
const ViewFormat  format,
const FieldTrialDatatype  dt,
const FieldTrialServiceData data_p,
void *(*)(json_t *json_p, ViewFormat format, const FieldTrialServiceData *data_p)  callback_fn 
)

◆ GetVersionedObjectFromResource()

void* GetVersionedObjectFromResource ( DataResource resource_p,
const NamedParameterType  param_type,
const char **  original_id_ss,
FieldTrialServiceData ft_data_p,
void *(*)(const char *id_s, const char *timestamp_s, const ViewFormat vf, FieldTrialServiceData *ft_data_p)  get_versioned_obj_fn,
void *(*)(const char *id_s, const ViewFormat vf, FieldTrialServiceData *ft_data_p)  get_obj_by_id_fn 
)

◆ SetUpListParameterFromJSON()

bool SetUpListParameterFromJSON ( const FieldTrialServiceData data_p,
StringParameter param_p,
const char *  active_id_s,
const char *  empty_option_s,
const char *  name_key_s,
json_t *  objects_p 
)