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.
person.h
Go to the documentation of this file.
1 /*
2 ** Copyright 2014-2018 The Earlham Institute
3 **
4 ** Licensed under the Apache License, Version 2.0 (the "License");
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
7 **
8 ** http://www.apache.org/licenses/LICENSE-2.0
9 **
10 ** Unless required by applicable law or agreed to in writing, software
11 ** distributed under the License is distributed on an "AS IS" BASIS,
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
15 */
16 /*
17  * person.h
18  *
19  * Created on: 19 Dec 2018
20  * Author: billy
21  */
22 
23 #ifndef SERVICES_FIELD_TRIALS_INCLUDE_PERSON_H_
24 #define SERVICES_FIELD_TRIALS_INCLUDE_PERSON_H_
25 
28 #include "jansson.h"
29 
30 #include "address.h"
31 #include "typedefs.h"
32 #include "linked_list.h"
33 
34 
35 #ifndef DOXYGEN_SHOULD_SKIP_THIS
36 
37 #ifdef ALLOCATE_STUDY_TAGS
38  #define PERSON_PREFIX DFW_FIELD_TRIAL_SERVICE_LOCAL
39  #define PERSON_VAL(x) = x
40  #define PERSON_CONCAT_VAL(x,y) = x y
41 #else
42  #define PERSON_PREFIX extern
43  #define PERSON_VAL(x)
44  #define PERSON_CONCAT_VAL(x,y)
45 #endif
46 
47 #endif /* #ifndef DOXYGEN_SHOULD_SKIP_THIS */
48 
49 
50 
51 typedef struct Person
52 {
53  char *pe_name_s;
54 
55  char *pe_email_s;
56 
58 
59  char *pe_role_s;
60 
61  char *pe_orcid_s;
62 } Person;
63 
64 
65 typedef struct
66 {
68 
70 } PersonNode;
71 
72 
73 PERSON_PREFIX const char *PE_NAME_S PERSON_CONCAT_VAL (CONTEXT_PREFIX_SCHEMA_ORG_S, "name");
74 
75 PERSON_PREFIX const char *PE_EMAIL_S PERSON_CONCAT_VAL (CONTEXT_PREFIX_SCHEMA_ORG_S, "email");
76 
77 PERSON_PREFIX const char *PE_AFFILATION_S PERSON_CONCAT_VAL (CONTEXT_PREFIX_SCHEMA_ORG_S, "affiliation");
78 
79 PERSON_PREFIX const char *PE_ROLE_S PERSON_CONCAT_VAL (CONTEXT_PREFIX_SCHEMA_ORG_S, "roleName");
80 
81 PERSON_PREFIX const char *PE_ORCID_S PERSON_VAL ("orcid");
82 
83 #ifdef __cplusplus
84 extern "C"
85 {
86 #endif
87 
88 
89 DFW_FIELD_TRIAL_SERVICE_LOCAL Person *AllocatePerson (const char *name_s, const char *email_s, const char *role_s, const char *affiliaion_s, const char *orcid_s);
90 
92 
94 
96 
97 DFW_FIELD_TRIAL_SERVICE_LOCAL json_t *GetPersonAsJSON (const Person * const person_p, const ViewFormat format, const FieldTrialServiceData *data_p);
98 
99 
100 DFW_FIELD_TRIAL_SERVICE_LOCAL Person *GetPersonFromJSON (const json_t *parent_p, const ViewFormat format, const FieldTrialServiceData *data_p);
101 
102 
103 DFW_FIELD_TRIAL_SERVICE_LOCAL bool AddPersonToCompoundJSON (const Person *person_p, json_t *parent_json_p, const char * const key_s, const ViewFormat format, const FieldTrialServiceData *data_p);
104 
105 
106 DFW_FIELD_TRIAL_SERVICE_LOCAL Person *GetPersonFromCompoundJSON (const json_t *json_p, const char * const key_s, const ViewFormat format, const FieldTrialServiceData *data_p);
107 
108 
110 
111 
113 
114 
115 DFW_FIELD_TRIAL_SERVICE_LOCAL json_t *GetPersonAsFrictionlessData (const Person * const person_p);
116 
117 
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 
123 #endif /* SERVICES_FIELD_TRIALS_INCLUDE_PERSON_H_ */
AddPersonToCompoundJSON
bool AddPersonToCompoundJSON(const Person *person_p, json_t *parent_json_p, const char *const key_s, const ViewFormat format, const FieldTrialServiceData *data_p)
FreePerson
void FreePerson(Person *person_p)
PersonNode::pn_person_p
Person * pn_person_p
Definition: person.h:69
AllocatePerson
Person * AllocatePerson(const char *name_s, const char *email_s, const char *role_s, const char *affiliaion_s, const char *orcid_s)
AllocatePersonNode
PersonNode * AllocatePersonNode(Person *person_p)
GetPersonAsJSON
json_t * GetPersonAsJSON(const Person *const person_p, const ViewFormat format, const FieldTrialServiceData *data_p)
PersonNode
Definition: person.h:65
GetPersonFromCompoundJSON
Person * GetPersonFromCompoundJSON(const json_t *json_p, const char *const key_s, const ViewFormat format, const FieldTrialServiceData *data_p)
PERSON_CONCAT_VAL
const PERSON_PREFIX char *PE_NAME_S PERSON_CONCAT_VAL(CONTEXT_PREFIX_SCHEMA_ORG_S, "name")
FreePersonNode
void FreePersonNode(ListItem *person_node_p)
GetPersonFromJSON
Person * GetPersonFromJSON(const json_t *parent_p, const ViewFormat format, const FieldTrialServiceData *data_p)
PersonNode::pn_node
ListItem pn_node
Definition: person.h:67
dfw_field_trial_service_library.h
address.h
DFW_FIELD_TRIAL_SERVICE_LOCAL
#define DFW_FIELD_TRIAL_SERVICE_LOCAL
Definition: dfw_field_trial_service_library.h:43
CONTEXT_PREFIX_SCHEMA_ORG_S
#define CONTEXT_PREFIX_SCHEMA_ORG_S
Definition: schema_keys.h:103
typedefs.h
Person::pe_name_s
char * pe_name_s
Definition: person.h:53
Person
Definition: person.h:51
Person::pe_orcid_s
char * pe_orcid_s
Definition: person.h:61
dfw_field_trial_service_data.h
GetPersonAsFrictionlessData
json_t * GetPersonAsFrictionlessData(const Person *const person_p)
linked_list.h
A doubly-linked list.
ClearPerson
void ClearPerson(Person *person_p)
Person::pe_role_s
char * pe_role_s
Definition: person.h:59
FieldTrialServiceData
The configuration data used by the DFW Field Trial Service.
Definition: dfw_field_trial_service_data.h:118
Person::pe_affiliation_s
char * pe_affiliation_s
Definition: person.h:57
ViewFormat
ViewFormat
An indicator of what the output destination is for the JSON data values.
Definition: view_format.h:19
PERSON_VAL
const PERSON_PREFIX char *PE_ORCID_S PERSON_VAL("orcid")
InitPerson
void InitPerson(Person *person_p)
ListItem
A doubly-linked node that points to its predecessor and successor.
Definition: linked_list.h:43
Person::pe_email_s
char * pe_email_s
Definition: person.h:55