/Users/maurits/Documents/studie/afstuderen/biosphere/common/type.h

Go to the documentation of this file.
00001 /*
00002  * Author: MA Hartman
00003  * Date: apr 10, 2007
00004  * 
00005  * Function:
00006  * Utility functions for the several Bio-SPHERE data structures.
00007  * 
00008  * License information:
00009  * 
00010  * Copyright (c) 2006 Maurits Hartman
00011  *
00012  * Permission is hereby granted, free of charge, to any person
00013  * obtaining a copy of this software and associated documentation
00014  * files (the "Software"), to deal in the Software without
00015  * restriction, including without limitation the rights to use,
00016  * copy, modify, merge, publish, distribute, sublicense, and/or sell
00017  * copies of the Software, and to permit persons to whom the
00018  * Software is furnished to do so, subject to the following
00019  * conditions:
00020  * 
00021  * The above copyright notice and this permission notice shall be
00022  * included in all copies or substantial portions of the Software.
00023  * 
00024  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
00025  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
00026  * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
00027  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
00028  * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
00029  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00030  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
00031  * OTHER DEALINGS IN THE SOFTWARE.
00032  * 
00033  */
00034  
00035 #ifndef TYPE_H
00036 #define TYPE_H
00037 
00038 #include <biosphere.h>
00039 #include <apr_pools.h>
00040 
00053 bs_data_type *new_bs_data_type(apr_pool_t *mp, const char *name);
00054 
00062 bs_message *new_bs_message(apr_pool_t *mp, const char *name,
00063                 bs_uint16 num_parts);
00064 
00072 inline void add_part_to_message(bs_message *msg, bs_message_part *part, apr_pool_t *mp);
00073 
00081 bs_message_part *new_bs_message_part(apr_pool_t *mp, const char *name,
00082                 bs_data_type *type);
00083 
00093 bs_operation *new_bs_operation(apr_pool_t *mp, const char *name,
00094                 bs_message *input, bs_message *output, bs_message *fault);
00095 
00103 bs_port_type *new_bs_port_type(apr_pool_t *mp, const char *name,
00104                 bs_uint16 num_operations);
00105 
00113 inline void add_operation_to_port_type(bs_port_type *pt, bs_operation *op,
00114                 apr_pool_t *mp);
00115 
00123 bs_port *new_bs_port(apr_pool_t *mp, const char *name, bs_port_type *type);
00124 
00132 bs_service *new_bs_service(apr_pool_t *mp, const char *name,
00133                 bs_uint16 num_ports);
00134 
00142 inline void add_port_to_service(bs_service *svc, bs_port *port,
00143                 apr_pool_t *mp);
00144 
00155 bs_definition *new_bs_definition(apr_pool_t *mp, const char *name,
00156                 bs_uint16 num_data_types, bs_uint16 num_messages,
00157                 bs_uint16 num_port_types, bs_uint16 num_services);
00158 
00166 inline void add_data_type_to_definition(bs_definition *def, bs_data_type *type,
00167                 apr_pool_t *mp);
00168 
00169 inline void add_message_to_definition(bs_definition *def, bs_message *msg,
00170                 apr_pool_t *mp);
00171 
00172 inline void add_port_type_to_definition(bs_definition *def, bs_port_type *pt,
00173                 apr_pool_t *mp);
00174 
00175 inline void add_service_to_definition(bs_definition *def, bs_service *svc,
00176                 apr_pool_t *mp);
00177 
00181 bs_service_request *new_bs_service_request(apr_pool_t *mp, bs_byte *uuid,
00182                 char *service, char *port, char *operation,
00183                 bs_message_instance *input);
00184 
00188 bs_service_response *new_bs_service_response(apr_pool_t *mp,
00189                 const bs_byte *uuid,
00190                 const char *service, const char *port, const char *operation,
00191                 bs_message_instance *output, bs_message_instance *fault);
00192 
00196 bs_message_instance *new_bs_message_instance(apr_pool_t *mp, const char *name,
00197                 bs_uint16 num_parts);
00198 
00203 bs_part_instance *new_bs_part_instance(apr_pool_t *mp, const char *name,
00204                 bs_data_type *type, const char *data, bs_uint64 size);
00205 
00209 inline void add_part_to_request_instance(bs_part_instance *part,
00210                 bs_message_instance *msg, apr_pool_t *mp);
00211 
00219 bs_status merge_def_with_def(apr_pool_t *mp, bs_definition *result,
00220                 bs_definition *d);
00221                 
00228 bs_status merge_bs_definitions(apr_pool_t *mp, bs_definition **def, ...);
00229 
00235 bs_bool is_builtin_type(const char *name);
00236 
00244 bs_status check_builtin_type(bs_part_instance *inst);
00245 
00253 bs_bool request_corresponds_with_definition(const bs_service_request *request,
00254                 const bs_definition *def);
00255 
00260 #endif /*STRUCTURES_H_*/

Generated on Tue Jul 17 09:50:52 2007 for Bio-SPHERE by  doxygen 1.5.1