Changeset 917 for trunk/zoo-project/zoo-kernel/service.h
- Timestamp:
- May 7, 2019, 2:17:08 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property
svn:mergeinfo
set to
False
/branches/prototype-v0 merged eligible
-
Property
svn:mergeinfo
set to
False
-
trunk/zoo-project/zoo-kernel/service.h
r889 r917 2 2 * Author : Gérald FENOY 3 3 * 4 * Copyright (c) 2009-201 5GeoLabs SARL4 * Copyright (c) 2009-2019 GeoLabs SARL 5 5 * 6 6 * Permission is hereby granted, free of charge, to any person obtaining a copy … … 34 34 #endif 35 35 36 // knut: add bool if necessary 37 #ifndef __cplusplus 38 #ifndef WIN32 39 #include <stdbool.h> 40 #else 41 typedef int bool; 42 #define false 0 43 #define true 1 44 #endif 45 #endif 46 #ifndef __bool_true_false_are_defined 47 #define __bool_true_false_are_defined 1 48 #endif 49 36 50 #ifdef WIN32 37 #ifndef USE_MS 38 ZOO_DLL_EXPORT char *strcasestr (char const *,char const *); 39 #endif 40 #endif 41 42 // knut: add bool if necessary 43 #ifndef __cplusplus 44 #ifndef WIN32 45 #include <stdbool.h> 46 #else 47 typedef int bool; 48 #define false 0 49 #define true 1 50 #endif 51 #endif 52 #ifndef __bool_true_false_are_defined 53 #define __bool_true_false_are_defined 1 54 #endif 55 56 #ifdef WIN32 51 #define strtok_r strtok_s 57 52 #define strncasecmp _strnicmp 58 53 #define strcasecmp _stricmp 59 #define strtok_r strtok_s60 54 #if defined(_MSC_VER) && _MSC_VER < 1900 61 55 #define snprintf _snprintf 62 56 #endif 63 /* knut: see new definition of bool above64 #if defined(_MSC_VER) && _MSC_VER < 180065 #define false 066 #define true 167 #define bool int68 #endif69 */70 57 #define zStrdup _strdup 71 58 #define zMkdir _mkdir 59 #define zGetpid _getpid 72 60 #define zOpen _open 61 #define zClose _close 62 #define zUnlink _unlink 63 #define zDup _dup 64 #define zDup2 _dup2 73 65 #define zWrite _write 74 66 #define zSleep Sleep … … 80 72 static int zGettimeofday(struct ztimeval* tp, void* tzp) 81 73 { 82 struct _timeb theTime;83 74 if (tp == 0) { 84 75 return -1; 85 76 } 86 77 78 struct _timeb theTime; 87 79 _ftime(&theTime); 88 80 tp->tv_sec = theTime.time; … … 92 84 } 93 85 86 #define zStatStruct struct _stati64 87 #define zStat _stati64 88 94 89 #else 95 90 /** … … 106 101 #define zOpen open 107 102 /** 103 * The crossplatform close alias 104 */ 105 #define zClose close 106 /** 107 * The crossplatform unlink alias 108 */ 109 #define zUnlink unlink 110 /** 111 * The crossplatform dup alias 112 */ 113 #define zDup dup 114 /** 115 * The crossplatform dup2 alias 116 */ 117 #define zDup2 dup2 118 /** 108 119 * The crossplatform write alias 109 120 */ 110 121 #define zWrite write 122 #include "unistd.h" 111 123 /** 112 124 * The crossplatform sleep alias 113 125 */ 114 #define zSleep sleep 126 static int zSleep(const long millisecond){ 127 return usleep(millisecond*1000); 128 } 115 129 /** 116 130 * The crossplatform gettimeofday alias … … 121 135 */ 122 136 #define ztimeval timeval 137 /** 138 * The crossplatform getpid alias 139 */ 140 #define zGetpid getpid 141 142 #define zStatStruct struct stat64 143 #define zStat stat64 144 123 145 #endif 124 146 … … 140 162 #ifndef WIN32 141 163 #include <ctype.h> 142 //#include <stdbool.h> // knut: see new definition of bool above 164 #include <stdbool.h> 143 165 #endif 144 166 … … 167 189 * The memory size to create an elements 168 190 */ 169 #define ELEMENTS_SIZE (sizeof(char*)+(((2*sizeof(char*))+sizeof(maps*))* 2)+sizeof(char*)+(((2*sizeof(char*))+sizeof(iotype*))*2)+(2*sizeof(elements*)))191 #define ELEMENTS_SIZE (sizeof(char*)+(((2*sizeof(char*))+sizeof(maps*))*3)+sizeof(char*)+((sizeof(map*) + sizeof(iotype*))*2)+(2*sizeof(elements*))) 170 192 /** 171 193 * The memory size to create a map … … 187 209 */ 188 210 //#define SERVICE_SIZE (ELEMENTS_SIZE*2)+(MAP_SIZE*2)+sizeof(char*) 189 #define SERVICE_SIZE sizeof(char*) + 2*sizeof(map*) + 2*sizeof(elements*)211 #define SERVICE_SIZE sizeof(char*) + 3*sizeof(map*) + 2*sizeof(elements*) 190 212 /** 191 213 * The memory size to create a services … … 221 243 #ifdef WIN32 222 244 #define NULLMAP ((map*) 0) 245 // knut: see new definition above 246 //#define bool int 247 //#define true 1 248 //#define false 0 223 249 #else 224 250 #define NULLMAP NULL … … 256 282 struct map* content; //!< the content map 257 283 struct map* metadata; //!< the metadata map 284 struct map* additional_parameters; //!< the additional parameters map 258 285 char* format; //!< the format: LiteralData or ComplexData or BoundingBoxData 259 286 struct iotype* defaults; //!< the default iotype … … 270 297 struct map* content; //!< the content map 271 298 struct map* metadata; //!< the metadata map 299 struct map* additional_parameters; //!< the additional parameters map 272 300 struct elements* inputs; //!< the inputs elements 273 301 struct elements* outputs; //!< the outputs elements … … 290 318 struct registry* next; //!< the next registry pointer 291 319 } registry; 292 320 293 321 // knut 294 322 enum WPSException { 295 296 297 298 */ 299 StatusOK, 300 301 302 303 MissingParameterValue, 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 }; 328 323 /* 324 * StatusOK is not a WPS exception, it is added 325 * here for convenience. 326 */ 327 StatusOK, 328 /* 329 * See WPS 1.0 specification, Table 38 and Table 62. 330 */ 331 MissingParameterValue, 332 InvalidParameterValue, 333 NoApplicableCode, 334 NotEnoughStorage, 335 ServerBusy, 336 FileSizeExceeded, 337 StorageNotSupported, 338 VersionNegotiationFailed, 339 /* 340 * See WPS 2.0 specification, Tables 41, 46, 48, and 50. 341 */ 342 NoSuchProcess, 343 NoSuchMode, 344 NoSuchInput, 345 NoSuchOutput, 346 DataNotAccessible, 347 SizeExceeded, 348 TooManyInputs, 349 TooManyOutputs, 350 NoSuchFormat, 351 WrongInputData, 352 InternalServerError, 353 NoSuchJob, 354 ResultNotReady 355 }; 356 329 357 static const char* const WPSExceptionCode[] = { 330 331 "MissingParameterValue", 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 "ResultNotReady" 352 }; 358 "StatusOK", 359 "MissingParameterValue", 360 "InvalidParameterValue", 361 "NoApplicableCode", 362 "NotEnoughStorage", 363 "ServerBusy", 364 "FileSizeExceeded", 365 "StorageNotSupported", 366 "VersionNegotiationFailed", 367 "NoSuchProcess", 368 "NoSuchMode", 369 "NoSuchInput", 370 "NoSuchOutput", 371 "DataNotAccessible", 372 "SizeExceeded", 373 "TooManyInputs", 374 "TooManyOutputs", 375 "NoSuchFormat", 376 "WrongInputData", 377 "InternalServerError", 378 "NoSuchJob", 379 "ResultNotReady" 380 }; 353 381 354 382 static const char* const WPSExceptionText[] = { 355 356 "Operation request does not include a parameter value, and this server did not declare a default value for that parameter.", 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 383 "No problem detected", 384 "Operation request does not include a parameter value, and this server did not declare a default value for that parameter.", 385 "Operation request contains an invalid parameter value.", 386 "No other exceptionCode specified by this service and server applies to this exception.", 387 "The server does not have enough space available to store the inputs and outputs associated with the request.", 388 "The server is too busy to accept and queue the request at this time.", 389 "The file size of one of the input parameters was too large for this process to handle.", 390 "Execute operation request included transmission=”reference” for one of the outputs, but storage is not offered by this server.", 391 "Service version for a ComplexData xlink:href input was not supported by the referenced server, and version negotiation failed.", 392 "One of the identifiers passed does not match with any of the processes offered by this server.", 393 "The process does not permit the desired execution mode.", 394 "One or more of the input identifiers passed does not match with any of the input identifiers of this process.", 395 "One or more of the output identifiers passed does not match with any of the input identifiers of this process.", 396 "One of the referenced input data sets was inaccessible.", 397 "The size of one of the input parameters was too large for this process to handle.", 398 "Too many input items have been specified.", 399 "Too many output items have been specified.", 400 "One or more of the input or output formats specified in the request did not match with any of the formats defined for that particular input or output.", 401 "One or more of inputs for which the service was able to retrieve the data but could not read it.", 402 "", 403 "The JobID from the request does not match any of the Jobs running on this server.", 404 "The result for the requested JobID has not yet been generated." 377 405 }; 378 406 … … 392 420 ZOO_DLL_EXPORT void freeMap(map**); 393 421 ZOO_DLL_EXPORT void freeMaps(maps** mo); 394 395 422 ZOO_DLL_EXPORT iotype* createIoType(); 396 423 ZOO_DLL_EXPORT elements* createEmptyElements(); 397 ZOO_DLL_EXPORT elements* createElements(c har*);424 ZOO_DLL_EXPORT elements* createElements(const char*); 398 425 ZOO_DLL_EXPORT void setElementsName(elements**,char*); 399 426 ZOO_DLL_EXPORT bool hasElement(elements*,const char*); … … 402 429 ZOO_DLL_EXPORT void freeElements(elements**); 403 430 ZOO_DLL_EXPORT void setServiceName(service**,char*); 431 ZOO_DLL_EXPORT service* createService(); 404 432 ZOO_DLL_EXPORT void freeService(service**); 405 433 ZOO_DLL_EXPORT void addToMap(map*,const char*,const char*); 406 434 ZOO_DLL_EXPORT void addIntToMap(map*,const char*,const int); 435 ZOO_DLL_EXPORT void addIntToMapArray(map*,const char*,int,const int); 407 436 ZOO_DLL_EXPORT map* addToMapWithSize(map*,const char*,const char*,int); 408 437 ZOO_DLL_EXPORT void addMapToMap(map**,map*); … … 446 475 ZOO_DLL_EXPORT bool nonempty(map* map); 447 476 ZOO_DLL_EXPORT bool hasvalue(maps* source, const char* node, const char* key, map** kvp); 477 #ifdef __cplusplus 448 478 ZOO_DLL_EXPORT void setErrorMessage(maps*& conf, const char* service, WPSException exc, const char* message = NULL); 449 ZOO_DLL_EXPORT void logMessage(const char* source, const char* function, int line, const char* file = NULL, const char* message = NULL); 479 ZOO_DLL_EXPORT void logMessage(const char* source, const char* function, int line, const char* file = NULL, const char* message = NULL); 480 #endif 450 481 #define zooLogMsg(file,message) logMessage(__FILE__, __func__, __LINE__, (file), (message)) 451 482 #define zooLog logMessage(__FILE__, __func__, __LINE__) 452 483 453 484 #ifdef __cplusplus 454 485 }
Note: See TracChangeset
for help on using the changeset viewer.