00001 /* 00002 * structures.h - describe C structures for OWL entities, KP and SS. 00003 * This file is part of PetrSU KP library. 00004 * 00005 * Copyright (C) 2009 - Alexander A. Lomov. All rights reserved. 00006 * 00007 * PetrSU KP library is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * PetrSU KP library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with PetrSU KP library; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin St, Fifth Floor, 00020 * Boston, MA 02110-1301 USA 00021 */ 00022 00023 #include <stdio.h> 00024 #include <stdlib.h> 00025 #include "utils/kp_bool.h" 00026 #include "utils/list.h" 00027 00028 #ifndef _STRUCTURES_H 00029 #define _STRUCTURES_H 00030 00031 00032 00033 /******************************************************************************/ 00034 /******************************** Enums list **********************************/ 00038 enum rtti_types { 00039 RTTI_MIN_VALUE = 0, 00040 RTTI_INDIVIDUAL = 1, 00041 RTTI_CLASS = 2, 00042 RTTI_PROPERTY = 3, 00043 RTTI_SBRC_CONTAINER, 00044 RTTI_MAX_VALUE 00045 }; 00046 00047 00051 enum property_types { 00052 DATATYPEPROPERTY = 1, 00053 OBJECTPROPERTY = 2 00054 }; 00055 00056 00057 00058 /******************************************************************************/ 00059 /****************************** Structures list *******************************/ 00063 typedef struct property_s { 00064 int rtti; 00065 int type; 00066 char *name; 00067 char *domain; 00068 char *about; 00069 list_t *subpropertyof; 00070 list_t *oneof; 00071 int mincardinality; 00072 int maxcardinality; 00073 } property_t; 00074 00075 00081 typedef struct prop_val_s { 00082 property_t *property; 00083 void *prop_value; 00084 } prop_val_t; 00085 00086 00090 typedef struct class_s { 00091 int rtti; 00092 char *classtype; 00093 list_t *superclasses; 00094 list_t *oneof; 00095 list_t *properties; 00096 list_t *instances; 00097 } class_t; 00098 00099 00103 typedef struct individual_s { 00104 int rtti; 00105 char *uuid; 00106 char *classtype; 00107 list_t *properties; 00108 const class_t *parent_class; 00109 } individual_t; 00110 00111 00112 00113 /******************************************************************************/ 00114 /****************************** Functions list ********************************/ 00115 void free_property(property_t *property); 00116 void free_property_value_with_func(prop_val_t *prop_val, void (*free_data_func)(void*)); 00117 void free_class(class_t *class); 00118 void free_individual(individual_t *individual); 00119 00120 prop_val_t* new_prop_value(property_t *prop, void *data); 00121 00122 int get_rtti_type(const void* entity); 00123 00124 #endif /* _STRUCTURES_H */