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.
address.h
Go to the documentation of this file.
1 /*
2  * address.h
3  *
4  * Created on: 31 May 2018
5  * Author: billy
6  */
7 
8 #ifndef TOOLS_GRASSROOTS_GEOCODER_INCLUDE_ADDRESS_H_
9 #define TOOLS_GRASSROOTS_GEOCODER_INCLUDE_ADDRESS_H_
10 
12 #include "coordinate.h"
13 #include "jansson.h"
14 
21 typedef struct Address
22 {
27  char *ad_name_s;
28 
32  char *ad_street_s;
33 
34 
38  char *ad_town_s;
39 
40 
44  char *ad_county_s;
45 
49  char *ad_country_s;
50 
55 
61 
69  char *ad_gps_s;
70 
76 
77 
83 
84 
90 
91  double64 *ad_elevation_p;
92 } Address;
93 
94 
95 
96 #ifndef DOXYGEN_SHOULD_SKIP_THIS
97 
98 #ifdef ALLOCATE_ADDRESS_TAGS
99  #define ADDRESS_PREFIX GRASSROOTS_GEOCODER_API
100  #define ADDRESS_VAL(x) = x
101 #else
102  #define ADDRESS_PREFIX extern GRASSROOTS_GEOCODER_API
103  #define ADDRESS_VAL(x)
104 #endif
105 
106 #endif /* #ifndef DOXYGEN_SHOULD_SKIP_THIS */
107 
108 
109 
110 
111 
112 
113 
114 ADDRESS_PREFIX const char *AD_ADDRESS_S ADDRESS_VAL ("Address");
115 
121 ADDRESS_PREFIX const char *AD_NAME_S ADDRESS_VAL ("name");
122 
123 
130 ADDRESS_PREFIX const char *AD_POSTCODE_S ADDRESS_VAL ("postalCode");
131 
132 
140 ADDRESS_PREFIX const char *AD_STREET_S ADDRESS_VAL ("streetAddress");
141 
148 ADDRESS_PREFIX const char *AD_TOWN_S ADDRESS_VAL ("addressLocality");
149 
150 
157 ADDRESS_PREFIX const char *AD_COUNTY_S ADDRESS_VAL ("addressRegion");
158 
159 
166 ADDRESS_PREFIX const char *AD_COUNTRY_S ADDRESS_VAL ("addressCountry");
167 
168 
169 
175 ADDRESS_PREFIX const char *AD_LOCATION_S ADDRESS_VAL ("location");
176 
177 
183 ADDRESS_PREFIX const char *AD_CENTRE_LOCATION_S ADDRESS_VAL ("centre");
184 
190 ADDRESS_PREFIX const char *AD_NORTH_EAST_LOCATION_S ADDRESS_VAL ("north_east_bound");
191 
192 
198 ADDRESS_PREFIX const char *AD_SOUTH_WEST_LOCATION_S ADDRESS_VAL ("south_west_bound");
199 
200 
201 #ifdef __cplusplus
202 extern "C"
203 {
204 #endif
205 
223 GRASSROOTS_GEOCODER_API Address *AllocateAddress (const char *name_s, const char *street_s, const char *town_s, const char *county_s, const char *country_s, const char *postcode_s, const char *country_code_s, const char *gps_s);
224 
225 
234 
235 
244 
245 
255 GRASSROOTS_GEOCODER_API char *GetAddressAsString (const Address *address_p);
256 
257 
267 GRASSROOTS_GEOCODER_API char *GetAddressAsDelimitedString (const Address *address_p, const char *sep_s);
268 
269 
280 GRASSROOTS_GEOCODER_API json_t *GetAddressAsJSON (const Address *address_p);
281 
282 
291 GRASSROOTS_GEOCODER_API Address *GetAddressFromJSON (const json_t *address_json_p);
292 
302 GRASSROOTS_GEOCODER_API bool ConvertAddressToJSON (const Address *address_p, json_t *dest_p);
303 
304 
316 GRASSROOTS_GEOCODER_API bool ParseAddressForSchemaOrg (const Address *address_p, json_t *values_p, const char *address_key_s);
317 
318 
319 GRASSROOTS_GEOCODER_API Address *ParseSchemaOrgAddress (const json_t *values_p, const char *address_key_s);
320 
321 
336 GRASSROOTS_GEOCODER_API bool SetAddressCentreCoordinate (Address *address_p, const double64 latitude, const double64 longitude, const double64 *elevation_p);
337 
338 
353 GRASSROOTS_GEOCODER_API bool SetAddressNorthEastCoordinate (Address *address_p, const double64 latitude, const double64 longitude, const double64 *elevation_p);
354 
355 
370 GRASSROOTS_GEOCODER_API bool SetAddressSouthWestCoordinate (Address *address_p, const double64 latitude, const double64 longitude, const double64 *elevation_p);
371 
372 
373 
374 #ifdef __cplusplus
375 }
376 #endif
377 
378 #endif /* TOOLS_GRASSROOTS_GEOCODER_INCLUDE_ADDRESS_H_ */
Address::ad_town_s
char * ad_town_s
The town, city or village that this Address is in.
Definition: address.h:38
AD_COUNTY_S
const char * AD_COUNTY_S
The key for specifying an object containing the county where the sample was collected.
Definition: address.h:157
Address::SetAddressSouthWestCoordinate
bool SetAddressSouthWestCoordinate(Address *address_p, const double64 latitude, const double64 longitude, const double64 *elevation_p)
Set the Coordinate for the south-west bounds of a given address to the given latitude and longitude v...
AD_NAME_S
const char * AD_NAME_S
The key for specifying an object containing the name of an address.
Definition: address.h:121
Address::ad_gps_s
char * ad_gps_s
The string representation of the geographic coordinate for this Address such as "32....
Definition: address.h:69
Address::ad_elevation_p
double64 * ad_elevation_p
Definition: address.h:91
Address::ad_street_s
char * ad_street_s
The street that this Address is on.
Definition: address.h:32
Address::GetAddressAsString
char * GetAddressAsString(const Address *address_p)
Get a string represetnting an Address.
Address::AllocateAddress
Address * AllocateAddress(const char *name_s, const char *street_s, const char *town_s, const char *county_s, const char *country_s, const char *postcode_s, const char *country_code_s, const char *gps_s)
Allocte a new Address object.
Address::FreeAddress
void FreeAddress(Address *address_p)
Free an Address.
Address::GetAddressFromJSON
Address * GetAddressFromJSON(const json_t *address_json_p)
Get a new Address from a JSON representation.
Address::ad_name_s
char * ad_name_s
The building name or number for this Address.
Definition: address.h:27
Address
A datatype for storing a postal address as well as its geographic coordinates if possible.
Definition: address.h:21
grassroots_geocoder_library.h
Address::GetAddressAsJSON
json_t * GetAddressAsJSON(const Address *address_p)
Get the JSON representation of an Address.
coordinate.h
Address::ad_gps_centre_p
Coordinate * ad_gps_centre_p
A pointer to the Coordinate for the central point of this Address.
Definition: address.h:75
Address::ad_country_s
char * ad_country_s
The country that this Address is in.
Definition: address.h:49
Address::ad_gps_south_west_p
Coordinate * ad_gps_south_west_p
A pointer to the Coordinate for the south-west bounds of this Address.
Definition: address.h:89
ParseSchemaOrgAddress
Address * ParseSchemaOrgAddress(const json_t *values_p, const char *address_key_s)
Address::ad_country_code_s
char * ad_country_code_s
The ISO 3166-1 alpha-2 country code for the country that this Address is in.
Definition: address.h:60
AD_CENTRE_LOCATION_S
const char * AD_CENTRE_LOCATION_S
The key for the central location object for a given record.
Definition: address.h:183
AD_NORTH_EAST_LOCATION_S
const char * AD_NORTH_EAST_LOCATION_S
The key for the north-eastern bounds for the location object for a given record.
Definition: address.h:190
GRASSROOTS_GEOCODER_API
#define GRASSROOTS_GEOCODER_API
Definition: grassroots_geocoder_library.h:46
Address::ad_postcode_s
char * ad_postcode_s
The postal code for this Address.
Definition: address.h:54
Address::ad_county_s
char * ad_county_s
The county that this Address is in.
Definition: address.h:44
AD_ADDRESS_S
const char * AD_ADDRESS_S
Definition: address.h:114
AD_COUNTRY_S
const char * AD_COUNTRY_S
The key for specifying an object containing the country where the sample was collected.
Definition: address.h:166
AD_LOCATION_S
const char * AD_LOCATION_S
The key for the location object for a given record.
Definition: address.h:175
Address::SetAddressCentreCoordinate
bool SetAddressCentreCoordinate(Address *address_p, const double64 latitude, const double64 longitude, const double64 *elevation_p)
Set the Coordinate for the central point of a given address to the given latitude and longitude value...
Address::ConvertAddressToJSON
bool ConvertAddressToJSON(const Address *address_p, json_t *dest_p)
Store the JSON-based representation of an Address in a given JSON fragment.
Address::SetAddressNorthEastCoordinate
bool SetAddressNorthEastCoordinate(Address *address_p, const double64 latitude, const double64 longitude, const double64 *elevation_p)
Set the Coordinate for the north-east bounds of a given address to the given latitude and longitude v...
AD_SOUTH_WEST_LOCATION_S
const char * AD_SOUTH_WEST_LOCATION_S
The key for the south-western bounds for the location object for a given record.
Definition: address.h:198
Address::ad_gps_north_east_p
Coordinate * ad_gps_north_east_p
A pointer to the Coordinate for the north-east bounds of this Address.
Definition: address.h:82
Coordinate
A datatype for storing a geographic coordinate.
Definition: coordinate.h:34
AD_POSTCODE_S
const char * AD_POSTCODE_S
The key for specifying an object containing the postal code where the sample was collected.
Definition: address.h:130
Address::ParseAddressForSchemaOrg
bool ParseAddressForSchemaOrg(const Address *address_p, json_t *values_p, const char *address_key_s)
Populate a JSON fragment with the values from a given Address conforming to the definition of a posta...
AD_TOWN_S
const char * AD_TOWN_S
The key for specifying an object containing the town where the sample was collected.
Definition: address.h:148
Address::ClearAddress
void ClearAddress(Address *address_p)
Clear all of the values within an Address.
AD_STREET_S
const char * AD_STREET_S
The key for specifying an object containing the street address where the sample was collected.
Definition: address.h:140
Address::GetAddressAsDelimitedString
char * GetAddressAsDelimitedString(const Address *address_p, const char *sep_s)
Get a string represetnting an Address.