service_metadata.h
1 /*
2  ** Copyright 2014-2017 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  * service_metadata.h
18  *
19  * Created on: 10 Nov 2017
20  * Author: billy
21  */
22 
23 #ifndef CORE_SERVER_SERVICES_INCLUDE_SERVICE_METADATA_H_
24 #define CORE_SERVER_SERVICES_INCLUDE_SERVICE_METADATA_H_
25 
27 #include "typedefs.h"
28 #include "schema_term.h"
29 
30 #include "jansson.h"
31 
32 
33 
34 
39 typedef struct ServiceMetadata
40 {
46 
52 
58 
64 
65 
67 
68 
69 
70 #ifdef __cplusplus
71 extern "C"
72 {
73 #endif
74 
75 
84 GRASSROOTS_SERVICE_API ServiceMetadata *AllocateServiceMetadata (SchemaTerm *category_p, SchemaTerm *subcategory_p);
85 
86 
93 GRASSROOTS_SERVICE_API void FreeServiceMetadata (ServiceMetadata *metadata_p);
94 
95 
102 GRASSROOTS_SERVICE_API void ClearServiceMetadata (ServiceMetadata *metadata_p);
103 
104 
113 GRASSROOTS_SERVICE_API void SetServiceMetadataValues (ServiceMetadata *metadata_p, SchemaTerm *category_p, SchemaTerm *subcategory_p);
114 
115 
116 
125 GRASSROOTS_SERVICE_API bool AddServiceMetadataToJSON (const ServiceMetadata *metadata_p, json_t *service_json_p);
126 
127 
136 GRASSROOTS_SERVICE_API bool AddSchemaTermToServiceMetadataInput (ServiceMetadata *metadata_p, SchemaTerm *term_p);
137 
138 
147 GRASSROOTS_SERVICE_API bool AddSchemaTermToServiceMetadataOutput (ServiceMetadata *metadata_p, SchemaTerm *term_p);
148 
149 
157 GRASSROOTS_SERVICE_API ServiceMetadata *GetServiceMetadataFromJSON (const json_t *service_json_p);
158 
159 
160 #ifdef __cplusplus
161 }
162 #endif
163 
164 
165 #endif /* CORE_SERVER_SERVICES_INCLUDE_SERVICE_METADATA_H_ */
LinkedList * sm_output_types_p
A LinkedList of SchemaTermNodes defining the types of output that the Service can generate.
Definition: service_metadata.h:63
A datatype for specifying ontological terms as a way to describe the data that each of the Services c...
Definition: schema_term.h:38
A datatype for describing the type of application that a Service provides.
Definition: service_metadata.h:39
SchemaTerm * sm_application_category_p
This is the value used for defining the category of the Service.
Definition: service_metadata.h:45
void FreeServiceMetadata(ServiceMetadata *metadata_p)
Free a ServiceMetadata object.
SchemaTerm * sm_application_subcategory_p
This is the value used for defining the sub-category of the Service.
Definition: service_metadata.h:51
LinkedList * sm_input_types_p
A LinkedList of SchemaTermNodes defining the types of input that the Service can take.
Definition: service_metadata.h:57
A doubly-linked list that can be traversed in either direction.
Definition: linked_list.h:56
void SetServiceMetadataValues(ServiceMetadata *metadata_p, SchemaTerm *category_p, SchemaTerm *subcategory_p)
Set the values of a ServiceMetadata object.
ServiceMetadata * AllocateServiceMetadata(SchemaTerm *category_p, SchemaTerm *subcategory_p)
Allocate a ServiceMetadata object.
bool AddServiceMetadataToJSON(const ServiceMetadata *metadata_p, json_t *service_json_p)
Add the information from a ServiceMetadata object to a JSON fragment describing a Service.
void ClearServiceMetadata(ServiceMetadata *metadata_p)
Clear any data within a ServiceMetadata object.
ServiceMetadata * GetServiceMetadataFromJSON(const json_t *service_json_p)
Get a ServiceMetadata object from a JSON fragment.