Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

node.h

Go to the documentation of this file.
00001 /**********************************************************************
00002  *
00003  * Verball Model Storage Library, Common Information Model Library 
00004  * for integration of Intelligent Services.
00005  * Copyright (C) 2005 Nikita Vinokurov, Orgway LLC.
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public
00009  * License as published by the Free Software Foundation; 
00010  * version 2.1 of the License.
00011  *
00012  * This 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 GNU
00015  * Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this library; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, 
00020  * Boston, MA  02110-1301  USA
00021  *
00022  * $Id: node.h,v 1.8 2006/11/06 19:08:37 igor_kvasov Exp $
00023  **********************************************************************/
00024 
00025 #ifndef _NODE_H_
00026 #define _NODE_H_
00027 #include <stdio.h>
00028 #include <time.h>
00029 
00030 #if defined(_WIN32) || defined(__declspec)
00031 
00032 #   ifdef COMPILE_DLL
00033 #       define STORAGE_TYPE __declspec(dllexport)
00034 #   else
00035 #       define STORAGE_TYPE __declspec(dllimport)
00036 #   endif
00037 
00038 #else // _WIN32 || __declspec
00039 #   define STORAGE_TYPE extern
00040 #endif // _WIN32 || __declspec
00041 
00042 
00043 #ifdef __cplusplus
00044 extern "C"
00045 {
00046 #endif/* __cplusplus */
00047 
00048 
00051 typedef enum {
00052     
00055     NODE_GLOBAL = 0,
00056 
00058     NODE_GENERIC = 1,
00059 
00061     NODE_PARSED_INTEGER = 2,
00063     NODE_PARSED_DOUBLE = 3,
00065     NODE_PARSED_DATE = 4,
00066 
00067     NODE_EXTERNAL = 5
00068     
00069 } NodeType;
00070 
00071 #ifdef _WIN32
00072 /*#warning "win32 defined!"*/
00073 typedef __int64 word64;
00074 typedef unsigned __int64 uword64;
00075 #else/*_WIN32*/
00076 typedef long long int word64;
00077 typedef unsigned long long int uword64;
00078 #endif/* _WIN32 */
00079 #define NODE_CODE 1131
00080 #define NODE_CHECK(x) ((x)->code == NODE_CODE ? 1 : 0)
00081 
00084 typedef struct {
00086     int code;
00088     NodeType type;
00089     union {
00090         long parsed_integer;
00091         double parsed_double;
00092         long parsed_date;
00093         unsigned long id;
00094     };
00096     char *literal;
00097 
00099     char *context;
00100     char *instance_of;
00101     time_t start;
00102     time_t end;
00103 } Node; 
00104     
00105 
00106 
00107 static Node NODE_NULL = { NODE_CODE, NODE_GLOBAL, 0, 0};
00108 
00114 STORAGE_TYPE
00115 Node *node_clone(const Node* src);
00116 
00124 /*NOTUSED*
00125 STORAGE_TYPE
00126 void node_init_dict(Node *node, unsigned long id, const char *string);
00127 */ 
00128 
00142 STORAGE_TYPE
00143 void node_init_string(Node *node, const char *string);
00144 
00148 STORAGE_TYPE
00149 void node_init_integer(Node *node, long value);
00150 
00154 STORAGE_TYPE
00155 void node_init_double(Node *node, double value);
00156 
00157 STORAGE_TYPE
00158 void node_set_instance_of(Node *node, const Node *context, const Node *instance_of);
00159 
00160 /*NOTUSED*
00161 STORAGE_TYPE
00162 void node_init_external(Node *node, const char *uri);
00163 */
00164 
00174 STORAGE_TYPE
00175 void node_set_literal(Node *node, const char *literal, long literal_size);
00176 
00184 STORAGE_TYPE
00185 const char *node_get_literal(Node *node, long *literal_size);
00186 
00187 
00189 STORAGE_TYPE
00190 void node_free(Node *node);
00191 
00192 
00197 STORAGE_TYPE
00198 void node_clear(Node *node);
00199 
00206 void node_print(FILE *channel, Node *node);
00207 
00217 STORAGE_TYPE
00218 int node_compare(const Node *node1, const Node *node2);
00219 
00222 int node_compare_(const Node *node1, const Node *node2);
00223 
00224 
00225 
00226 STORAGE_TYPE
00227 void* kml_malloc(size_t size);
00228 
00229 STORAGE_TYPE
00230 void* kml_calloc(size_t num, size_t size);
00231 
00232 STORAGE_TYPE
00233 void* kml_realloc(void* memblock, size_t size);
00234 
00235 STORAGE_TYPE
00236 void kml_free(void* memblock);
00237 
00238 #ifdef __cplusplus
00239 }
00240 #endif/* __cplusplus */
00241 
00242 #endif /* _NODE_H_ */
00243 #ifdef DMALLOC
00244 #include<dmalloc.h>
00245 #endif

Generated on Wed Dec 27 16:52:17 2006 for VRB Online Server by  doxygen 1.4.4