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.
key_value_pair.h
Go to the documentation of this file.
1 
2 /*
3 ** Copyright 2014-2016 The Earlham Institute
4 **
5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at
8 **
9 ** http://www.apache.org/licenses/LICENSE-2.0
10 **
11 ** Unless required by applicable law or agreed to in writing, software
12 ** distributed under the License is distributed on an "AS IS" BASIS,
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ** See the License for the specific language governing permissions and
15 ** limitations under the License.
16 */
17 
22 /*
23  * key_value_pair.h
24  *
25  * Created on: 11 Feb 2015
26  * Author: tyrrells
27  */
28 
29 #ifndef KEY_VALUE_PAIR_H
30 #define KEY_VALUE_PAIR_H
31 
32 #include "network_library.h"
33 #include "linked_list.h"
34 #include "jansson.h"
35 
36 
42 typedef struct KeyValuePair
43 {
45  char *kvp_key_s;
46 
48  char *kvp_value_s;
49 } KeyValuePair;
50 
51 
60 typedef struct KeyValuePairNode
61 {
64 
68 
69 
70 #ifdef __cplusplus
71 extern "C"
72 {
73 #endif
74 
75 
84 GRASSROOTS_NETWORK_API KeyValuePair *AllocateKeyValuePair (const char *key_s, const char *value_s);
85 
86 
94 
95 
104 GRASSROOTS_NETWORK_API KeyValuePairNode *AllocateKeyValuePairNodeByParts (const char *key_s, const char *value_s);
105 
106 
115 
116 
117 
125 
126 
127 
137 
138 
148 
149 
150 #ifdef __cplusplus
151 }
152 #endif
153 
154 #endif /* KEY_VALUE_PAIR_H_ */
GRASSROOTS_NETWORK_API
#define GRASSROOTS_NETWORK_API
Definition: network_library.h:46
KeyValuePair::GetKeyValuePairFromJSON
KeyValuePair * GetKeyValuePairFromJSON(const json_t *json_p)
Create a KeyValuePair from its JSON representation.
KeyValuePairNode::kvpn_pair_p
KeyValuePair * kvpn_pair_p
The KeyValuePair.
Definition: key_value_pair.h:66
network_library.h
KeyValuePair::kvp_value_s
char * kvp_value_s
The string used as a value.
Definition: key_value_pair.h:48
KeyValuePair
A pair of strings.
Definition: key_value_pair.h:42
KeyValuePairNode
A datatype used for storing a KeyValuePair on a LinkedList.
Definition: key_value_pair.h:60
KeyValuePair::FreeKeyValuePairNode
void FreeKeyValuePairNode(ListItem *node_p)
Free a KeyValuePairNode.
KeyValuePair::FreeKeyValuePair
void FreeKeyValuePair(KeyValuePair *kvp_p)
Free a KeyValuePair.
KeyValuePair::AllocateKeyValuePairNodeByParts
KeyValuePairNode * AllocateKeyValuePairNodeByParts(const char *key_s, const char *value_s)
Allocate a KeyValuePairNode.
KeyValuePair::GetKeyValuePairAsJSON
json_t * GetKeyValuePairAsJSON(const KeyValuePair *kvp_p)
Get the JSON representation of a KeyValuePair.
KeyValuePair::kvp_key_s
char * kvp_key_s
The string used as a key.
Definition: key_value_pair.h:45
KeyValuePair::AllocateKeyValuePairNode
KeyValuePairNode * AllocateKeyValuePairNode(KeyValuePair *kvp_p)
Allocate a KeyValuePairNode.
KeyValuePairNode::kvpn_node
ListItem kvpn_node
The base node.
Definition: key_value_pair.h:63
KeyValuePair::AllocateKeyValuePair
KeyValuePair * AllocateKeyValuePair(const char *key_s, const char *value_s)
Allocate a KeyValuePair.
linked_list.h
A doubly-linked list.
ListItem
A doubly-linked node that points to its predecessor and successor.
Definition: linked_list.h:43