diff --git a/source/bin/uda_cli.cpp b/source/bin/uda_cli.cpp index 45a0fd50..5c166cd8 100644 --- a/source/bin/uda_cli.cpp +++ b/source/bin/uda_cli.cpp @@ -1,5 +1,5 @@ -#include #include +#include #include #include diff --git a/source/c_api/accAPI.cpp b/source/c_api/accAPI.cpp index fc8747bf..40a7a8e7 100644 --- a/source/c_api/accAPI.cpp +++ b/source/c_api/accAPI.cpp @@ -13,16 +13,16 @@ # define strlwr _strlwr #endif +#include "client/generateErrors.h" +#include "client/getEnvironment.h" +#include "client/udaClient.h" #include "clientserver/allocData.h" +#include "clientserver/initStructs.h" #include "clientserver/memstream.h" #include "clientserver/protocol.h" #include "clientserver/stringUtils.h" #include "clientserver/xdrlib.h" -#include "clientserver/initStructs.h" #include "logging/logging.h" -#include "client/generateErrors.h" -#include "client/getEnvironment.h" -#include "client/udaClient.h" #include "version.h" #ifdef __APPLE__ @@ -53,8 +53,6 @@ void udaPutThreadLastHandle(int handle) //-------------------------------------------------------------------------------------- // C Accessor Routines - - //-------------------------------------------------------------- /* Notes: @@ -77,10 +75,10 @@ Rank Ordering is as follows: //! Set a client_flags->flags property /** Set a/multiple specific bit/s in the client_flags->flags property sent to the UDA server. -* -* @param flag The bit/s to be set to 1. -* @return Void. -*/ + * + * @param flag The bit/s to be set to 1. + * @return Void. + */ void udaSetClientFlag(unsigned int flag) { @@ -90,10 +88,10 @@ void udaSetClientFlag(unsigned int flag) //! Reset a client_flags->flags property /** Reset a/multiple specific bit/s in the client_flags->flags property sent to the UDA server. -* -* @param flag The bit/s to be set to 0. -* @return Void. -*/ + * + * @param flag The bit/s to be set to 0. + * @return Void. + */ void udaResetClientFlag(unsigned int flag) { @@ -160,7 +158,7 @@ void udaResetPrivateFlag(unsigned int flag) void udaSetProperty(const char* property) { auto client_flags = udaClientFlags(); - + // User settings for Client and Server behaviour char name[56]; @@ -340,7 +338,7 @@ int udaGetProperty(const char* property) void udaResetProperty(const char* property) { auto client_flags = udaClientFlags(); - + // User settings for Client and Server behaviour if (property[0] == 'g') { @@ -412,7 +410,7 @@ void udaResetProperty(const char* property) void udaResetProperties() { auto client_flags = udaClientFlags(); - + // Reset on Both Client and Server client_flags->get_datadble = 0; @@ -1319,8 +1317,7 @@ char* udaGetAsymmetricError(int handle, int above) int ndata; ndata = data_block->data_n; - data_block->error_type = - data_block->data_type; // Error Type is Unknown so Assume Data's Data Type + data_block->error_type = data_block->data_type; // Error Type is Unknown so Assume Data's Data Type if (allocArray(data_block->error_type, ndata, &errhi) != 0) { // Allocate Heap for Regular Error Data @@ -1603,8 +1600,7 @@ void udaGetDoubleData(int handle, double* fp) } else { generateIdamSyntheticData(handle); if (data_block->synthetic != nullptr) { - memcpy((void*)fp, (void*)data_block->synthetic, - (size_t)data_block->data_n * sizeof(double)); + memcpy((void*)fp, (void*)data_block->synthetic, (size_t)data_block->data_n * sizeof(double)); } else { memcpy((void*)fp, (void*)data_block->data, (size_t)data_block->data_n * sizeof(double)); } @@ -1771,8 +1767,7 @@ void udaGetFloatData(int handle, float* fp) } else { generateIdamSyntheticData(handle); if (data_block->synthetic != nullptr) { - memcpy((void*)fp, (void*)data_block->synthetic, - (size_t)data_block->data_n * sizeof(float)); + memcpy((void*)fp, (void*)data_block->synthetic, (size_t)data_block->data_n * sizeof(float)); } else { memcpy((void*)fp, (void*)data_block->data, (size_t)data_block->data_n * sizeof(float)); } @@ -2298,8 +2293,7 @@ void udaGetDataDescTdi(int handle, char* desc) int udaGetDimNum(int handle, int ndim) { auto data_block = getDataBlock(handle); - if (data_block == nullptr || ndim < 0 || - (unsigned int)ndim >= data_block->rank) { + if (data_block == nullptr || ndim < 0 || (unsigned int)ndim >= data_block->rank) { return 0; } return data_block->dims[ndim].dim_n; @@ -2314,8 +2308,7 @@ int udaGetDimNum(int handle, int ndim) int udaGetDimType(int handle, int ndim) { auto data_block = getDataBlock(handle); - if (data_block == nullptr || ndim < 0 || - (unsigned int)ndim >= data_block->rank) { + if (data_block == nullptr || ndim < 0 || (unsigned int)ndim >= data_block->rank) { return UDA_TYPE_UNKNOWN; } return data_block->dims[ndim].data_type; @@ -2330,8 +2323,7 @@ int udaGetDimType(int handle, int ndim) int udaGetDimErrorType(int handle, int ndim) { auto data_block = getDataBlock(handle); - if (data_block == nullptr || ndim < 0 || - (unsigned int)ndim >= data_block->rank) { + if (data_block == nullptr || ndim < 0 || (unsigned int)ndim >= data_block->rank) { return UDA_TYPE_UNKNOWN; } return data_block->dims[ndim].error_type; @@ -2346,8 +2338,7 @@ int udaGetDimErrorType(int handle, int ndim) int udaGetDimErrorAsymmetry(int handle, int ndim) { auto data_block = getDataBlock(handle); - if (data_block == nullptr || ndim < 0 || - (unsigned int)ndim >= data_block->rank) { + if (data_block == nullptr || ndim < 0 || (unsigned int)ndim >= data_block->rank) { return 0; } return data_block->dims[ndim].errasymmetry; @@ -2356,8 +2347,7 @@ int udaGetDimErrorAsymmetry(int handle, int ndim) void udaGetDimErrorModel(int handle, int ndim, int* model, int* param_n, float* params) { auto data_block = getDataBlock(handle); - if (data_block == nullptr || ndim < 0 || - (unsigned int)ndim >= data_block->rank) { + if (data_block == nullptr || ndim < 0 || (unsigned int)ndim >= data_block->rank) { *model = ERROR_MODEL_UNKNOWN; *param_n = 0; @@ -2380,8 +2370,7 @@ void udaGetDimErrorModel(int handle, int ndim, int* model, int* param_n, float* char* udaGetDimData(int handle, int ndim) { auto data_block = getDataBlock(handle); - if (data_block == nullptr || ndim < 0 || - (unsigned int)ndim >= data_block->rank) { + if (data_block == nullptr || ndim < 0 || (unsigned int)ndim >= data_block->rank) { return nullptr; } auto client_flags = udaClientFlags(); @@ -2400,8 +2389,7 @@ char* udaGetDimData(int handle, int ndim) const char* udaGetDimLabel(int handle, int ndim) { auto data_block = getDataBlock(handle); - if (data_block == nullptr || ndim < 0 || - (unsigned int)ndim >= data_block->rank) { + if (data_block == nullptr || ndim < 0 || (unsigned int)ndim >= data_block->rank) { return nullptr; } return data_block->dims[ndim].dim_label; @@ -2415,8 +2403,7 @@ const char* udaGetDimLabel(int handle, int ndim) const char* udaGetDimUnits(int handle, int ndim) { auto data_block = getDataBlock(handle); - if (data_block == nullptr || ndim < 0 || - (unsigned int)ndim >= data_block->rank) { + if (data_block == nullptr || ndim < 0 || (unsigned int)ndim >= data_block->rank) { return nullptr; } return data_block->dims[ndim].dim_units; @@ -2432,8 +2419,7 @@ const char* udaGetDimUnits(int handle, int ndim) void udaGetDimLabelTdi(int handle, int ndim, char* label) { auto data_block = getDataBlock(handle); - if (data_block == nullptr || ndim < 0 || - (unsigned int)ndim >= data_block->rank) { + if (data_block == nullptr || ndim < 0 || (unsigned int)ndim >= data_block->rank) { return; } strcpy(label, data_block->dims[ndim].dim_label); @@ -2449,8 +2435,7 @@ void udaGetDimLabelTdi(int handle, int ndim, char* label) void udaGetDimUnitsTdi(int handle, int ndim, char* units) { auto data_block = getDataBlock(handle); - if (data_block == nullptr || ndim < 0 || - (unsigned int)ndim >= data_block->rank) { + if (data_block == nullptr || ndim < 0 || (unsigned int)ndim >= data_block->rank) { return; } strcpy(units, data_block->dims[ndim].dim_units); @@ -2468,15 +2453,13 @@ void udaGetDoubleDimData(int handle, int ndim, double* fp) // **** The double array must be TWICE the size if the type is COMPLEX otherwise a seg fault will occur! auto data_block = getDataBlock(handle); - if (data_block == nullptr || ndim < 0 || - (unsigned int)ndim >= data_block->rank) { + if (data_block == nullptr || ndim < 0 || (unsigned int)ndim >= data_block->rank) { return; } auto client_flags = udaClientFlags(); if (data_block->dims[ndim].data_type == UDA_TYPE_DOUBLE) { if (!client_flags->get_synthetic) { - memcpy((void*)fp, (void*)data_block->dims[ndim].dim, - (size_t)data_block->dims[ndim].dim_n * sizeof(double)); + memcpy((void*)fp, (void*)data_block->dims[ndim].dim, (size_t)data_block->dims[ndim].dim_n * sizeof(double)); } else { generateIdamSyntheticDimData(handle, ndim); if (data_block->dims[ndim].synthetic != nullptr) { @@ -2626,15 +2609,13 @@ void udaGetFloatDimData(int handle, int ndim, float* fp) // **** The float array must be TWICE the size if the type is COMPLEX otherwise a seg fault will occur! auto data_block = getDataBlock(handle); - if (data_block == nullptr || ndim < 0 || - (unsigned int)ndim >= data_block->rank) { + if (data_block == nullptr || ndim < 0 || (unsigned int)ndim >= data_block->rank) { return; } auto client_flags = udaClientFlags(); if (data_block->dims[ndim].data_type == UDA_TYPE_FLOAT) { if (!client_flags->get_synthetic) { - memcpy((void*)fp, (void*)data_block->dims[ndim].dim, - (size_t)data_block->dims[ndim].dim_n * sizeof(float)); + memcpy((void*)fp, (void*)data_block->dims[ndim].dim, (size_t)data_block->dims[ndim].dim_n * sizeof(float)); } else { generateIdamSyntheticDimData(handle, ndim); if (data_block->dims[ndim].synthetic != nullptr) { @@ -2805,8 +2786,7 @@ void udaGetGenericDimData(int handle, int ndim, void* data) memcpy(data, (void*)udaGetDimData(handle, ndim), (size_t)udaGetDimNum(handle, ndim) * sizeof(char)); break; case UDA_TYPE_UNSIGNED_INT: - memcpy(data, (void*)udaGetDimData(handle, ndim), - (size_t)udaGetDimNum(handle, ndim) * sizeof(unsigned int)); + memcpy(data, (void*)udaGetDimData(handle, ndim), (size_t)udaGetDimNum(handle, ndim) * sizeof(unsigned int)); break; case UDA_TYPE_UNSIGNED_LONG: memcpy(data, (void*)udaGetDimData(handle, ndim), @@ -2842,8 +2822,7 @@ void udaGetGenericDimData(int handle, int ndim, void* data) DIMS* udaGetDimBlock(int handle, int ndim) { auto data_block = getDataBlock(handle); - if (data_block == nullptr || ndim < 0 || - (unsigned int)ndim >= data_block->rank) { + if (data_block == nullptr || ndim < 0 || (unsigned int)ndim >= data_block->rank) { return nullptr; } return data_block->dims + ndim; @@ -2852,8 +2831,7 @@ DIMS* udaGetDimBlock(int handle, int ndim) char* udaGetDimAsymmetricError(int handle, int ndim, int above) { auto data_block = getDataBlock(handle); - if (data_block == nullptr || ndim < 0 || - (unsigned int)ndim >= data_block->rank) { + if (data_block == nullptr || ndim < 0 || (unsigned int)ndim >= data_block->rank) { return nullptr; } if (data_block->dims[ndim].error_type != UDA_TYPE_UNKNOWN) { @@ -3117,8 +3095,7 @@ char* udaGetDimError(int handle, int ndim) { int above = 1; auto data_block = getDataBlock(handle); - if (data_block == nullptr || ndim < 0 || - (unsigned int)ndim >= data_block->rank) { + if (data_block == nullptr || ndim < 0 || (unsigned int)ndim >= data_block->rank) { return nullptr; } return udaGetDimAsymmetricError(handle, ndim, above); @@ -3129,8 +3106,7 @@ void udaGetFloatDimAsymmetricError(int handle, int ndim, int above, float* fp) // Copy Error Data cast as float to User Provided Array auto data_block = getDataBlock(handle); - if (data_block == nullptr || ndim < 0 || - (unsigned int)ndim >= data_block->rank) { + if (data_block == nullptr || ndim < 0 || (unsigned int)ndim >= data_block->rank) { return; } @@ -3457,8 +3433,7 @@ int udaGetDataCheckSum(int handle) return 0; } - return ( - idamDataCheckSum((void*)data_block->data, data_block->data_n, data_block->data_type)); + return (idamDataCheckSum((void*)data_block->data, data_block->data_n, data_block->data_type)); } int udaGetDimDataCheckSum(int handle, int ndim) @@ -3482,8 +3457,8 @@ int udaGetDimDataCheckSum(int handle, int ndim) // Access to (De)Serialiser void udaGetClientSerialisedDataBlock(int handle, void** object, size_t* objectSize, char** key, size_t* keySize, - int protocolVersion, LOGSTRUCTLIST* log_struct_list, int private_flags, - int malloc_source) + int protocolVersion, LOGSTRUCTLIST* log_struct_list, int private_flags, + int malloc_source) { // Extract the serialised Data Block from Cache or serialise it if not cached (hash key in Data Block, empty if not // cached) Use Case: extract data in object form for storage in external data object store, e.g. CEPH, HDF5 @@ -3544,8 +3519,12 @@ void udaGetClientSerialisedDataBlock(int handle, void** object, size_t* objectSi int udaSetDataTree(int handle) { - if (udaGetDataOpaqueType(handle) != UDA_OPAQUE_TYPE_STRUCTURES) return 0; // Return FALSE - if (udaGetData(handle) == nullptr) return 0; + if (udaGetDataOpaqueType(handle) != UDA_OPAQUE_TYPE_STRUCTURES) { + return 0; // Return FALSE + } + if (udaGetData(handle) == nullptr) { + return 0; + } udaSetFullNTree((NTREE*)udaGetData(handle)); void* opaque_block = udaGetDataOpaqueBlock(handle); diff --git a/source/c_api/clientMDS.cpp b/source/c_api/clientMDS.cpp index 32489312..2bb986c2 100644 --- a/source/c_api/clientMDS.cpp +++ b/source/c_api/clientMDS.cpp @@ -1,8 +1,8 @@ #include +#include "client/startup.h" #include "clientserver/initStructs.h" #include "logging/logging.h" -#include "client/startup.h" /** * Reads the Requested Data diff --git a/source/c_api/udaGetAPI.cpp b/source/c_api/udaGetAPI.cpp index 3f05af21..83c4969e 100644 --- a/source/c_api/udaGetAPI.cpp +++ b/source/c_api/udaGetAPI.cpp @@ -15,8 +15,8 @@ #endif #include "clientserver/errorLog.h" -#include "clientserver/printStructs.h" #include "clientserver/initStructs.h" +#include "clientserver/printStructs.h" #include "logging/logging.h" #include "client/makeClientRequestBlock.h" diff --git a/source/c_api/udaPutAPI.cpp b/source/c_api/udaPutAPI.cpp index 844e053a..69508a10 100644 --- a/source/c_api/udaPutAPI.cpp +++ b/source/c_api/udaPutAPI.cpp @@ -11,8 +11,8 @@ #include "clientserver/allocData.h" #include "clientserver/errorLog.h" -#include "clientserver/printStructs.h" #include "clientserver/initStructs.h" +#include "clientserver/printStructs.h" #include "logging/logging.h" #include "client/makeClientRequestBlock.h" diff --git a/source/cache/cache.h b/source/cache/cache.h index 99b42113..8318105d 100644 --- a/source/cache/cache.h +++ b/source/cache/cache.h @@ -1,16 +1,16 @@ #ifndef UDA_CACHE_CACHE_H #define UDA_CACHE_CACHE_H -#include "structures/genStructs.h" #include "clientserver/udaStructs.h" +#include "structures/genStructs.h" #include void writeCacheData(FILE* fp, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, - const DATA_BLOCK* data_block, int protocolVersion, LOGSTRUCTLIST* log_struct_list, - unsigned int private_flags, int malloc_source); + const DATA_BLOCK* data_block, int protocolVersion, LOGSTRUCTLIST* log_struct_list, + unsigned int private_flags, int malloc_source); DATA_BLOCK* readCacheData(FILE* fp, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, - int protocolVersion, LOGSTRUCTLIST* log_struct_list, unsigned int private_flags, - int malloc_source); + int protocolVersion, LOGSTRUCTLIST* log_struct_list, unsigned int private_flags, + int malloc_source); #endif // UDA_CACHE_CACHE_H \ No newline at end of file diff --git a/source/cache/fileCache.h b/source/cache/fileCache.h index b091a8d8..3a2530ab 100644 --- a/source/cache/fileCache.h +++ b/source/cache/fileCache.h @@ -1,16 +1,15 @@ #ifndef UDA_CACHE_FILECACHE_H #define UDA_CACHE_FILECACHE_H -#include "structures/genStructs.h" #include "clientserver/udaStructs.h" +#include "structures/genStructs.h" DATA_BLOCK* udaFileCacheRead(const REQUEST_DATA* request, LOGMALLOCLIST* logmalloclist, - USERDEFINEDTYPELIST* userdefinedtypelist, int protocolVersion, - LOGSTRUCTLIST* log_struct_list, unsigned int private_flags, int malloc_source); + USERDEFINEDTYPELIST* userdefinedtypelist, int protocolVersion, + LOGSTRUCTLIST* log_struct_list, unsigned int private_flags, int malloc_source); -int udaFileCacheWrite(const DATA_BLOCK* data_block, const REQUEST_BLOCK* request_block, - LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, - int protocolVersion, LOGSTRUCTLIST* log_struct_list, unsigned int private_flags, - int malloc_source); +int udaFileCacheWrite(const DATA_BLOCK* data_block, const REQUEST_BLOCK* request_block, LOGMALLOCLIST* logmalloclist, + USERDEFINEDTYPELIST* userdefinedtypelist, int protocolVersion, LOGSTRUCTLIST* log_struct_list, + unsigned int private_flags, int malloc_source); #endif // UDA_CACHE_FILECACHE_H diff --git a/source/client/closedown.h b/source/client/closedown.h index 4dae5314..175857bb 100644 --- a/source/client/closedown.h +++ b/source/client/closedown.h @@ -12,7 +12,6 @@ enum class ClosedownType { CLOSE_ALL = 1, }; -int closedown(ClosedownType type, SOCKETLIST* socket_list, XDR* client_input, XDR* client_output, - bool* reopen_logs); +int closedown(ClosedownType type, SOCKETLIST* socket_list, XDR* client_input, XDR* client_output, bool* reopen_logs); #endif // UDA_CLIENT_CLOSEDOWN_H diff --git a/source/client/connection.cpp b/source/client/connection.cpp index aa750569..0d8795e1 100644 --- a/source/client/connection.cpp +++ b/source/client/connection.cpp @@ -46,8 +46,8 @@ #include "logging/logging.h" #include "getEnvironment.h" -#include "updateSelectParms.h" #include "uda/client.h" +#include "updateSelectParms.h" #if defined(SSLAUTHENTICATION) && !defined(FATCLIENT) # include diff --git a/source/client/connection.h b/source/client/connection.h index ade48063..67db0a43 100644 --- a/source/client/connection.h +++ b/source/client/connection.h @@ -3,8 +3,8 @@ #ifndef UDA_CLIENT_CONNECTION_H # define UDA_CLIENT_CONNECTION_H -# include "clientserver/udaStructs.h" # include "clientserver/socketStructs.h" +# include "clientserver/udaStructs.h" # include "closedown.h" diff --git a/source/client/generateErrors.cpp b/source/client/generateErrors.cpp index f41d5887..0d143420 100644 --- a/source/client/generateErrors.cpp +++ b/source/client/generateErrors.cpp @@ -15,9 +15,9 @@ #include #include -#include #include "clientserver/allocData.h" #include "clientserver/errorLog.h" +#include #ifndef NO_GSL_LIB # include diff --git a/source/client/generateErrors.h b/source/client/generateErrors.h index 2f5f5b35..85d47a4d 100644 --- a/source/client/generateErrors.h +++ b/source/client/generateErrors.h @@ -1,8 +1,8 @@ #ifndef UDA_CLIENT_GENERATEERRORS_H #define UDA_CLIENT_GENERATEERRORS_H -int idamErrorModel(int model, int param_n, float* params, int data_n, float* data, int* asymmetry, - float* errhi, float* errlo); +int idamErrorModel(int model, int param_n, float* params, int data_n, float* data, int* asymmetry, float* errhi, + float* errlo); int idamSyntheticModel(int model, int param_n, float* params, int data_n, float* data); int generateIdamSyntheticData(int handle); int generateIdamSyntheticDimData(int handle, int ndim); diff --git a/source/client/makeClientRequestBlock.cpp b/source/client/makeClientRequestBlock.cpp index b5a912dd..b30deee6 100644 --- a/source/client/makeClientRequestBlock.cpp +++ b/source/client/makeClientRequestBlock.cpp @@ -22,14 +22,14 @@ Interprets the API arguments and assembles a Request data structure. #include -#include "clientserver/initStructs.h" -#include "clientserver/udaErrors.h" #include "clientserver/errorLog.h" #include "clientserver/expand_path.h" +#include "clientserver/initStructs.h" #include "clientserver/makeRequestBlock.h" #include "clientserver/stringUtils.h" -#include +#include "clientserver/udaErrors.h" #include "logging/logging.h" +#include int makeRequestData(const char* data_object, const char* data_source, REQUEST_DATA* request) { diff --git a/source/client/makeClientRequestBlock.h b/source/client/makeClientRequestBlock.h index 8d09aa4f..1d290e21 100644 --- a/source/client/makeClientRequestBlock.h +++ b/source/client/makeClientRequestBlock.h @@ -3,8 +3,7 @@ #include "clientserver/udaStructs.h" -int makeClientRequestBlock(const char** signals, const char** sources, int count, - REQUEST_BLOCK* request_block); +int makeClientRequestBlock(const char** signals, const char** sources, int count, REQUEST_BLOCK* request_block); void freeClientRequestBlock(REQUEST_BLOCK* request_block); #endif // UDA_CLIENT_MAKECLIENTREQUESTBLOCK_H diff --git a/source/client/startup.cpp b/source/client/startup.cpp index 23cb2f5b..0ed1be3e 100644 --- a/source/client/startup.cpp +++ b/source/client/startup.cpp @@ -17,8 +17,8 @@ #include -#include "clientserver/udaErrors.h" #include "clientserver/errorLog.h" +#include "clientserver/udaErrors.h" #include "logging/logging.h" #include "getEnvironment.h" diff --git a/source/client/udaClient.cpp b/source/client/udaClient.cpp index d6ebdca1..b3e220ed 100644 --- a/source/client/udaClient.cpp +++ b/source/client/udaClient.cpp @@ -5,19 +5,19 @@ #include #include -#include "uda/client.h" -#include "uda/structured.h" -#include "clientserver/initStructs.h" -#include "clientserver/udaErrors.h" #include "cache/fileCache.h" #include "client/connection.h" #include "client/getEnvironment.h" #include "clientserver/errorLog.h" +#include "clientserver/initStructs.h" #include "clientserver/printStructs.h" #include "clientserver/protocol.h" +#include "clientserver/udaErrors.h" #include "clientserver/userid.h" #include "logging/logging.h" #include "structures/struct.h" +#include "uda/client.h" +#include "uda/structured.h" #include "closedown.h" @@ -25,11 +25,11 @@ # include "clientserver/compressDim.h" # include "server/udaServer.h" #else -# include "clientXDRStream.h" # include "cache/fileCache.h" # include "cache/memcache.hpp" -# include +# include "clientXDRStream.h" # include "clientserver/xdrlib.h" +# include # ifdef SSLAUTHENTICATION # include diff --git a/source/client/udaClient.h b/source/client/udaClient.h index 8837c286..ef05bfb2 100644 --- a/source/client/udaClient.h +++ b/source/client/udaClient.h @@ -3,8 +3,8 @@ #ifndef UDA_CLIENT_UDACLIENT_H # define UDA_CLIENT_UDACLIENT_H -# include "structures/genStructs.h" # include "clientserver/udaStructs.h" +# include "structures/genStructs.h" typedef struct ClientFlags { int get_dimdble; // (Server Side) Return Dimensional Data in Double Precision @@ -12,10 +12,10 @@ typedef struct ClientFlags { int get_scalar; // (Server Side) Reduce Rank from 1 to 0 (Scalar) if time data are all zero int get_bytes; // (Server Side) Return IDA Data in native byte or integer array without IDA signal's // calibration factor applied - int get_meta; // (Server Side) return All Meta Data - int get_asis; // (Server Side) Apply no XML based corrections to Data or Dimensions - int get_uncal; // (Server Side) Apply no XML based Calibrations to Data - int get_notoff; // (Server Side) Apply no XML based Timing Corrections to Data + int get_meta; // (Server Side) return All Meta Data + int get_asis; // (Server Side) Apply no XML based corrections to Data or Dimensions + int get_uncal; // (Server Side) Apply no XML based Calibrations to Data + int get_notoff; // (Server Side) Apply no XML based Timing Corrections to Data int get_nodimdata; int get_datadble; // (Client Side) Return Data in Double Precision diff --git a/source/client2/client.cpp b/source/client2/client.cpp index 5460a108..9aa27596 100644 --- a/source/client2/client.cpp +++ b/source/client2/client.cpp @@ -5,19 +5,19 @@ #include "exceptions.hpp" #include "make_request_block.hpp" -#include "clientserver/initStructs.h" -#include "clientserver/udaDefines.h" -#include "clientserver/udaErrors.h" -#include "uda/client.h" #include "cache/fileCache.h" #include "clientserver/allocData.h" #include "clientserver/errorLog.h" +#include "clientserver/initStructs.h" #include "clientserver/printStructs.h" #include "clientserver/protocol.h" #include "clientserver/stringUtils.h" +#include "clientserver/udaDefines.h" +#include "clientserver/udaErrors.h" #include "clientserver/userid.h" #include "clientserver/xdrlib.h" #include "logging/logging.h" +#include "uda/client.h" namespace { @@ -73,7 +73,8 @@ int alloc_meta(DATA_SYSTEM** data_system, SYSTEM_CONFIG** system_config, DATA_SO return err; } -void update_client_block(CLIENT_BLOCK& client_block, const uda::client::ClientFlags& client_flags, unsigned int private_flags) +void update_client_block(CLIENT_BLOCK& client_block, const uda::client::ClientFlags& client_flags, + unsigned int private_flags) { client_block.timeout = client_flags.user_timeout; client_block.clientFlags = client_flags.flags; diff --git a/source/client2/client_environment.cpp b/source/client2/client_environment.cpp index 64036190..fea81ca7 100644 --- a/source/client2/client_environment.cpp +++ b/source/client2/client_environment.cpp @@ -1,7 +1,7 @@ #include "client_environment.hpp" +#include "logging/logging.h" #include #include -#include "logging/logging.h" Environment uda::client::load_environment(bool* env_host, bool* env_port) { diff --git a/source/client2/generate_errors.cpp b/source/client2/generate_errors.cpp index 97491407..de173025 100644 --- a/source/client2/generate_errors.cpp +++ b/source/client2/generate_errors.cpp @@ -3,9 +3,9 @@ #include #include -#include #include "clientserver/allocData.h" #include "clientserver/errorLog.h" +#include #include "thread_client.hpp" diff --git a/source/client2/make_request_block.cpp b/source/client2/make_request_block.cpp index f14f2f54..4f384a1f 100644 --- a/source/client2/make_request_block.cpp +++ b/source/client2/make_request_block.cpp @@ -4,10 +4,10 @@ #include #include -#include "clientserver/initStructs.h" -#include "clientserver/udaErrors.h" #include "clientserver/errorLog.h" #include "clientserver/expand_path.h" +#include "clientserver/initStructs.h" +#include "clientserver/udaErrors.h" #include "logging/logging.h" namespace diff --git a/source/clientserver/allocData.cpp b/source/clientserver/allocData.cpp index b12448e4..9066ed52 100644 --- a/source/clientserver/allocData.cpp +++ b/source/clientserver/allocData.cpp @@ -10,8 +10,8 @@ #include "allocData.h" -#include #include "logging/logging.h" +#include #include "initStructs.h" #include "udaErrors.h" diff --git a/source/clientserver/copyStructs.cpp b/source/clientserver/copyStructs.cpp index e779166d..bcb41af2 100644 --- a/source/clientserver/copyStructs.cpp +++ b/source/clientserver/copyStructs.cpp @@ -1,7 +1,7 @@ #include "copyStructs.h" -#include #include +#include void copyRequestData(REQUEST_DATA* out, REQUEST_DATA in) { @@ -26,4 +26,3 @@ void copyRequestBlock(REQUEST_BLOCK* out, REQUEST_BLOCK in) copyRequestData(&out->requests[i], in.requests[i]); } } - diff --git a/source/clientserver/errorLog.cpp b/source/clientserver/errorLog.cpp index c516f053..04a2ed9e 100644 --- a/source/clientserver/errorLog.cpp +++ b/source/clientserver/errorLog.cpp @@ -3,9 +3,9 @@ #include #include -#include "uda/client.h" #include "clientserver/stringUtils.h" #include "logging/logging.h" +#include "uda/client.h" static std::vector udaerrorstack; diff --git a/source/clientserver/errorLog.h b/source/clientserver/errorLog.h index 2a2d7de3..be822cb0 100644 --- a/source/clientserver/errorLog.h +++ b/source/clientserver/errorLog.h @@ -23,5 +23,5 @@ void udaCloseError(void); #define UDA_ADD_ERROR(ERR, MSG) udaAddError(UDA_CODE_ERROR_TYPE, __func__, ERR, MSG) #define UDA_ADD_SYS_ERROR(MSG) udaAddError(UDA_SYSTEM_ERROR_TYPE, __func__, errno, MSG) #define UDA_THROW_ERROR(ERR, MSG) \ - udaAddError(UDA_CODE_ERROR_TYPE, __func__, ERR, MSG); \ + udaAddError(UDA_CODE_ERROR_TYPE, __func__, ERR, MSG); \ return ERR; diff --git a/source/clientserver/expand_path.cpp b/source/clientserver/expand_path.cpp index 911888f0..df2a7bad 100644 --- a/source/clientserver/expand_path.cpp +++ b/source/clientserver/expand_path.cpp @@ -26,8 +26,8 @@ #include #include -#include "udaErrors.h" #include "logging/logging.h" +#include "udaErrors.h" #include "errorLog.h" #include "stringUtils.h" diff --git a/source/clientserver/initStructs.cpp b/source/clientserver/initStructs.cpp index 28762dfa..9d9e707a 100644 --- a/source/clientserver/initStructs.cpp +++ b/source/clientserver/initStructs.cpp @@ -11,8 +11,8 @@ # include #endif -#include #include +#include void initNameValueList(NAMEVALUELIST* nameValueList) { diff --git a/source/clientserver/makeRequestBlock.cpp b/source/clientserver/makeRequestBlock.cpp index cc30ee18..54b079d6 100644 --- a/source/clientserver/makeRequestBlock.cpp +++ b/source/clientserver/makeRequestBlock.cpp @@ -12,8 +12,8 @@ # include #endif -#include #include "logging/logging.h" +#include #include "errorLog.h" #include "parseXML.h" @@ -46,7 +46,8 @@ static int generic_request_test(const char* source, REQUEST_DATA* request); static int extract_subset(REQUEST_DATA* request); -namespace uda { +namespace uda +{ struct NameValue { std::string pair; std::string name; @@ -54,7 +55,7 @@ struct NameValue { }; std::vector name_value_pairs(std::string_view input, bool strip); -} +} // namespace uda static int find_plugin_id_by_format(const char* format, const PLUGINLIST* plugin_list) { diff --git a/source/clientserver/make_request_block.cpp b/source/clientserver/make_request_block.cpp index 5ba850e5..a07c6f9d 100644 --- a/source/clientserver/make_request_block.cpp +++ b/source/clientserver/make_request_block.cpp @@ -1,6 +1,6 @@ #include "logging/logging.h" -#include "udaStructs.h" #include "server/serverPlugin.h" +#include "udaStructs.h" #include #include diff --git a/source/clientserver/manageSockets.cpp b/source/clientserver/manageSockets.cpp index 57255b97..7d4ac766 100644 --- a/source/clientserver/manageSockets.cpp +++ b/source/clientserver/manageSockets.cpp @@ -10,8 +10,8 @@ # include # include #else -# include # include +# include # define strcasecmp _stricmp # include #endif diff --git a/source/clientserver/nameValueSubstitution.cpp b/source/clientserver/nameValueSubstitution.cpp index 47d78250..03f46896 100644 --- a/source/clientserver/nameValueSubstitution.cpp +++ b/source/clientserver/nameValueSubstitution.cpp @@ -8,13 +8,13 @@ # include #endif -#include "initStructs.h" -#include "udaErrors.h" #include "clientserver/errorLog.h" #include "clientserver/makeRequestBlock.h" #include "clientserver/stringUtils.h" -#include +#include "initStructs.h" #include "logging/logging.h" +#include "udaErrors.h" +#include static void embedded_value_substitution(NAMEVALUELIST* nameValueList); diff --git a/source/clientserver/parseXML.cpp b/source/clientserver/parseXML.cpp index 9c230d8f..ce89801c 100644 --- a/source/clientserver/parseXML.cpp +++ b/source/clientserver/parseXML.cpp @@ -22,10 +22,10 @@ #include "logging/logging.h" #ifndef NOXMLPARSER -# include # include "clientserver/errorLog.h" # include "clientserver/parseOperation.h" # include "clientserver/stringUtils.h" +# include static double deScale(char* scale); static void parse_target_value(xmlDocPtr doc, xmlNodePtr cur, const char* target, double* value); diff --git a/source/clientserver/printStructs.cpp b/source/clientserver/printStructs.cpp index 35253e88..3f613657 100644 --- a/source/clientserver/printStructs.cpp +++ b/source/clientserver/printStructs.cpp @@ -4,9 +4,9 @@ #include "printStructs.h" -#include #include "clientserver/errorLog.h" #include "logging/logging.h" +#include void printRequestData(REQUEST_DATA str) { diff --git a/source/clientserver/protocol.cpp b/source/clientserver/protocol.cpp index ff145ef0..1707f30f 100644 --- a/source/clientserver/protocol.cpp +++ b/source/clientserver/protocol.cpp @@ -23,9 +23,9 @@ #include "protocol.h" -#include -#include #include "logging/logging.h" +#include +#include #include "allocData.h" #include "compressDim.h" diff --git a/source/clientserver/protocol2.cpp b/source/clientserver/protocol2.cpp index f58d87a7..6717b58b 100644 --- a/source/clientserver/protocol2.cpp +++ b/source/clientserver/protocol2.cpp @@ -25,8 +25,8 @@ #include -#include #include "logging/logging.h" +#include #include "allocData.h" #include "compressDim.h" diff --git a/source/clientserver/protocolXML.cpp b/source/clientserver/protocolXML.cpp index e4106e82..b887c712 100644 --- a/source/clientserver/protocolXML.cpp +++ b/source/clientserver/protocolXML.cpp @@ -59,17 +59,17 @@ #include #include -#include #include "logging/logging.h" +#include #include "errorLog.h" #include "protocol.h" +#include "protocolXML2.h" #include "readXDRFile.h" #include "stringUtils.h" +#include "structures/struct.h" #include "udaErrors.h" #include "xdrlib.h" -#include "protocolXML2.h" -#include "structures/struct.h" #ifdef HIERARCHICAL_DATA # include "allocXMLData.h" @@ -242,9 +242,8 @@ int protocolXML(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOC UDA_LOG(UDA_LOG_DEBUG, "protocolXML: Structure Definitions sent: rc = %d\n", rc); // send the Data - rc = rc && - xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, u, (void**)data, - protocolVersion, xdr_stdio_flag, log_struct_list, malloc_source); + rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, u, (void**)data, + protocolVersion, xdr_stdio_flag, log_struct_list, malloc_source); UDA_LOG(UDA_LOG_DEBUG, "protocolXML: Data sent: rc = %d\n", rc); @@ -444,9 +443,9 @@ int protocolXML(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOC UDA_LOG(UDA_LOG_DEBUG, "protocolXML: udaXDRUserDefinedTypeData #A\n"); initUserDefinedType(udt_received); - rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received, - &data, protocolVersion, xdr_stdio_flag, log_struct_list, - malloc_source); // receive the Data + rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received, &data, + protocolVersion, xdr_stdio_flag, log_struct_list, + malloc_source); // receive the Data UDA_LOG(UDA_LOG_DEBUG, "protocolXML: udaXDRUserDefinedTypeData #B\n"); if (!rc) { @@ -602,10 +601,9 @@ int protocolXML(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOC initUserDefinedType(udt_received); - rc = - rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received, - &data, protocolVersion, xdr_stdio_flag, log_struct_list, - malloc_source); // receive the Data + rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received, + &data, protocolVersion, xdr_stdio_flag, log_struct_list, + malloc_source); // receive the Data if (!rc) { err = 999; diff --git a/source/clientserver/protocolXML2.cpp b/source/clientserver/protocolXML2.cpp index ab33a849..29aff3e8 100644 --- a/source/clientserver/protocolXML2.cpp +++ b/source/clientserver/protocolXML2.cpp @@ -328,8 +328,8 @@ int protocolXML2(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLO } rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, u, (void**)data, - protocolVersion, xdr_stdio_flag, log_struct_list, - malloc_source); // send the Data + protocolVersion, xdr_stdio_flag, log_struct_list, + malloc_source); // send the Data UDA_LOG(UDA_LOG_DEBUG, "Data sent: rc = %d\n", rc); @@ -710,9 +710,9 @@ int protocolXML2(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLO UDA_LOG(UDA_LOG_DEBUG, "udaXDRUserDefinedTypeData #A\n"); initUserDefinedType(udt_received); - rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received, - &data, protocolVersion, xdr_stdio_flag, log_struct_list, - malloc_source); // receive the Data + rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received, &data, + protocolVersion, xdr_stdio_flag, log_struct_list, + malloc_source); // receive the Data UDA_LOG(UDA_LOG_DEBUG, "udaXDRUserDefinedTypeData #B\n"); if (!rc) { @@ -904,10 +904,9 @@ int protocolXML2(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLO initUserDefinedType(udt_received); - rc = - rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received, - &data, protocolVersion, xdr_stdio_flag, log_struct_list, - malloc_source); // receive the Data + rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received, + &data, protocolVersion, xdr_stdio_flag, log_struct_list, + malloc_source); // receive the Data if (!rc) { err = 999; @@ -1039,10 +1038,9 @@ int protocolXML2(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLO initUserDefinedType(udt_received); - rc = - rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received, - &data, protocolVersion, xdr_stdio_flag, log_struct_list, - malloc_source); // receive the Data + rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received, + &data, protocolVersion, xdr_stdio_flag, log_struct_list, + malloc_source); // receive the Data if (!rc) { err = 999; @@ -1230,7 +1228,7 @@ int unpackXDRFile(LOGMALLOCLIST* logmalloclist, XDR* xdrs, unsigned char* filena initUserDefinedType(udt_received); rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received, &data, - protocolVersion, xdr_stdio_flag, log_struct_list, malloc_source); + protocolVersion, xdr_stdio_flag, log_struct_list, malloc_source); if (!rc) { err = 999; @@ -1340,7 +1338,7 @@ int unpackXDRObject(LOGMALLOCLIST* logmalloclist, XDR* xdrs, unsigned char* obje initUserDefinedType(udt_received); rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received, &data, - protocolVersion, xdr_stdio_flag, log_struct_list, malloc_source); + protocolVersion, xdr_stdio_flag, log_struct_list, malloc_source); if (!rc) { err = 999; diff --git a/source/clientserver/protocolXML2.h b/source/clientserver/protocolXML2.h index f3dc691f..ab53fd3b 100644 --- a/source/clientserver/protocolXML2.h +++ b/source/clientserver/protocolXML2.h @@ -11,8 +11,8 @@ #endif int protocolXML2(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOCLIST* logmalloclist, - USERDEFINEDTYPELIST* userdefinedtypelist, void* str, int protocolVersion, - LOGSTRUCTLIST* log_struct_list, unsigned int private_flags, int malloc_source); + USERDEFINEDTYPELIST* userdefinedtypelist, void* str, int protocolVersion, + LOGSTRUCTLIST* log_struct_list, unsigned int private_flags, int malloc_source); int xdrUserDefinedTypeData(XDR* xdrs, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, USERDEFINEDTYPE* userdefinedtype, void** data, int protocolVersion, bool xdr_stdio_flag, diff --git a/source/clientserver/protocolXML2Put.cpp b/source/clientserver/protocolXML2Put.cpp index cde50452..e449d0a7 100644 --- a/source/clientserver/protocolXML2Put.cpp +++ b/source/clientserver/protocolXML2Put.cpp @@ -9,8 +9,8 @@ #include "errorLog.h" #include "protocol.h" #include "stringUtils.h" -#include "xdrlib.h" #include "structures/struct.h" +#include "xdrlib.h" #ifdef SERVERBUILD # include "server/serverStartup.h" @@ -1440,8 +1440,7 @@ int xdrUserDefinedDataPut(XDR* xdrs, LOGMALLOCLIST* logmalloclist, LOGSTRUCTLIST if (udaGettypeof(type) != UDA_TYPE_UNKNOWN) { char* z = (char*)*p; - rc = rc && - xdrAtomicData(logmalloclist, xdrs, type, count, size, &z); // Must be an Atomic Type + rc = rc && xdrAtomicData(logmalloclist, xdrs, type, count, size, &z); // Must be an Atomic Type *p = (VOIDTYPE)z; break; } else { @@ -1483,7 +1482,7 @@ int udaXDRUserDefinedTypeDataPut(XDR* xdrs, LOGMALLOCLIST* logmalloclist, USERDE NTREE* dataNTree = nullptr; rc = rc && xdr_userdefinedtype(xdrs, userdefinedtypelist, - userdefinedtype); // User Defined Type Definitions + userdefinedtype); // User Defined Type Definitions rc = rc && xdrUserDefinedDataPut(xdrs, logmalloclist, log_struct_list, userdefinedtypelist, userdefinedtype, data, 1, @@ -1499,7 +1498,7 @@ int udaXDRUserDefinedTypeDataPut(XDR* xdrs, LOGMALLOCLIST* logmalloclist, USERDE } rc = xdr_userdefinedtype(xdrs, userdefinedtypelist, - userdefinedtype); // User Defined Type Definitions + userdefinedtype); // User Defined Type Definitions rc = rc && xdrUserDefinedDataPut(xdrs, logmalloclist, log_struct_list, userdefinedtypelist, userdefinedtype, data, 1, diff --git a/source/clientserver/protocolXML2Put.h b/source/clientserver/protocolXML2Put.h index 0b012cdb..82b7eb3a 100644 --- a/source/clientserver/protocolXML2Put.h +++ b/source/clientserver/protocolXML2Put.h @@ -7,23 +7,22 @@ #include "structures/genStructs.h" int xdrUserDefinedDataPut(XDR* xdrs, LOGMALLOCLIST* logmalloclist, LOGSTRUCTLIST* log_struct_list, - USERDEFINEDTYPELIST* userdefinedtypelist, USERDEFINEDTYPE* userdefinedtype, - void** data, int datacount, int structRank, int* structShape, int index, - NTREE** NTree, int protocolVersion, int malloc_source); + USERDEFINEDTYPELIST* userdefinedtypelist, USERDEFINEDTYPE* userdefinedtype, void** data, + int datacount, int structRank, int* structShape, int index, NTREE** NTree, + int protocolVersion, int malloc_source); // Send/Receive Array of Structures -int xdrUserDefinedTypeDataPut(XDR* xdrs, LOGMALLOCLIST* logmalloclist, - USERDEFINEDTYPELIST* userdefinedtypelist, USERDEFINEDTYPE* userdefinedtype, - void** data, int protocolVersion, LOGSTRUCTLIST* log_struct_list, - int malloc_source); +int xdrUserDefinedTypeDataPut(XDR* xdrs, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, + USERDEFINEDTYPE* userdefinedtype, void** data, int protocolVersion, + LOGSTRUCTLIST* log_struct_list, int malloc_source); bool_t xdr_userdefinedtype(XDR* xdrs, USERDEFINEDTYPELIST* userdefinedtypelist, USERDEFINEDTYPE* str); bool_t xdr_userdefinedtypelistPut(XDR* xdrs, USERDEFINEDTYPELIST* str); int protocolXML2Put(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOCLIST* logmalloclist, - USERDEFINEDTYPELIST* userdefinedtypelist, void* str, int protocolVersion, - LOGSTRUCTLIST* log_struct_list, unsigned int private_flags, int malloc_source); + USERDEFINEDTYPELIST* userdefinedtypelist, void* str, int protocolVersion, + LOGSTRUCTLIST* log_struct_list, unsigned int private_flags, int malloc_source); #endif // UDA_CLIENTSERVER_PROTOCOLXML2PUT_H diff --git a/source/clientserver/readXDRFile.cpp b/source/clientserver/readXDRFile.cpp index 8ab0935b..3fa2cd64 100644 --- a/source/clientserver/readXDRFile.cpp +++ b/source/clientserver/readXDRFile.cpp @@ -1,8 +1,8 @@ #include "readXDRFile.h" +#include "logging/logging.h" #include #include -#include "logging/logging.h" #include "errorLog.h" diff --git a/source/clientserver/stringUtils.h b/source/clientserver/stringUtils.h index 6e224fa4..5601ee22 100644 --- a/source/clientserver/stringUtils.h +++ b/source/clientserver/stringUtils.h @@ -3,10 +3,10 @@ #ifndef UDA_CLIENTSERVER_STRINGUTILS_H # define UDA_CLIENTSERVER_STRINGUTILS_H +# include # include # include # include -# include # include # ifndef _WIN32 diff --git a/source/clientserver/xdrlib.cpp b/source/clientserver/xdrlib.cpp index 86fb98fd..ed8b13dd 100644 --- a/source/clientserver/xdrlib.cpp +++ b/source/clientserver/xdrlib.cpp @@ -473,9 +473,9 @@ bool_t xdr_serialise_object(XDR* xdrs, LOGMALLOCLIST* logmalloclist, USERDEFINED // Send the data rc = rc && xdr_userdefinedtypelist(xdrs, userdefinedtypelist, - xdr_stdio_flag); // send the full set of known named structures + xdr_stdio_flag); // send the full set of known named structures rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, u, (void**)data, protocolVersion, - xdr_stdio_flag, log_struct_list, malloc_source); // send the Data + xdr_stdio_flag, log_struct_list, malloc_source); // send the Data if (!rc) { err = 999; @@ -518,8 +518,8 @@ bool_t xdr_serialise_object(XDR* xdrs, LOGMALLOCLIST* logmalloclist, USERDEFINED initUserDefinedType(udt_received); rc = rc && xdrUserDefinedTypeData(xdrs, logmalloclist, userdefinedtypelist, udt_received, &data, - protocolVersion, xdr_stdio_flag, log_struct_list, - malloc_source); // receive the Data + protocolVersion, xdr_stdio_flag, log_struct_list, + malloc_source); // receive the Data if (!rc) { err = 999; diff --git a/source/include/uda.h b/source/include/uda.h index 35d9158e..f8967682 100644 --- a/source/include/uda.h +++ b/source/include/uda.h @@ -1,14 +1,14 @@ #pragma once #ifndef UDA_H -#define UDA_H +# define UDA_H -# include # include # include # include # include # include +# include # ifdef __cplusplus # include diff --git a/source/include/uda/client.h b/source/include/uda/client.h index 0ba84aba..d95615a3 100644 --- a/source/include/uda/client.h +++ b/source/include/uda/client.h @@ -17,8 +17,8 @@ extern "C" { #define DATA_BLOCK_RECEIPT_ERROR (-15000) #define ERROR_CONDITION_UNKNOWN (-16000) -#define MIN_STATUS (-1) // Deny Access to Data if this Status Value -#define DATA_STATUS_BAD (-17000) // Error Code if Status is Bad +#define MIN_STATUS (-1) // Deny Access to Data if this Status Value +#define DATA_STATUS_BAD (-17000) // Error Code if Status is Bad typedef struct LogMallocList LOGMALLOCLIST; typedef struct UserDefinedTypeList USERDEFINEDTYPELIST; @@ -37,22 +37,22 @@ LIBRARY_API int udaGetBatchAPI(const char** uda_signals, const char** sources, i LIBRARY_API int udaGetAPIWithHost(const char* data_object, const char* data_source, const char* host, int port); LIBRARY_API int udaGetBatchAPIWithHost(const char** uda_signals, const char** sources, int count, int* handles, - const char* host, int port); + const char* host, int port); LIBRARY_API int udaPutListAPI(const char* putInstruction, PUTDATA_BLOCK_LIST* inPutDataBlockList); LIBRARY_API int udaPutAPI(const char* putInstruction, PUTDATA_BLOCK* inPutData); -LIBRARY_API int udaClientAPI(const char *file, const char *signal, int pass, int exp_number); +LIBRARY_API int udaClientAPI(const char* file, const char* signal, int pass, int exp_number); -LIBRARY_API int udaClientFileAPI(const char *file, const char *signal, const char *format); +LIBRARY_API int udaClientFileAPI(const char* file, const char* signal, const char* format); -LIBRARY_API int udaClientFileAPI2(const char *file, const char *format, const char *owner, const char *signal, - int exp_number, int pass); +LIBRARY_API int udaClientFileAPI2(const char* file, const char* format, const char* owner, const char* signal, + int exp_number, int pass); -LIBRARY_API int udaClientTestAPI(const char *file, const char *signal, int pass, int exp_number); +LIBRARY_API int udaClientTestAPI(const char* file, const char* signal, int pass, int exp_number); -LIBRARY_API int udaClientMDS(const char *server, const char *tree, const char *node, int treenum); +LIBRARY_API int udaClientMDS(const char* server, const char* tree, const char* node, int treenum); LIBRARY_API void udaFree(int handle); @@ -61,26 +61,26 @@ LIBRARY_API void udaFreeAll(); /** * Get the version of the client c-library. */ -LIBRARY_API const char *udaGetBuildVersion(); +LIBRARY_API const char* udaGetBuildVersion(); /** * Get the date that the client c-library was built. */ -LIBRARY_API const char *udaGetBuildDate(); +LIBRARY_API const char* udaGetBuildDate(); -LIBRARY_API const char *udaGetServerHost(); +LIBRARY_API const char* udaGetServerHost(); LIBRARY_API int udaGetServerPort(); LIBRARY_API int udaGetServerSocket(); -LIBRARY_API const char *udaGetClientDOI(); +LIBRARY_API const char* udaGetClientDOI(); -LIBRARY_API const char *udaGetServerDOI(); +LIBRARY_API const char* udaGetServerDOI(); -LIBRARY_API const char *udaGetClientOSName(); +LIBRARY_API const char* udaGetClientOSName(); -LIBRARY_API const char *udaGetServerOSName(); +LIBRARY_API const char* udaGetServerOSName(); LIBRARY_API int udaGetClientVersion(); @@ -88,7 +88,7 @@ LIBRARY_API int udaGetServerVersion(); LIBRARY_API int udaGetServerErrorCode(); -LIBRARY_API const char *udaGetServerErrorMsg(); +LIBRARY_API const char* udaGetServerErrorMsg(); LIBRARY_API int udaGetServerErrorStackSize(); @@ -96,22 +96,22 @@ LIBRARY_API int udaGetServerErrorStackRecordType(int record); LIBRARY_API int udaGetServerErrorStackRecordCode(int record); -LIBRARY_API const char *udaGetServerErrorStackRecordLocation(int record); +LIBRARY_API const char* udaGetServerErrorStackRecordLocation(int record); -LIBRARY_API const char *udaGetServerErrorStackRecordMsg(int record); +LIBRARY_API const char* udaGetServerErrorStackRecordMsg(int record); LIBRARY_API void udaCloseAllConnections(); LIBRARY_API int udaNumErrors(void); -LIBRARY_API const char *udaGetErrorMessage(int err_num); +LIBRARY_API const char* udaGetErrorMessage(int err_num); LIBRARY_API int udaGetErrorCode(int err_num); -LIBRARY_API const char *udaGetErrorLocation(int err_num); +LIBRARY_API const char* udaGetErrorLocation(int err_num); LIBRARY_API PUTDATA_BLOCK* udaNewPutDataBlock(UDA_TYPE data_type, int count, int rank, int* shape, const char* data); LIBRARY_API void udaFreePutDataBlock(PUTDATA_BLOCK* putdata_block); -LIBRARY_API LOGMALLOCLIST *udaGetLogMallocList(int handle); -LIBRARY_API USERDEFINEDTYPELIST *udaGetUserDefinedTypeList(int handle); +LIBRARY_API LOGMALLOCLIST* udaGetLogMallocList(int handle); +LIBRARY_API USERDEFINEDTYPELIST* udaGetUserDefinedTypeList(int handle); #define UDA_NUM_CLIENT_THREADS 30 @@ -123,11 +123,11 @@ LIBRARY_API void udaSetClientFlag(unsigned int flag); LIBRARY_API void udaResetClientFlag(unsigned int flag); -LIBRARY_API void udaSetProperty(const char *property); +LIBRARY_API void udaSetProperty(const char* property); -LIBRARY_API int udaGetProperty(const char *property); +LIBRARY_API int udaGetProperty(const char* property); -LIBRARY_API void udaResetProperty(const char *property); +LIBRARY_API void udaResetProperty(const char* property); LIBRARY_API void udaResetProperties(); @@ -139,23 +139,23 @@ LIBRARY_API int udaGetMemoryUsed(); #endif -LIBRARY_API void udaPutErrorModel(int handle, int model, int param_n, const float *params); +LIBRARY_API void udaPutErrorModel(int handle, int model, int param_n, const float* params); -LIBRARY_API void udaPutDimErrorModel(int handle, int ndim, int model, int param_n, const float *params); +LIBRARY_API void udaPutDimErrorModel(int handle, int ndim, int model, int param_n, const float* params); -LIBRARY_API void udaPutServer(const char *host, int port); +LIBRARY_API void udaPutServer(const char* host, int port); -LIBRARY_API void udaPutServerHost(const char *host); +LIBRARY_API void udaPutServerHost(const char* host); LIBRARY_API void udaPutServerPort(int port); LIBRARY_API void udaPutServerSocket(int socket); -LIBRARY_API void udaGetServer(const char **host, int *port, int *socket); +LIBRARY_API void udaGetServer(const char** host, int* port, int* socket); LIBRARY_API int udaGetErrorCode(int handle); -LIBRARY_API const char *udaGetErrorMsg(int handle); +LIBRARY_API const char* udaGetErrorMsg(int handle); LIBRARY_API int udaGetSourceStatus(int handle); @@ -177,43 +177,43 @@ LIBRARY_API int udaGetDataType(int handle); LIBRARY_API int udaGetDataOpaqueType(int handle); -LIBRARY_API void *udaGetDataOpaqueBlock(int handle); +LIBRARY_API void* udaGetDataOpaqueBlock(int handle); LIBRARY_API int udaGetDataOpaqueCount(int handle); -LIBRARY_API void udaGetErrorModel(int handle, int *model, int *param_n, float *params); +LIBRARY_API void udaGetErrorModel(int handle, int* model, int* param_n, float* params); LIBRARY_API int udaGetErrorType(int handle); -LIBRARY_API int udaGetDataTypeId(const char *type); +LIBRARY_API int udaGetDataTypeId(const char* type); LIBRARY_API int udaGetDataTypeSize(int type); -LIBRARY_API void udaGetErrorModel(int handle, int *model, int *param_n, float *params); +LIBRARY_API void udaGetErrorModel(int handle, int* model, int* param_n, float* params); LIBRARY_API int udaGetErrorAsymmetry(int handle); -LIBRARY_API int udaGetErrorModelId(const char *model); +LIBRARY_API int udaGetErrorModelId(const char* model); -LIBRARY_API char *udaGetSyntheticData(int handle); +LIBRARY_API char* udaGetSyntheticData(int handle); -LIBRARY_API char *udaGetSyntheticDimData(int handle, int ndim); +LIBRARY_API char* udaGetSyntheticDimData(int handle, int ndim); -LIBRARY_API void udaSetSyntheticData(int handle, char *data); +LIBRARY_API void udaSetSyntheticData(int handle, char* data); -LIBRARY_API void udaSetSyntheticDimData(int handle, int ndim, char *data); +LIBRARY_API void udaSetSyntheticDimData(int handle, int ndim, char* data); -LIBRARY_API char *udaGetSyntheticData(int handle); +LIBRARY_API char* udaGetSyntheticData(int handle); -LIBRARY_API char *udaGetData(int handle); +LIBRARY_API char* udaGetData(int handle); -LIBRARY_API void udaGetDataTdi(int handle, char *data); +LIBRARY_API void udaGetDataTdi(int handle, char* data); -LIBRARY_API char *udaGetAsymmetricError(int handle, int above); +LIBRARY_API char* udaGetAsymmetricError(int handle, int above); -LIBRARY_API char *udaGetDataErrLo(int handle); +LIBRARY_API char* udaGetDataErrLo(int handle); -LIBRARY_API char *udaGetDataErrHi(int handle); +LIBRARY_API char* udaGetDataErrHi(int handle); LIBRARY_API int udaGetDataErrAsymmetry(int handle); @@ -221,11 +221,11 @@ LIBRARY_API void udaSetDataErrAsymmetry(int handle, int asymmetry); LIBRARY_API void udaSetDataErrType(int handle, int type); -LIBRARY_API void udaSetDataErrLo(int handle, char *errlo); +LIBRARY_API void udaSetDataErrLo(int handle, char* errlo); -LIBRARY_API char *udaGetDimErrLo(int handle, int ndim); +LIBRARY_API char* udaGetDimErrLo(int handle, int ndim); -LIBRARY_API char *udaGetDimErrHi(int handle, int ndim); +LIBRARY_API char* udaGetDimErrHi(int handle, int ndim); LIBRARY_API int udaGetDimErrAsymmetry(int handle, int ndim); @@ -233,31 +233,31 @@ LIBRARY_API void udaSetDimErrAsymmetry(int handle, int ndim, int asymmetry); LIBRARY_API void udaSetDimErrType(int handle, int ndim, int type); -LIBRARY_API void udaSetDimErrLo(int handle, int ndim, char *errlo); +LIBRARY_API void udaSetDimErrLo(int handle, int ndim, char* errlo); -LIBRARY_API char *udaGetError(int handle); +LIBRARY_API char* udaGetError(int handle); -LIBRARY_API void udaGetDoubleData(int handle, double *fp); +LIBRARY_API void udaGetDoubleData(int handle, double* fp); -LIBRARY_API void udaGetFloatData(int handle, float *fp); +LIBRARY_API void udaGetFloatData(int handle, float* fp); -LIBRARY_API void udaGetGenericData(int handle, void *data); +LIBRARY_API void udaGetGenericData(int handle, void* data); -LIBRARY_API void udaGetFloatAsymmetricError(int handle, int above, float *fp); +LIBRARY_API void udaGetFloatAsymmetricError(int handle, int above, float* fp); -LIBRARY_API void udaGetFloatError(int handle, float *fp); +LIBRARY_API void udaGetFloatError(int handle, float* fp); -LIBRARY_API const char *udaGetDataLabel(int handle); +LIBRARY_API const char* udaGetDataLabel(int handle); -LIBRARY_API void udaGetDataLabelTdi(int handle, char *label); +LIBRARY_API void udaGetDataLabelTdi(int handle, char* label); -LIBRARY_API const char *udaGetDataUnits(int handle); +LIBRARY_API const char* udaGetDataUnits(int handle); -LIBRARY_API void udaGetDataUnitsTdi(int handle, char *units); +LIBRARY_API void udaGetDataUnitsTdi(int handle, char* units); -LIBRARY_API const char *udaGetDataDesc(int handle); +LIBRARY_API const char* udaGetDataDesc(int handle); -LIBRARY_API void udaGetDataDescTdi(int handle, char *desc); +LIBRARY_API void udaGetDataDescTdi(int handle, char* desc); LIBRARY_API int udaGetDimNum(int handle, int ndim); @@ -267,35 +267,35 @@ LIBRARY_API int udaGetDimErrorType(int handle, int ndim); LIBRARY_API int udaGetDimErrorAsymmetry(int handle, int ndim); -LIBRARY_API void udaGetDimErrorModel(int handle, int ndim, int *model, int *param_n, float *params); +LIBRARY_API void udaGetDimErrorModel(int handle, int ndim, int* model, int* param_n, float* params); -LIBRARY_API char *udaGetSyntheticDimData(int handle, int ndim); +LIBRARY_API char* udaGetSyntheticDimData(int handle, int ndim); -LIBRARY_API char *udaGetDimData(int handle, int ndim); +LIBRARY_API char* udaGetDimData(int handle, int ndim); -LIBRARY_API const char *udaGetDimLabel(int handle, int ndim); +LIBRARY_API const char* udaGetDimLabel(int handle, int ndim); -LIBRARY_API const char *udaGetDimUnits(int handle, int ndim); +LIBRARY_API const char* udaGetDimUnits(int handle, int ndim); -LIBRARY_API void udaGetDimLabelTdi(int handle, int ndim, char *label); +LIBRARY_API void udaGetDimLabelTdi(int handle, int ndim, char* label); -LIBRARY_API void udaGetDimUnitsTdi(int handle, int ndim, char *units); +LIBRARY_API void udaGetDimUnitsTdi(int handle, int ndim, char* units); -LIBRARY_API void udaGetDoubleDimData(int handle, int ndim, double *fp); +LIBRARY_API void udaGetDoubleDimData(int handle, int ndim, double* fp); -LIBRARY_API void udaGetFloatDimData(int handle, int ndim, float *fp); +LIBRARY_API void udaGetFloatDimData(int handle, int ndim, float* fp); -LIBRARY_API void udaGetGenericDimData(int handle, int ndim, void *data); +LIBRARY_API void udaGetGenericDimData(int handle, int ndim, void* data); -LIBRARY_API char *udaGetDimAsymmetricError(int handle, int ndim, int above); +LIBRARY_API char* udaGetDimAsymmetricError(int handle, int ndim, int above); -LIBRARY_API char *udaGetDimError(int handle, int ndim); +LIBRARY_API char* udaGetDimError(int handle, int ndim); -LIBRARY_API void udaGetFloatDimAsymmetricError(int handle, int ndim, int above, float *fp); +LIBRARY_API void udaGetFloatDimAsymmetricError(int handle, int ndim, int above, float* fp); -LIBRARY_API void udaGetFloatDimError(int handle, int ndim, float *fp); +LIBRARY_API void udaGetFloatDimError(int handle, int ndim, float* fp); -LIBRARY_API int udaDataCheckSum(void *data, int data_n, int type); +LIBRARY_API int udaDataCheckSum(void* data, int data_n, int type); LIBRARY_API int udaGetDataCheckSum(int handle); @@ -313,9 +313,9 @@ LIBRARY_API int udaGetMaxThreadCount(); LIBRARY_API int udaSetDataTree(int handle); -LIBRARY_API NTREE *udaGetDataTree(int handle); +LIBRARY_API NTREE* udaGetDataTree(int handle); -LIBRARY_API NTREE *udaFindIdamNTreeStructureDefinition(NTREE *node, const char *target); +LIBRARY_API NTREE* udaFindIdamNTreeStructureDefinition(NTREE* node, const char* target); #ifdef __cplusplus } diff --git a/source/include/uda/legacy.h b/source/include/uda/legacy.h index 3eee43b9..aa0bc8dd 100644 --- a/source/include/uda/legacy.h +++ b/source/include/uda/legacy.h @@ -1,7 +1,7 @@ #pragma once #ifndef UDA_LEGACY_H -#define UDA_LEGACY_H +# define UDA_LEGACY_H // to delete just used for debugging... // #include "client.h" diff --git a/source/include/uda/plugins.h b/source/include/uda/plugins.h index 37602698..6c58bffd 100644 --- a/source/include/uda/plugins.h +++ b/source/include/uda/plugins.h @@ -32,27 +32,35 @@ LIBRARY_API const char* udaPluginFunction(UDA_PLUGIN_INTERFACE* plugin_interface LIBRARY_API void udaPluginLog(UDA_PLUGIN_INTERFACE* plugin_interface, const char* fmt, ...); -LIBRARY_API void udaAddPluginError(UDA_PLUGIN_INTERFACE* plugin_interface, const char* location, int code, const char* msg); +LIBRARY_API void udaAddPluginError(UDA_PLUGIN_INTERFACE* plugin_interface, const char* location, int code, + const char* msg); LIBRARY_API UDA_PLUGIN_INTERFACE* udaCreatePluginInterface(const char* request); LIBRARY_API void udaFreePluginInterface(UDA_PLUGIN_INTERFACE* plugin_interface); LIBRARY_API COMPOUNDFIELD* udaNewCompoundField(const char* name, const char* description, int* offset, int type); -LIBRARY_API COMPOUNDFIELD* udaNewCompoundArrayField(const char* name, const char* description, int* offset, int type, int rank, int* shape); +LIBRARY_API COMPOUNDFIELD* udaNewCompoundArrayField(const char* name, const char* description, int* offset, int type, + int rank, int* shape); -LIBRARY_API COMPOUNDFIELD* udaNewCompoundUserTypeField(const char* name, const char* description, int* offset, USERDEFINEDTYPE* user_type); -LIBRARY_API COMPOUNDFIELD* udaNewCompoundUserTypePointerField(const char* name, const char* description, int* offset, USERDEFINEDTYPE* user_type); -LIBRARY_API COMPOUNDFIELD* udaNewCompoundUserTypeArrayField(const char* name, const char* description, int* offset, USERDEFINEDTYPE* user_type, int rank, int* shape); +LIBRARY_API COMPOUNDFIELD* udaNewCompoundUserTypeField(const char* name, const char* description, int* offset, + USERDEFINEDTYPE* user_type); +LIBRARY_API COMPOUNDFIELD* udaNewCompoundUserTypePointerField(const char* name, const char* description, int* offset, + USERDEFINEDTYPE* user_type); +LIBRARY_API COMPOUNDFIELD* udaNewCompoundUserTypeArrayField(const char* name, const char* description, int* offset, + USERDEFINEDTYPE* user_type, int rank, int* shape); -LIBRARY_API USERDEFINEDTYPE* udaNewUserType(const char* name, const char* source, int ref_id, int image_count, char* image, size_t size, size_t num_fields, COMPOUNDFIELD** fields); +LIBRARY_API USERDEFINEDTYPE* udaNewUserType(const char* name, const char* source, int ref_id, int image_count, + char* image, size_t size, size_t num_fields, COMPOUNDFIELD** fields); LIBRARY_API int udaAddUserType(UDA_PLUGIN_INTERFACE*, USERDEFINEDTYPE* user_type); LIBRARY_API int udaRegisterMalloc(UDA_PLUGIN_INTERFACE* plugin_interface, void* data, int, size_t, const char*); -LIBRARY_API int udaRegisterMallocArray(UDA_PLUGIN_INTERFACE* plugin_interface, void* data, int count, size_t size, const char* type, int rank, int* shape); +LIBRARY_API int udaRegisterMallocArray(UDA_PLUGIN_INTERFACE* plugin_interface, void* data, int count, size_t size, + const char* type, int rank, int* shape); LIBRARY_API int udaPluginPluginsCount(UDA_PLUGIN_INTERFACE* plugin_interface); -LIBRARY_API int udaPluginCheckPluginClass(UDA_PLUGIN_INTERFACE* plugin_interface, int plugin_num, const char* plugin_class); +LIBRARY_API int udaPluginCheckPluginClass(UDA_PLUGIN_INTERFACE* plugin_interface, int plugin_num, + const char* plugin_class); LIBRARY_API const char* udaPluginPluginFormat(UDA_PLUGIN_INTERFACE* plugin_interface, int plugin_num); LIBRARY_API const char* udaPluginPluginExtension(UDA_PLUGIN_INTERFACE* plugin_interface, int plugin_num); LIBRARY_API const char* udaPluginPluginDescription(UDA_PLUGIN_INTERFACE* plugin_interface, int plugin_num); @@ -61,9 +69,11 @@ LIBRARY_API const char* udaPluginPluginExample(UDA_PLUGIN_INTERFACE* plugin_inte LIBRARY_API int udaPluginReturnDataLabel(UDA_PLUGIN_INTERFACE* plugin_interface, const char* label); LIBRARY_API int udaPluginReturnDataUnits(UDA_PLUGIN_INTERFACE* plugin_interface, const char* units); -#define UDA_DEF_SET_RETURN_FUNCS(NAME, TYPE) \ -LIBRARY_API int udaPluginReturnData##NAME##Scalar(UDA_PLUGIN_INTERFACE* plugin_interface, TYPE value, const char* description); \ -LIBRARY_API int udaPluginReturnData##NAME##Array(UDA_PLUGIN_INTERFACE* plugin_interface, const TYPE* values, size_t rank, const size_t* shape, const char* description); +#define UDA_DEF_SET_RETURN_FUNCS(NAME, TYPE) \ + LIBRARY_API int udaPluginReturnData##NAME##Scalar(UDA_PLUGIN_INTERFACE* plugin_interface, TYPE value, \ + const char* description); \ + LIBRARY_API int udaPluginReturnData##NAME##Array(UDA_PLUGIN_INTERFACE* plugin_interface, const TYPE* values, \ + size_t rank, const size_t* shape, const char* description); UDA_DEF_SET_RETURN_FUNCS(Float, float) UDA_DEF_SET_RETURN_FUNCS(Double, double) @@ -76,33 +86,39 @@ UDA_DEF_SET_RETURN_FUNCS(UInt, unsigned int) UDA_DEF_SET_RETURN_FUNCS(Long, long) UDA_DEF_SET_RETURN_FUNCS(ULong, unsigned long) -LIBRARY_API int udaPluginReturnDataStringScalar(UDA_PLUGIN_INTERFACE* plugin_interface, const char* value, const char* description); -LIBRARY_API int udaPluginReturnDataStringArray(UDA_PLUGIN_INTERFACE* plugin_interface, const char** values, size_t rank, const size_t* shape, const char* description); +LIBRARY_API int udaPluginReturnDataStringScalar(UDA_PLUGIN_INTERFACE* plugin_interface, const char* value, + const char* description); +LIBRARY_API int udaPluginReturnDataStringArray(UDA_PLUGIN_INTERFACE* plugin_interface, const char** values, size_t rank, + const size_t* shape, const char* description); #undef UDA_DEF_SET_RETURN_FUNCS -LIBRARY_API int udaPluginReturnData(UDA_PLUGIN_INTERFACE* plugin_interface, void* value, size_t size, UDA_TYPE type, int rank, - const int* shape, const char* description); +LIBRARY_API int udaPluginReturnData(UDA_PLUGIN_INTERFACE* plugin_interface, void* value, size_t size, UDA_TYPE type, + int rank, const int* shape, const char* description); -LIBRARY_API int udaPluginReturnDimensionFloatArray(UDA_PLUGIN_INTERFACE* plugin_interface, int dim_n, float* data, size_t size, const char* label, const char* units); +LIBRARY_API int udaPluginReturnDimensionFloatArray(UDA_PLUGIN_INTERFACE* plugin_interface, int dim_n, float* data, + size_t size, const char* label, const char* units); LIBRARY_API int udaPluginReturnErrorAsymmetry(UDA_PLUGIN_INTERFACE* plugin_interface, bool flag); LIBRARY_API int udaPluginReturnErrorLow(UDA_PLUGIN_INTERFACE* plugin_interface, float* data, size_t size); LIBRARY_API int udaPluginReturnErrorHigh(UDA_PLUGIN_INTERFACE* plugin_interface, float* data, size_t size); LIBRARY_API int udaPluginReturnDataOrder(UDA_PLUGIN_INTERFACE* plugin_interface, int order); -LIBRARY_API int udaPluginReturnCompoundData(UDA_PLUGIN_INTERFACE* plugin_interface, char* data, const char* user_type, const char* description); -LIBRARY_API int udaPluginReturnCompoundArrayData(UDA_PLUGIN_INTERFACE *plugin_interface, char* data, const char *user_type, const char* description, int rank, int* shape); +LIBRARY_API int udaPluginReturnCompoundData(UDA_PLUGIN_INTERFACE* plugin_interface, char* data, const char* user_type, + const char* description); +LIBRARY_API int udaPluginReturnCompoundArrayData(UDA_PLUGIN_INTERFACE* plugin_interface, char* data, + const char* user_type, const char* description, int rank, int* shape); LIBRARY_API int udaPluginArgumentCount(const UDA_PLUGIN_INTERFACE* plugin_interface); LIBRARY_API const char* udaPluginArgument(const UDA_PLUGIN_INTERFACE* plugin_interface, int num); - LIBRARY_API bool udaPluginFindArg(const UDA_PLUGIN_INTERFACE* plugin_interface, const char* name); -#define UDA_DEF_FIND_FUNCS(NAME, TYPE) \ -LIBRARY_API bool udaPluginFind##NAME##Arg(const UDA_PLUGIN_INTERFACE* plugin_interface, TYPE* value, const char* name); \ -LIBRARY_API bool udaPluginFind##NAME##ArrayArg(const UDA_PLUGIN_INTERFACE* plugin_interface, TYPE** value, size_t* nvalues, const char* name); +#define UDA_DEF_FIND_FUNCS(NAME, TYPE) \ + LIBRARY_API bool udaPluginFind##NAME##Arg(const UDA_PLUGIN_INTERFACE* plugin_interface, TYPE* value, \ + const char* name); \ + LIBRARY_API bool udaPluginFind##NAME##ArrayArg(const UDA_PLUGIN_INTERFACE* plugin_interface, TYPE** value, \ + size_t* nvalues, const char* name); UDA_DEF_FIND_FUNCS(Float, float) UDA_DEF_FIND_FUNCS(Double, double) @@ -124,86 +140,98 @@ UDA_DEF_FIND_FUNCS(String, const char*) #define CONCAT(X, Y) CONCAT_(X, Y) #define UNIQUE_VAR(NAME) __func__##NAME##__ -#define UDA_RAISE_PLUGIN_ERROR_AND_EXIT(PLUGIN_INTERFACE, MSG) \ +#define UDA_RAISE_PLUGIN_ERROR_AND_EXIT(PLUGIN_INTERFACE, MSG) \ { \ int UNIQUE_VAR(err) = 999; \ - udaPluginLog(PLUGIN_INTERFACE, "%s\n", MSG); \ + udaPluginLog(PLUGIN_INTERFACE, "%s\n", MSG); \ udaAddPluginError(__func__, UNIQUE_VAR(err), MSG); \ return UNIQUE_VAR(err); \ } -#define UDA_RAISE_PLUGIN_ERROR(PLUGIN_INTERFACE, MSG) \ +#define UDA_RAISE_PLUGIN_ERROR(PLUGIN_INTERFACE, MSG) \ { \ int UNIQUE_VAR(err) = 999; \ - udaPluginLog(PLUGIN_INTERFACE, "%s\n", MSG); \ + udaPluginLog(PLUGIN_INTERFACE, "%s\n", MSG); \ udaAddPluginError(PLUGIN_INTERFACE, __func__, UNIQUE_VAR(err), MSG); \ return UNIQUE_VAR(err); \ } -#define UDA_RAISE_PLUGIN_ERROR_F(PLUGIN_INTERFACE, MSG, FMT, ...) \ +#define UDA_RAISE_PLUGIN_ERROR_F(PLUGIN_INTERFACE, MSG, FMT, ...) \ { \ int UNIQUE_VAR(err) = 999; \ - udaPluginLog(PLUGIN_INTERFACE, "%s\n", FMT, __VA_ARGS__); \ + udaPluginLog(PLUGIN_INTERFACE, "%s\n", FMT, __VA_ARGS__); \ udaAddPluginError(PLUGIN_INTERFACE, __func__, UNIQUE_VAR(err), MSG); \ return UNIQUE_VAR(err); \ } -#define UDA_RAISE_PLUGIN_ERROR_AND_EXIT_F(PLUGIN_INTERFACE, MSG, FMT, ...) \ +#define UDA_RAISE_PLUGIN_ERROR_AND_EXIT_F(PLUGIN_INTERFACE, MSG, FMT, ...) \ { \ int UNIQUE_VAR(err) = 999; \ - udaPluginLog(PLUGIN_INTERFACE, "%s\n", FMT, __VA_ARGS__); \ + udaPluginLog(PLUGIN_INTERFACE, "%s\n", FMT, __VA_ARGS__); \ udaAddPluginError(PLUGIN_INTERFACE, __func__, UNIQUE_VAR(err), MSG); \ return UNIQUE_VAR(err); \ } -#define UDA_RAISE_PLUGIN_ERROR_EX(PLUGIN_INTERFACE, MSG, CODE) \ +#define UDA_RAISE_PLUGIN_ERROR_EX(PLUGIN_INTERFACE, MSG, CODE) \ int UNIQUE_VAR(err) = 999; \ - udaPluginLog(PLUGIN_INTERFACE, "%s", MSG); \ + udaPluginLog(PLUGIN_INTERFACE, "%s", MSG); \ udaAddPluginError(PLUGIN_INTERFACE, __func__, UNIQUE_VAR(err), MSG); \ - { CODE } \ + { \ + CODE \ + } \ return UNIQUE_VAR(err); -#define UDA_FIND_REQUIRED_VALUE(PLUGIN_INTERFACE, VARIABLE, TYPE) \ - if (!udaPluginFind##TYPE##Arg(PLUGIN_INTERFACE, &VARIABLE, QUOTE(VARIABLE))) { \ - UDA_RAISE_PLUGIN_ERROR(PLUGIN_INTERFACE, "Required argument '" QUOTE(VARIABLE) "' not given"); \ +#define UDA_FIND_REQUIRED_VALUE(PLUGIN_INTERFACE, VARIABLE, TYPE) \ + if (!udaPluginFind##TYPE##Arg(PLUGIN_INTERFACE, &VARIABLE, QUOTE(VARIABLE))) { \ + UDA_RAISE_PLUGIN_ERROR(PLUGIN_INTERFACE, "Required argument '" QUOTE(VARIABLE) "' not given"); \ } -#define UDA_FIND_REQUIRED_ARRAY(PLUGIN_INTERFACE, VARIABLE, TYPE) \ - if (!udaPluginFind##TYPE##ArrayArg(PLUGIN_INTERFACE, &VARIABLE, CONCAT(&n, VARIABLE), QUOTE(VARIABLE))) { \ - UDA_RAISE_PLUGIN_ERROR(PLUGIN_INTERFACE, "Required argument '" QUOTE(VARIABLE) "' not given"); \ +#define UDA_FIND_REQUIRED_ARRAY(PLUGIN_INTERFACE, VARIABLE, TYPE) \ + if (!udaPluginFind##TYPE##ArrayArg(PLUGIN_INTERFACE, &VARIABLE, CONCAT(&n, VARIABLE), QUOTE(VARIABLE))) { \ + UDA_RAISE_PLUGIN_ERROR(PLUGIN_INTERFACE, "Required argument '" QUOTE(VARIABLE) "' not given"); \ } #define UDA_FIND_REQUIRED_INT_VALUE(PLUGIN_INTERFACE, VARIABLE) UDA_FIND_REQUIRED_VALUE(PLUGIN_INTERFACE, VARIABLE, Int) -#define UDA_FIND_REQUIRED_SHORT_VALUE(PLUGIN_INTERFACE, VARIABLE) UDA_FIND_REQUIRED_VALUE(PLUGIN_INTERFACE, VARIABLE, Short) -#define UDA_FIND_REQUIRED_CHAR_VALUE(PLUGIN_INTERFACE, VARIABLE) UDA_FIND_REQUIRED_VALUE(PLUGIN_INTERFACE, VARIABLE, Char) -#define UDA_FIND_REQUIRED_FLOAT_VALUE(PLUGIN_INTERFACE, VARIABLE) UDA_FIND_REQUIRED_VALUE(PLUGIN_INTERFACE, VARIABLE, Float) -#define UDA_FIND_REQUIRED_STRING_VALUE(PLUGIN_INTERFACE, VARIABLE) UDA_FIND_REQUIRED_VALUE(PLUGIN_INTERFACE, VARIABLE, String) +#define UDA_FIND_REQUIRED_SHORT_VALUE(PLUGIN_INTERFACE, VARIABLE) \ + UDA_FIND_REQUIRED_VALUE(PLUGIN_INTERFACE, VARIABLE, Short) +#define UDA_FIND_REQUIRED_CHAR_VALUE(PLUGIN_INTERFACE, VARIABLE) \ + UDA_FIND_REQUIRED_VALUE(PLUGIN_INTERFACE, VARIABLE, Char) +#define UDA_FIND_REQUIRED_FLOAT_VALUE(PLUGIN_INTERFACE, VARIABLE) \ + UDA_FIND_REQUIRED_VALUE(PLUGIN_INTERFACE, VARIABLE, Float) +#define UDA_FIND_REQUIRED_STRING_VALUE(PLUGIN_INTERFACE, VARIABLE) \ + UDA_FIND_REQUIRED_VALUE(PLUGIN_INTERFACE, VARIABLE, String) #define UDA_FIND_REQUIRED_INT_ARRAY(PLUGIN_INTERFACE, VARIABLE) UDA_FIND_REQUIRED_ARRAY(PLUGIN_INTERFACE, VARIABLE, Int) -#define UDA_FIND_REQUIRED_FLOAT_ARRAY(PLUGIN_INTERFACE, VARIABLE) UDA_FIND_REQUIRED_ARRAY(PLUGIN_INTERFACE, VARIABLE, Float) -#define UDA_FIND_REQUIRED_DOUBLE_ARRAY(PLUGIN_INTERFACE, VARIABLE) UDA_FIND_REQUIRED_ARRAY(PLUGIN_INTERFACE, VARIABLE, Double) +#define UDA_FIND_REQUIRED_FLOAT_ARRAY(PLUGIN_INTERFACE, VARIABLE) \ + UDA_FIND_REQUIRED_ARRAY(PLUGIN_INTERFACE, VARIABLE, Float) +#define UDA_FIND_REQUIRED_DOUBLE_ARRAY(PLUGIN_INTERFACE, VARIABLE) \ + UDA_FIND_REQUIRED_ARRAY(PLUGIN_INTERFACE, VARIABLE, Double) #define UDA_FIND_INT_VALUE(PLUGIN_INTERFACE, VARIABLE) udaPluginFindIntArg(PLUGIN_INTERFACE, &VARIABLE, QUOTE(VARIABLE)) -#define UDA_FIND_SHORT_VALUE(PLUGIN_INTERFACE, VARIABLE) udaPluginFindShortArg(PLUGIN_INTERFACE, &VARIABLE, QUOTE(VARIABLE)) -#define UDA_FIND_CHAR_VALUE(PLUGIN_INTERFACE, VARIABLE) udaPluginFindCharArg(PLUGIN_INTERFACE, &VARIABLE, QUOTE(VARIABLE)) -#define UDA_FIND_FLOAT_VALUE(PLUGIN_INTERFACE, VARIABLE) udaPluginFindFloatArg(PLUGIN_INTERFACE, &VARIABLE, QUOTE(VARIABLE)) -#define UDA_FIND_STRING_VALUE(PLUGIN_INTERFACE, VARIABLE) udaPluginFindStringArg(PLUGIN_INTERFACE, &VARIABLE, QUOTE(VARIABLE)) - -#define UDA_FIND_INT_ARRAY(PLUGIN_INTERFACE, VARIABLE) \ +#define UDA_FIND_SHORT_VALUE(PLUGIN_INTERFACE, VARIABLE) \ + udaPluginFindShortArg(PLUGIN_INTERFACE, &VARIABLE, QUOTE(VARIABLE)) +#define UDA_FIND_CHAR_VALUE(PLUGIN_INTERFACE, VARIABLE) \ + udaPluginFindCharArg(PLUGIN_INTERFACE, &VARIABLE, QUOTE(VARIABLE)) +#define UDA_FIND_FLOAT_VALUE(PLUGIN_INTERFACE, VARIABLE) \ + udaPluginFindFloatArg(PLUGIN_INTERFACE, &VARIABLE, QUOTE(VARIABLE)) +#define UDA_FIND_STRING_VALUE(PLUGIN_INTERFACE, VARIABLE) \ + udaPluginFindStringArg(PLUGIN_INTERFACE, &VARIABLE, QUOTE(VARIABLE)) + +#define UDA_FIND_INT_ARRAY(PLUGIN_INTERFACE, VARIABLE) \ udaPluginFindIntArrayArg(PLUGIN_INTERFACE, &VARIABLE, CONCAT(&n, VARIABLE), QUOTE(VARIABLE)) -#define UDA_FIND_FLOAT_ARRAY(PLUGIN_INTERFACE, VARIABLE) \ +#define UDA_FIND_FLOAT_ARRAY(PLUGIN_INTERFACE, VARIABLE) \ udaPluginFindFloatArrayArg(PLUGIN_INTERFACE, &VARIABLE, CONCAT(&n, VARIABLE), QUOTE(VARIABLE)) -#define UDA_FIND_DOUBLE_ARRAY(PLUGIN_INTERFACE, VARIABLE) \ +#define UDA_FIND_DOUBLE_ARRAY(PLUGIN_INTERFACE, VARIABLE) \ udaPluginFindDoubleArrayArg(PLUGIN_INTERFACE, &VARIABLE, CONCAT(&n, VARIABLE), QUOTE(VARIABLE)) -#define UDA_CALL_PLUGIN(PLUGIN_INTERFACE, FMT, ...) \ +#define UDA_CALL_PLUGIN(PLUGIN_INTERFACE, FMT, ...) \ { \ char UNIQUE_VAR(request)[1024]; \ snprintf(UNIQUE_VAR(request), 1024, FMT, __VA_ARGS__); \ UNIQUE_VAR(request)[1023] = '\0'; \ - int UNIQUE_VAR(err) = callPlugin(PLUGIN_INTERFACE, UNIQUE_VAR(request)); \ + int UNIQUE_VAR(err) = callPlugin(PLUGIN_INTERFACE, UNIQUE_VAR(request)); \ if (UNIQUE_VAR(err)) { \ - UDA_RAISE_PLUGIN_ERROR("Plugin call failed"); \ + UDA_RAISE_PLUGIN_ERROR("Plugin call failed"); \ } \ } diff --git a/source/include/uda/structured.h b/source/include/uda/structured.h index f83d2fb0..5e67f25d 100644 --- a/source/include/uda/structured.h +++ b/source/include/uda/structured.h @@ -1,14 +1,14 @@ #ifndef UDA_STRUCTURED_H #define UDA_STRUCTURED_H -#include #include +#include #include #include -#define MAXELEMENTS 256 // Max number of structure elements -#define MAXELEMENTNAME 256 // structure element name +#define MAXELEMENTS 256 // Max number of structure elements +#define MAXELEMENTNAME 256 // structure element name #ifdef __cplusplus extern "C" { @@ -364,7 +364,8 @@ LIBRARY_API void udaPrintError(int warning, int line, char* file, char* msg); LIBRARY_API int udaFindUserDefinedTypeId(USERDEFINEDTYPELIST* userdefinedtypelist, const char* name); -LIBRARY_API USERDEFINEDTYPE* udaFindUserDefinedType(USERDEFINEDTYPELIST* userdefinedtypelist, const char* name, int ref_id); +LIBRARY_API USERDEFINEDTYPE* udaFindUserDefinedType(USERDEFINEDTYPELIST* userdefinedtypelist, const char* name, + int ref_id); LIBRARY_API int udaTestUserDefinedType(USERDEFINEDTYPELIST* userdefinedtypelist, USERDEFINEDTYPE* udt); @@ -1072,8 +1073,8 @@ LIBRARY_API int udaMaxCountVlenStructureArray(NTREE* tree, const char* target, i * @return An integer returning an error code: 0 => OK. */ LIBRARY_API int udaRegulariseVlenStructures(LOGMALLOCLIST* logmalloclist, NTREE* tree, - USERDEFINEDTYPELIST* userdefinedtypelist, const char* target, - unsigned int count); + USERDEFINEDTYPELIST* userdefinedtypelist, const char* target, + unsigned int count); /** Regularise the Shape of All VLEN structured data arrays in the data tree: necessary for accessing in some languages, * e.g. IDL. @@ -1084,7 +1085,7 @@ LIBRARY_API int udaRegulariseVlenStructures(LOGMALLOCLIST* logmalloclist, NTREE* * @return An integer returning an error code: 0 => OK. */ LIBRARY_API int udaRegulariseVlenData(LOGMALLOCLIST* logmalloclist, NTREE* tree, - USERDEFINEDTYPELIST* userdefinedtypelist); + USERDEFINEDTYPELIST* userdefinedtypelist); //--------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------- diff --git a/source/include/uda/types.h b/source/include/uda/types.h index 4a540c3f..494d5c07 100644 --- a/source/include/uda/types.h +++ b/source/include/uda/types.h @@ -13,19 +13,19 @@ extern "C" { #endif -//#define NO_SOCKET_CONNECTION (-10000) -//#define PROBLEM_OPENING_LOGS (-11000) -//#define FILE_FORMAT_NOT_SUPPORTED (-12000) -//#define ERROR_ALLOCATING_DATA_BOCK_HEAP (-13000) -//#define SERVER_BLOCK_ERROR (-14000) -//#define SERVER_SIDE_ERROR (-14001) -//#define DATA_BLOCK_RECEIPT_ERROR (-15000) -//#define ERROR_CONDITION_UNKNOWN (-16000) +// #define NO_SOCKET_CONNECTION (-10000) +// #define PROBLEM_OPENING_LOGS (-11000) +// #define FILE_FORMAT_NOT_SUPPORTED (-12000) +// #define ERROR_ALLOCATING_DATA_BOCK_HEAP (-13000) +// #define SERVER_BLOCK_ERROR (-14000) +// #define SERVER_SIDE_ERROR (-14001) +// #define DATA_BLOCK_RECEIPT_ERROR (-15000) +// #define ERROR_CONDITION_UNKNOWN (-16000) // -//#define NO_EXP_NUMBER_SPECIFIED (-18005) +// #define NO_EXP_NUMBER_SPECIFIED (-18005) // -//#define MIN_STATUS (-1) // Deny Access to Data if this Status Value -//#define DATA_STATUS_BAD (-17000) // Error Code if Status is Bad +// #define MIN_STATUS (-1) // Deny Access to Data if this Status Value +// #define DATA_STATUS_BAD (-17000) // Error Code if Status is Bad /** * Data Type Codes diff --git a/source/logging/accessLog.cpp b/source/logging/accessLog.cpp index a592b442..210a1366 100644 --- a/source/logging/accessLog.cpp +++ b/source/logging/accessLog.cpp @@ -21,10 +21,10 @@ # include #endif +#include "clientserver/errorLog.h" +#include "clientserver/stringUtils.h" #include "logging.h" #include -#include "clientserver/stringUtils.h" -#include "clientserver/errorLog.h" #if defined(SERVERBUILD) || defined(FATCLIENT) # include diff --git a/source/logging/accessLog.h b/source/logging/accessLog.h index 31222fcc..52a5d808 100644 --- a/source/logging/accessLog.h +++ b/source/logging/accessLog.h @@ -13,8 +13,8 @@ extern "C" { unsigned int countDataBlockListSize(const DATA_BLOCK_LIST* data_block_list, CLIENT_BLOCK* client_block); unsigned int countDataBlockSize(const DATA_BLOCK* data_block, CLIENT_BLOCK* client_block); -void udaAccessLog(int init, CLIENT_BLOCK client_block, REQUEST_BLOCK request_block, - SERVER_BLOCK server_block, unsigned int total_datablock_size); +void udaAccessLog(int init, CLIENT_BLOCK client_block, REQUEST_BLOCK request_block, SERVER_BLOCK server_block, + unsigned int total_datablock_size); #ifdef __cplusplus } diff --git a/source/plugins/bytes/bytesPlugin.cpp b/source/plugins/bytes/bytesPlugin.cpp index b96acac4..946f7098 100644 --- a/source/plugins/bytes/bytesPlugin.cpp +++ b/source/plugins/bytes/bytesPlugin.cpp @@ -1,10 +1,10 @@ #include "bytesPlugin.h" -#include "logging/logging.h" #include "clientserver/errorLog.h" #include "clientserver/makeRequestBlock.h" #include "clientserver/stringUtils.h" #include "include/uda/uda_plugin_base.hpp" +#include "logging/logging.h" #include diff --git a/source/plugins/bytes/readBytesNonOptimally.cpp b/source/plugins/bytes/readBytesNonOptimally.cpp index a1e7d104..98e78ac1 100644 --- a/source/plugins/bytes/readBytesNonOptimally.cpp +++ b/source/plugins/bytes/readBytesNonOptimally.cpp @@ -1,12 +1,12 @@ #include "readBytesNonOptimally.h" -#include +#include #include #include -#include +#include #include -#include #include +#include #define BYTEFILEDOESNOTEXIST 100001 #define BYTEFILEATTRIBUTEERROR 100002 @@ -16,8 +16,10 @@ #define BYTEFILEMD5ERROR 100006 #define BYTEFILEMD5DIFF 100007 -namespace { -int is_legal_file_path(const char *str) { +namespace +{ +int is_legal_file_path(const char* str) +{ // Basic check that the filename complies with good naming practice - some protection against malign embedded code! // Test against the Portable Filename Character Set A-Z, a-z, 0-9, , and and // Include and back-slash for windows filenames only, forward-slash for the path seperator and $ for @@ -28,7 +30,7 @@ int is_legal_file_path(const char *str) { // path // - const char *tst = str; + const char* tst = str; while (*tst != '\0') { if ((*tst >= '0' && *tst <= '9') || (*tst >= 'A' && *tst <= 'Z') || (*tst >= 'a' && *tst <= 'z')) { tst++; @@ -50,7 +52,7 @@ int is_legal_file_path(const char *str) { } return 1; } -} +} // namespace EVP_MD_CTX* new_hash_context() { @@ -80,7 +82,7 @@ std::string get_hash_sum(EVP_MD_CTX* context) std::stringstream ss; ss << std::hex << std::setw(2) << std::setfill('0'); for (unsigned int i = 0; i < length; ++i) { - ss << (int) hash[i]; + ss << (int)hash[i]; } hash_string = ss.str(); } @@ -89,7 +91,8 @@ std::string get_hash_sum(EVP_MD_CTX* context) return hash_string; } -std::string exec(const char* cmd) { +std::string exec(const char* cmd) +{ std::array buffer; std::string result; std::unique_ptr pipe(popen(cmd, "r"), pclose); @@ -186,15 +189,15 @@ int readBytes(const std::string& path, UDA_PLUGIN_INTERFACE* plugin_interface) update_hash(ctx, bp, nchar); auto read_hash = get_hash_sum(ctx); - int shape[] = { (int)nchar }; + int shape[] = {(int)nchar}; udaPluginReturnData(plugin_interface, bp, nchar, UDA_TYPE_CHAR, 1, shape, read_hash.c_str()); // TODO: read sha256 sum command from config and try and run -// std::string cmd = "sha3sum -a 256 -b " + path; -// auto file_hash = exec(cmd.c_str()); + // std::string cmd = "sha3sum -a 256 -b " + path; + // auto file_hash = exec(cmd.c_str()); udaPluginLog(plugin_interface, "File Size : %d \n", nchar); -// udaPluginLog(plugin_interface, "File Checksum : %s \n", file_hash.c_str()); + // udaPluginLog(plugin_interface, "File Checksum : %s \n", file_hash.c_str()); udaPluginLog(plugin_interface, "Read Checksum : %s \n", read_hash.c_str()); return err; diff --git a/source/plugins/bytes/readBytesNonOptimally.h b/source/plugins/bytes/readBytesNonOptimally.h index 9b3c92f2..0e88065c 100644 --- a/source/plugins/bytes/readBytesNonOptimally.h +++ b/source/plugins/bytes/readBytesNonOptimally.h @@ -9,7 +9,7 @@ extern "C" { #endif -int readBytes(const std::string &path, UDA_PLUGIN_INTERFACE *plugin_interface); +int readBytes(const std::string& path, UDA_PLUGIN_INTERFACE* plugin_interface); #ifdef __cplusplus } diff --git a/source/plugins/hdf5/readHDF58.cpp b/source/plugins/hdf5/readHDF58.cpp index 8930502c..3c92be8b 100644 --- a/source/plugins/hdf5/readHDF58.cpp +++ b/source/plugins/hdf5/readHDF58.cpp @@ -25,8 +25,8 @@ # include #endif -#include "clientserver/udaErrors.h" #include "clientserver/errorLog.h" +#include "clientserver/udaErrors.h" #ifdef NOHDF5PLUGIN @@ -45,12 +45,12 @@ void H5Fclose(int fh) #else # include "clientserver/initStructs.h" -# include +# include "clientserver/stringUtils.h" # include # include -# include "clientserver/stringUtils.h" # include # include +# include // #define H5TEST diff --git a/source/plugins/help/help_plugin.cpp b/source/plugins/help/help_plugin.cpp index 9d1bc76c..09a5c6e2 100644 --- a/source/plugins/help/help_plugin.cpp +++ b/source/plugins/help/help_plugin.cpp @@ -1,10 +1,10 @@ #include "help_plugin.h" -#include #include -#include -#include +#include #include +#include +#include class HelpPlugin : public UDAPluginBase { @@ -46,11 +46,14 @@ int HelpPlugin::ping(UDA_PLUGIN_INTERFACE* plugin_interface) typedef struct HELP_PING HELP_PING; int offset = 0; - COMPOUNDFIELD* field1 = udaNewCompoundField("seconds", "Server time in seconds from the epoch start", &offset, SCALARUINT); - COMPOUNDFIELD* field2 = udaNewCompoundField("microseconds", "Server inter-second time in microseconds", &offset, SCALARUINT); - - COMPOUNDFIELD* fields[] = { field1, field2 }; - USERDEFINEDTYPE* user_type = udaNewUserType("HELP_PING", "idamServerHelp", 0, 0, nullptr, sizeof(HELP_PING), 2, fields); + COMPOUNDFIELD* field1 = + udaNewCompoundField("seconds", "Server time in seconds from the epoch start", &offset, SCALARUINT); + COMPOUNDFIELD* field2 = + udaNewCompoundField("microseconds", "Server inter-second time in microseconds", &offset, SCALARUINT); + + COMPOUNDFIELD* fields[] = {field1, field2}; + USERDEFINEDTYPE* user_type = + udaNewUserType("HELP_PING", "idamServerHelp", 0, 0, nullptr, sizeof(HELP_PING), 2, fields); udaAddUserType(plugin_interface, user_type); diff --git a/source/plugins/keyvalue/keyvaluePlugin.cpp b/source/plugins/keyvalue/keyvaluePlugin.cpp index dbd7ca7d..33a55457 100644 --- a/source/plugins/keyvalue/keyvaluePlugin.cpp +++ b/source/plugins/keyvalue/keyvaluePlugin.cpp @@ -2,12 +2,12 @@ #include -#include #include "include/uda/uda_plugin_base.hpp" +#include #include "clientserver/initStructs.h" -#include #include "clientserver/stringUtils.h" +#include namespace uda { @@ -100,7 +100,7 @@ int uda::keyvalue::Plugin::write(UDA_PLUGIN_INTERFACE* plugin_interface) if (err != nullptr) { debug(plugin_interface, err); leveldb_free(err); - throw std::runtime_error{ err }; + throw std::runtime_error{err}; } return 0; @@ -128,10 +128,10 @@ int uda::keyvalue::Plugin::read(UDA_PLUGIN_INTERFACE* plugin_interface) if (err != nullptr) { debug(plugin_interface, err); - throw std::runtime_error{ err }; + throw std::runtime_error{err}; } - int shape[] = { (int)value_len }; + int shape[] = {(int)value_len}; udaPluginReturnData(plugin_interface, value, value_len, UDA_TYPE_CHAR, 1, shape, nullptr); return 0; diff --git a/source/plugins/testplugin/testplugin.cpp b/source/plugins/testplugin/testplugin.cpp index cc0064b9..766723d0 100644 --- a/source/plugins/testplugin/testplugin.cpp +++ b/source/plugins/testplugin/testplugin.cpp @@ -6,9 +6,9 @@ #include #include +#include #include #include -#include #include @@ -196,7 +196,8 @@ int TestPlugin::test0(UDA_PLUGIN_INTERFACE* plugin_interface) if (get_function(plugin_interface) == "test0") { size_t shape[] = {strlen(help)}; - udaPluginReturnDataCharArray(plugin_interface, help, 1, shape, "testplugins: test0 = single string as a char array"); + udaPluginReturnDataCharArray(plugin_interface, help, 1, shape, + "testplugins: test0 = single string as a char array"); } else { udaPluginReturnDataStringScalar(plugin_interface, help, "testplugins: test1 = single string"); } @@ -219,9 +220,9 @@ int TestPlugin::test2(UDA_PLUGIN_INTERFACE* plugin_interface) // create original data using model 2 std::vector strings = { - "Hello World!", - "Qwerty keyboard", - "MAST Upgrade", + "Hello World!", + "Qwerty keyboard", + "MAST Upgrade", }; size_t max_len = 0; @@ -239,9 +240,10 @@ int TestPlugin::test2(UDA_PLUGIN_INTERFACE* plugin_interface) size_t shape[] = {max_len, strings.size()}; udaPluginReturnDataCharArray(plugin_interface, data.get(), 2, shape, "testplugins: test2 = 2D array of chars"); } else { -// int shape[] = {max_len, (int)strings.size()}; + // int shape[] = {max_len, (int)strings.size()}; // TODO: yuck! -// udaPluginReturnDataStringArray(plugin_interface, data.get(), 2, shape, "testplugins: test3 = array of strings"); + // udaPluginReturnDataStringArray(plugin_interface, data.get(), 2, shape, "testplugins: test3 = array of + // strings"); } return 0; @@ -821,7 +823,8 @@ int TestPlugin::test19(UDA_PLUGIN_INTERFACE* plugin_interface) test19a_fields[0] = udaNewCompoundField("value", "single integer structure element", &offset, SCALARINT); - USERDEFINEDTYPE* test19a_type = udaNewUserType("TEST19A", "Test #19", 0, 0, nullptr, sizeof(TEST19A), 1, test19a_fields); + USERDEFINEDTYPE* test19a_type = + udaNewUserType("TEST19A", "Test #19", 0, 0, nullptr, sizeof(TEST19A), 1, test19a_fields); udaAddUserType(plugin_interface, test19a_type); typedef struct Test19 { @@ -835,9 +838,11 @@ int TestPlugin::test19(UDA_PLUGIN_INTERFACE* plugin_interface) test19_fields[0] = udaNewCompoundField("value", "single integer structure element", &offset, SCALARINT); int shape[1] = {7}; - test19_fields[1] = udaNewCompoundUserTypeArrayField("vals", "single integer structure element", &offset, test19a_type, 1, shape); + test19_fields[1] = + udaNewCompoundUserTypeArrayField("vals", "single integer structure element", &offset, test19a_type, 1, shape); - USERDEFINEDTYPE* test19_type = udaNewUserType("TEST19", "Test #19", 0, 0, nullptr, sizeof(TEST19), 2, test19_fields); + USERDEFINEDTYPE* test19_type = + udaNewUserType("TEST19", "Test #19", 0, 0, nullptr, sizeof(TEST19), 2, test19_fields); udaAddUserType(plugin_interface, test19_type); // Create Data @@ -888,7 +893,8 @@ int TestPlugin::test21(UDA_PLUGIN_INTERFACE* plugin_interface) test21_fields[0] = udaNewCompoundField("value", "single short structure element", &offset, SCALARSHORT); - USERDEFINEDTYPE* test21_type = udaNewUserType("TEST21", "Test #21", 0, 0, nullptr, sizeof(TEST21), 1, test21_fields); + USERDEFINEDTYPE* test21_type = + udaNewUserType("TEST21", "Test #21", 0, 0, nullptr, sizeof(TEST21), 1, test21_fields); udaAddUserType(plugin_interface, test21_type); // Create Data @@ -915,9 +921,11 @@ int TestPlugin::test22(UDA_PLUGIN_INTERFACE* plugin_interface) int offset = 0; int shape[1] = {3}; - test22_fields[0] = udaNewCompoundArrayField("value", "single short structure element", &offset, ARRAYSHORT, 1, shape); + test22_fields[0] = + udaNewCompoundArrayField("value", "single short structure element", &offset, ARRAYSHORT, 1, shape); - USERDEFINEDTYPE* test22_type = udaNewUserType("TEST22", "Test #22", 0, 0, nullptr, sizeof(TEST22), 1, test22_fields); + USERDEFINEDTYPE* test22_type = + udaNewUserType("TEST22", "Test #22", 0, 0, nullptr, sizeof(TEST22), 1, test22_fields); udaAddUserType(plugin_interface, test22_type); // Create Data @@ -946,9 +954,11 @@ int TestPlugin::test23(UDA_PLUGIN_INTERFACE* plugin_interface) int offset = 0; int shape[2] = {3, 2}; - test23_fields[0] = udaNewCompoundArrayField("value", "single short structure element", &offset, ARRAYSHORT, 1, shape); + test23_fields[0] = + udaNewCompoundArrayField("value", "single short structure element", &offset, ARRAYSHORT, 1, shape); - USERDEFINEDTYPE* test23_type = udaNewUserType("TEST23", "Test #23", 0, 0, nullptr, sizeof(TEST23), 1, test23_fields); + USERDEFINEDTYPE* test23_type = + udaNewUserType("TEST23", "Test #23", 0, 0, nullptr, sizeof(TEST23), 1, test23_fields); udaAddUserType(plugin_interface, test23_type); // Create Data @@ -981,7 +991,8 @@ int TestPlugin::test24(UDA_PLUGIN_INTERFACE* plugin_interface) test24_fields[0] = udaNewCompoundField("value", "single short structure element", &offset, ARRAYSHORT); - USERDEFINEDTYPE* test24_type = udaNewUserType("TEST24", "Test #24", 0, 0, nullptr, sizeof(TEST24), 1, test24_fields); + USERDEFINEDTYPE* test24_type = + udaNewUserType("TEST24", "Test #24", 0, 0, nullptr, sizeof(TEST24), 1, test24_fields); udaAddUserType(plugin_interface, test24_type); // Create Data @@ -1013,7 +1024,8 @@ int TestPlugin::test25(UDA_PLUGIN_INTERFACE* plugin_interface) test25_fields[0] = udaNewCompoundField("value", "single short structure element", &offset, ARRAYSHORT); - USERDEFINEDTYPE* test25_type = udaNewUserType("TEST25", "Test #25", 0, 0, nullptr, sizeof(TEST25), 1, test25_fields); + USERDEFINEDTYPE* test25_type = + udaNewUserType("TEST25", "Test #25", 0, 0, nullptr, sizeof(TEST25), 1, test25_fields); udaAddUserType(plugin_interface, test25_type); // Create Data @@ -1047,7 +1059,8 @@ int TestPlugin::test26(UDA_PLUGIN_INTERFACE* plugin_interface) test26_fields[0] = udaNewCompoundField("value", "single short structure element", &offset, ARRAYSHORT); - USERDEFINEDTYPE* test26_type = udaNewUserType("TEST26", "Test #26", 0, 0, nullptr, sizeof(TEST26), 1, test26_fields); + USERDEFINEDTYPE* test26_type = + udaNewUserType("TEST26", "Test #26", 0, 0, nullptr, sizeof(TEST26), 1, test26_fields); udaAddUserType(plugin_interface, test26_type); // Create Data Structure @@ -1089,9 +1102,11 @@ int TestPlugin::test27(UDA_PLUGIN_INTERFACE* plugin_interface) int offset = 0; int shape[3] = {4, 3, 2}; - test27_fields[0] = udaNewCompoundArrayField("value", "single short structure element", &offset, ARRAYSHORT, 3, shape); + test27_fields[0] = + udaNewCompoundArrayField("value", "single short structure element", &offset, ARRAYSHORT, 3, shape); - USERDEFINEDTYPE* test27_type = udaNewUserType("TEST27", "Test #27", 0, 0, nullptr, sizeof(TEST27), 1, test27_fields); + USERDEFINEDTYPE* test27_type = + udaNewUserType("TEST27", "Test #27", 0, 0, nullptr, sizeof(TEST27), 1, test27_fields); udaAddUserType(plugin_interface, test27_type); // Create Data @@ -1145,7 +1160,8 @@ int TestPlugin::test28(UDA_PLUGIN_INTERFACE* plugin_interface) test28_fields[0] = udaNewCompoundField("value", "single short structure element", &offset, ARRAYSHORT); - USERDEFINEDTYPE* test28_type = udaNewUserType("TEST28", "Test #28", 0, 0, nullptr, sizeof(TEST28), 1, test28_fields); + USERDEFINEDTYPE* test28_type = + udaNewUserType("TEST28", "Test #28", 0, 0, nullptr, sizeof(TEST28), 1, test28_fields); udaAddUserType(plugin_interface, test28_type); // Create Data Structure @@ -1209,7 +1225,8 @@ int TestPlugin::test30(UDA_PLUGIN_INTERFACE* plugin_interface) test30_fields[0] = udaNewCompoundField("R", "double structure element", &offset, SCALARDOUBLE); test30_fields[1] = udaNewCompoundField("Z", "double structure element", &offset, SCALARDOUBLE); - USERDEFINEDTYPE* test30_type = udaNewUserType("TEST30", "Test #30", 0, 0, nullptr, sizeof(TEST30), 2, test30_fields); + USERDEFINEDTYPE* test30_type = + udaNewUserType("TEST30", "Test #30", 0, 0, nullptr, sizeof(TEST30), 2, test30_fields); udaAddUserType(plugin_interface, test30_type); // Create Data @@ -1240,7 +1257,8 @@ int TestPlugin::test31(UDA_PLUGIN_INTERFACE* plugin_interface) test31_fields[0] = udaNewCompoundField("R", "double structure element", &offset, SCALARDOUBLE); test31_fields[1] = udaNewCompoundField("Z", "double structure element", &offset, SCALARDOUBLE); - USERDEFINEDTYPE* test31_type = udaNewUserType("TEST31", "Test #31", 0, 0, nullptr, sizeof(TEST31), 2, test31_fields); + USERDEFINEDTYPE* test31_type = + udaNewUserType("TEST31", "Test #31", 0, 0, nullptr, sizeof(TEST31), 2, test31_fields); udaAddUserType(plugin_interface, test31_type); // Create Data @@ -1286,7 +1304,8 @@ int TestPlugin::test32(UDA_PLUGIN_INTERFACE* plugin_interface) test32a_fields[0] = udaNewCompoundField("R", "double structure element", &offset, SCALARDOUBLE); test32a_fields[1] = udaNewCompoundField("Z", "double structure element", &offset, SCALARDOUBLE); - USERDEFINEDTYPE* test32a_type = udaNewUserType("TEST32A", "Test #32", 0, 0, nullptr, sizeof(TEST32A), 2, test32a_fields); + USERDEFINEDTYPE* test32a_type = + udaNewUserType("TEST32A", "Test #32", 0, 0, nullptr, sizeof(TEST32A), 2, test32a_fields); udaAddUserType(plugin_interface, test32a_type); typedef struct Test32 { @@ -1301,7 +1320,8 @@ int TestPlugin::test32(UDA_PLUGIN_INTERFACE* plugin_interface) int shape[1] = {100}; test32_fields[1] = udaNewCompoundUserTypeArrayField("coords", "structure TEST32A", &offset, test32a_type, 1, shape); - USERDEFINEDTYPE* test32_type = udaNewUserType("TEST32", "Test #32", 0, 0, nullptr, sizeof(TEST32), 2, test32_fields); + USERDEFINEDTYPE* test32_type = + udaNewUserType("TEST32", "Test #32", 0, 0, nullptr, sizeof(TEST32), 2, test32_fields); udaAddUserType(plugin_interface, test32_type); // Create Data @@ -1340,7 +1360,8 @@ int TestPlugin::test33(UDA_PLUGIN_INTERFACE* plugin_interface) test33a_fields[0] = udaNewCompoundField("R", "double structure element", &offset, SCALARDOUBLE); test33a_fields[1] = udaNewCompoundField("Z", "double structure element", &offset, SCALARDOUBLE); - USERDEFINEDTYPE* test33a_type = udaNewUserType("TEST33A", "Test #33", 0, 0, nullptr, sizeof(TEST33A), 2, test33a_fields); + USERDEFINEDTYPE* test33a_type = + udaNewUserType("TEST33A", "Test #33", 0, 0, nullptr, sizeof(TEST33A), 2, test33a_fields); udaAddUserType(plugin_interface, test33a_type); typedef struct Test33 { @@ -1355,7 +1376,8 @@ int TestPlugin::test33(UDA_PLUGIN_INTERFACE* plugin_interface) int shape[1] = {100}; test33_fields[1] = udaNewCompoundUserTypeArrayField("coords", "structure TEST33A", &offset, test33a_type, 1, shape); - USERDEFINEDTYPE* test33_type = udaNewUserType("TEST33", "Test #33", 0, 0, nullptr, sizeof(TEST33), 2, test33_fields); + USERDEFINEDTYPE* test33_type = + udaNewUserType("TEST33", "Test #33", 0, 0, nullptr, sizeof(TEST33), 2, test33_fields); udaAddUserType(plugin_interface, test33_type); // Create Data @@ -1400,7 +1422,8 @@ int TestPlugin::test34(UDA_PLUGIN_INTERFACE* plugin_interface) test34a_fields[0] = udaNewCompoundField("R", "unsigned char structure element", &offset, ARRAYUCHAR); test34a_fields[1] = udaNewCompoundField("Z", "unsigned char structure element", &offset, ARRAYUCHAR); - USERDEFINEDTYPE* test34a_type = udaNewUserType("TEST34A", "Test #34", 0, 0, nullptr, sizeof(TEST34A), 2, test34a_fields); + USERDEFINEDTYPE* test34a_type = + udaNewUserType("TEST34A", "Test #34", 0, 0, nullptr, sizeof(TEST34A), 2, test34a_fields); udaAddUserType(plugin_interface, test34a_type); typedef struct Test34 { @@ -1414,7 +1437,8 @@ int TestPlugin::test34(UDA_PLUGIN_INTERFACE* plugin_interface) test34_fields[0] = udaNewCompoundField("count", "int structure element", &offset, SCALARINT); test34_fields[1] = udaNewCompoundUserTypePointerField("coords", "structure TEST34A", &offset, test34a_type); - USERDEFINEDTYPE* test34_type = udaNewUserType("TEST34", "Test #34", 0, 0, nullptr, sizeof(TEST34), 2, test34_fields); + USERDEFINEDTYPE* test34_type = + udaNewUserType("TEST34", "Test #34", 0, 0, nullptr, sizeof(TEST34), 2, test34_fields); udaAddUserType(plugin_interface, test34_type); // Create Data @@ -1431,17 +1455,14 @@ int TestPlugin::test34(UDA_PLUGIN_INTERFACE* plugin_interface) shape[0] = 5; shape[1] = 20; - udaRegisterMallocArray(plugin_interface, (void*)data->coords, data->count, sizeof(TEST34A), "TEST34A", rank, - shape); + udaRegisterMallocArray(plugin_interface, (void*)data->coords, data->count, sizeof(TEST34A), "TEST34A", rank, shape); for (int i = 0; i < data->count; i++) { data->coords[i].R = (unsigned char*)malloc(10 * sizeof(unsigned char)); data->coords[i].Z = (unsigned char*)malloc(10 * sizeof(unsigned char)); - udaRegisterMalloc(plugin_interface, (void*)data->coords[i].R, 10, sizeof(unsigned char), - "unsigned char *"); - udaRegisterMalloc(plugin_interface, (void*)data->coords[i].Z, 10, sizeof(unsigned char), - "unsigned char *"); + udaRegisterMalloc(plugin_interface, (void*)data->coords[i].R, 10, sizeof(unsigned char), "unsigned char *"); + udaRegisterMalloc(plugin_interface, (void*)data->coords[i].Z, 10, sizeof(unsigned char), "unsigned char *"); for (int j = 0; j < 10; ++j) { data->coords[i].R[j] = (unsigned char)(1 * i); @@ -1564,8 +1585,8 @@ int TestPlugin::test40(UDA_PLUGIN_INTERFACE* plugin_interface) TEST40* blocks = (TEST40*)malloc(request_block->putDataBlockList.blockCount * sizeof(TEST40)); udaRegisterMalloc(plugin_interface, (void*)data, 1, sizeof(TEST41), "TEST41"); - udaRegisterMalloc(plugin_interface, (void*)blocks, request_block->putDataBlockList.blockCount, - sizeof(TEST40), "TEST40"); + udaRegisterMalloc(plugin_interface, (void*)blocks, request_block->putDataBlockList.blockCount, sizeof(TEST40), + "TEST40"); data->count = request_block->putDataBlockList.blockCount; @@ -1669,19 +1690,23 @@ int register_enumlist(UDA_PLUGIN_INTERFACE* plugin_interface, ENUMLIST60* enum_l int offset = 0; int shape[1] = {MAXELEMENTNAME}; - enummember60_fields[0] = udaNewCompoundArrayField("name", "char array structure element", &offset, ARRAYCHAR, 1, shape); + enummember60_fields[0] = + udaNewCompoundArrayField("name", "char array structure element", &offset, ARRAYCHAR, 1, shape); enummember60_fields[1] = udaNewCompoundField("value", "long long structure element", &offset, SCALARLONG64); - USERDEFINEDTYPE* enummember60_type = udaNewUserType("ENUMMEMBER60", "Test #60", 0, 0, nullptr, sizeof(ENUMMEMBER60), 2, enummember60_fields); + USERDEFINEDTYPE* enummember60_type = + udaNewUserType("ENUMMEMBER60", "Test #60", 0, 0, nullptr, sizeof(ENUMMEMBER60), 2, enummember60_fields); udaAddUserType(plugin_interface, enummember60_type); COMPOUNDFIELD* enumlist60_fields[8] = {nullptr}; offset = 0; - enumlist60_fields[0] = udaNewCompoundArrayField("name", "char array structure element", &offset, ARRAYCHAR, 1, shape); + enumlist60_fields[0] = + udaNewCompoundArrayField("name", "char array structure element", &offset, ARRAYCHAR, 1, shape); enumlist60_fields[1] = udaNewCompoundField("type", "int structure element", &offset, SCALARINT); enumlist60_fields[2] = udaNewCompoundField("count", "int structure element", &offset, SCALARINT); - enumlist60_fields[3] = udaNewCompoundUserTypePointerField("enummember", "ENUMMEMBER60* structure element", &offset, enummember60_type); + enumlist60_fields[3] = + udaNewCompoundUserTypePointerField("enummember", "ENUMMEMBER60* structure element", &offset, enummember60_type); enumlist60_fields[5] = udaNewCompoundField("arraydata_rank", "int structure element", &offset, SCALARINT); enumlist60_fields[6] = udaNewCompoundField("arraydata_count", "int structure element", &offset, SCALARINT); @@ -1690,11 +1715,13 @@ int register_enumlist(UDA_PLUGIN_INTERFACE* plugin_interface, ENUMLIST60* enum_l COMPOUNDFIELD* arraydata_field = nullptr; switch (enum_list->type) { case (UDA_TYPE_UNSIGNED_SHORT): { - arraydata_field = udaNewCompoundField("arraydata", "unsigned short* structure element", &offset, ARRAYUSHORT); + arraydata_field = + udaNewCompoundField("arraydata", "unsigned short* structure element", &offset, ARRAYUSHORT); break; } case (UDA_TYPE_SHORT): { - arraydata_field = udaNewCompoundField("arraydata", "unsigned short* structure element", &offset, ARRAYSHORT); + arraydata_field = + udaNewCompoundField("arraydata", "unsigned short* structure element", &offset, ARRAYSHORT); break; } case (UDA_TYPE_UNSIGNED_INT): { @@ -1706,18 +1733,21 @@ int register_enumlist(UDA_PLUGIN_INTERFACE* plugin_interface, ENUMLIST60* enum_l break; } case (UDA_TYPE_UNSIGNED_LONG64): { - arraydata_field = udaNewCompoundField("arraydata", "unsigned short* structure element", &offset, ARRAYULONG64); + arraydata_field = + udaNewCompoundField("arraydata", "unsigned short* structure element", &offset, ARRAYULONG64); break; } case (UDA_TYPE_LONG64): { - arraydata_field = udaNewCompoundField("arraydata", "unsigned short* structure element", &offset, ARRAYLONG64); + arraydata_field = + udaNewCompoundField("arraydata", "unsigned short* structure element", &offset, ARRAYLONG64); break; } } enumlist60_fields[4] = arraydata_field; - USERDEFINEDTYPE* enumlist60_type = udaNewUserType("ENUMLIST60", "Test #60", 0, 0, nullptr, sizeof(ENUMLIST60), 2, enumlist60_fields); + USERDEFINEDTYPE* enumlist60_type = + udaNewUserType("ENUMLIST60", "Test #60", 0, 0, nullptr, sizeof(ENUMLIST60), 2, enumlist60_fields); udaAddUserType(plugin_interface, enumlist60_type); return 0; @@ -1738,7 +1768,7 @@ int TestPlugin::test60(UDA_PLUGIN_INTERFACE* plugin_interface) enumlist->enummember[2].value = (long long)3; udaRegisterMalloc(plugin_interface, (void*)enumlist, 1, sizeof(ENUMLIST60), "ENUMLIST60"); udaRegisterMalloc(plugin_interface, (void*)enumlist->enummember, enumlist->count, sizeof(ENUMMEMBER60), - "ENUMMEMBER60"); + "ENUMMEMBER60"); int count = 10; auto data = (unsigned short*)malloc(count * sizeof(unsigned short)); @@ -1758,8 +1788,7 @@ int TestPlugin::test60(UDA_PLUGIN_INTERFACE* plugin_interface) enumlist->arraydata_shape = (int*)malloc(sizeof(int)); enumlist->arraydata_shape[0] = count; - udaRegisterMalloc(plugin_interface, (void*)enumlist->arraydata, count, sizeof(unsigned short), - "unsigned short"); + udaRegisterMalloc(plugin_interface, (void*)enumlist->arraydata, count, sizeof(unsigned short), "unsigned short"); count = 1; int rank = 1; @@ -1790,7 +1819,7 @@ int TestPlugin::test61(UDA_PLUGIN_INTERFACE* plugin_interface) enumlist->enummember[2].value = (long long)3; udaRegisterMalloc(plugin_interface, (void*)enumlist, 1, sizeof(ENUMLIST60), "ENUMLIST60"); udaRegisterMalloc(plugin_interface, (void*)enumlist->enummember, enumlist->count, sizeof(ENUMMEMBER60), - "ENUMMEMBER60"); + "ENUMMEMBER60"); int count = 10; auto data = (unsigned long long*)malloc(count * sizeof(unsigned long long)); @@ -1811,13 +1840,12 @@ int TestPlugin::test61(UDA_PLUGIN_INTERFACE* plugin_interface) enumlist->arraydata_shape[0] = count; udaRegisterMalloc(plugin_interface, (void*)enumlist->arraydata, count, sizeof(unsigned long long), - "unsigned long long"); + "unsigned long long"); count = 1; int rank = 1; int shape[] = {1}; // Shape of the shape array! - udaRegisterMallocArray(plugin_interface, (void*)enumlist->arraydata_shape, count, sizeof(int), "int", rank, - shape); + udaRegisterMallocArray(plugin_interface, (void*)enumlist->arraydata_shape, count, sizeof(int), "int", rank, shape); register_enumlist(plugin_interface, enumlist); @@ -1842,7 +1870,7 @@ int TestPlugin::test62(UDA_PLUGIN_INTERFACE* plugin_interface) enumlist->enummember[2].value = (long long)3; udaRegisterMalloc(plugin_interface, (void*)enumlist, 1, sizeof(ENUMLIST60), "ENUMLIST60"); udaRegisterMalloc(plugin_interface, (void*)enumlist->enummember, enumlist->count, sizeof(ENUMMEMBER60), - "ENUMMEMBER60"); + "ENUMMEMBER60"); int count = 10; auto data = (unsigned long long*)malloc(count * sizeof(unsigned long long)); @@ -1863,7 +1891,7 @@ int TestPlugin::test62(UDA_PLUGIN_INTERFACE* plugin_interface) enumlist->arraydata_shape[0] = count; udaRegisterMalloc(plugin_interface, (void*)enumlist->arraydata, count, sizeof(unsigned long long), - "unsigned long long"); + "unsigned long long"); // count = 1; // int rank = 1; @@ -2029,7 +2057,8 @@ int TestPlugin::capnp_test(UDA_PLUGIN_INTERFACE* plugin_interface) auto buffer = uda_capnp_serialise(tree); - udaPluginReturnData(plugin_interface, buffer.data, static_cast(buffer.size), UDA_TYPE_CAPNP, 0, nullptr, nullptr); + udaPluginReturnData(plugin_interface, buffer.data, static_cast(buffer.size), UDA_TYPE_CAPNP, 0, nullptr, + nullptr); return 0; } @@ -2079,7 +2108,8 @@ int TestPlugin::nested_capnp_test(UDA_PLUGIN_INTERFACE* plugin_interface) auto buffer = uda_capnp_serialise(tree); - udaPluginReturnData(plugin_interface, buffer.data, static_cast(buffer.size), UDA_TYPE_CAPNP, 0, nullptr, nullptr); + udaPluginReturnData(plugin_interface, buffer.data, static_cast(buffer.size), UDA_TYPE_CAPNP, 0, nullptr, + nullptr); return 0; } @@ -2112,7 +2142,8 @@ int TestPlugin::long_capnp_test(UDA_PLUGIN_INTERFACE* plugin_interface) auto buffer = uda_capnp_serialise(tree); - udaPluginReturnData(plugin_interface, buffer.data, static_cast(buffer.size), UDA_TYPE_CAPNP, 0, nullptr, nullptr); + udaPluginReturnData(plugin_interface, buffer.data, static_cast(buffer.size), UDA_TYPE_CAPNP, 0, nullptr, + nullptr); return 0; } @@ -2136,7 +2167,8 @@ int TestPlugin::large_capnp_test(UDA_PLUGIN_INTERFACE* plugin_interface) auto buffer = uda_capnp_serialise(tree); - udaPluginReturnData(plugin_interface, buffer.data, static_cast(buffer.size), UDA_TYPE_CAPNP, 0, nullptr, nullptr); + udaPluginReturnData(plugin_interface, buffer.data, static_cast(buffer.size), UDA_TYPE_CAPNP, 0, nullptr, + nullptr); return 0; } diff --git a/source/plugins/testplugin/teststructs.cpp b/source/plugins/testplugin/teststructs.cpp index 1a55ae79..fad176d2 100644 --- a/source/plugins/testplugin/teststructs.cpp +++ b/source/plugins/testplugin/teststructs.cpp @@ -35,7 +35,8 @@ void init_structure_definitions(UDA_PLUGIN_INTERFACE* plugin_interface) test9a_fields[5] = udaNewCompoundUserTypeField("v4", "string structure element", &offset, test9_type); - USERDEFINEDTYPE* test9a_user_type = udaNewUserType("TEST9A", "Test #9A", 0, 0, nullptr, sizeof(TEST9A), 6, test9a_fields); + USERDEFINEDTYPE* test9a_user_type = + udaNewUserType("TEST9A", "Test #9A", 0, 0, nullptr, sizeof(TEST9A), 6, test9a_fields); udaAddUserType(plugin_interface, test9a_user_type); diff --git a/source/plugins/uda/uda_plugin.cpp b/source/plugins/uda/uda_plugin.cpp index 43637793..8ee28bf9 100644 --- a/source/plugins/uda/uda_plugin.cpp +++ b/source/plugins/uda/uda_plugin.cpp @@ -2,11 +2,11 @@ #include -#include "clientserver/initStructs.h" #include "client/udaClient.h" +#include "clientserver/initStructs.h" #include "clientserver/stringUtils.h" -#include "logging/logging.h" #include "include/uda/uda_plugin_base.hpp" +#include "logging/logging.h" #include "server/serverPlugin.h" #include "uda/client.h" @@ -186,7 +186,7 @@ int uda::plugins::uda::Plugin::get(UDA_PLUGIN_INTERFACE* plugin_interface) CLIENT_BLOCK* client_block = plugin_interface->client_block; if (client_block->get_nodimdata) { - udaSetProperty("get_nodimdata"); + udaSetProperty("get_nodimdata"); } if (client_block->get_timedble) { udaSetProperty("get_timedble"); @@ -276,7 +276,8 @@ int uda::plugins::uda::Plugin::get(UDA_PLUGIN_INTERFACE* plugin_interface) old_port_ = newPort; } } else { - error(plugin_interface, "The Server Port must be an Integer Number passed using the formats 'server:port' or 'server " + error(plugin_interface, + "The Server Port must be an Integer Number passed using the formats 'server:port' or 'server " "port'"); } } else { @@ -313,7 +314,8 @@ int uda::plugins::uda::Plugin::get(UDA_PLUGIN_INTERFACE* plugin_interface) p[0] = '\0'; // Break the String (work) strcpy(source, p + 1); // Extract the Source URL Argument } else { - error(plugin_interface, "The Remote Server Data Source specified does not comply with the naming model: " + error(plugin_interface, + "The Remote Server Data Source specified does not comply with the naming model: " "serverHost:port/sourceURL"); } } else { @@ -322,7 +324,8 @@ int uda::plugins::uda::Plugin::get(UDA_PLUGIN_INTERFACE* plugin_interface) p[0] = '\0'; // Break the String (work) strcpy(source, p + 1); // Extract the Source URL Argument } else { - error(plugin_interface, "The Remote Server Data Source specified does not comply with the naming model: " + error(plugin_interface, + "The Remote Server Data Source specified does not comply with the naming model: " "serverHost:port/sourceURL"); } } @@ -352,7 +355,8 @@ int uda::plugins::uda::Plugin::get(UDA_PLUGIN_INTERFACE* plugin_interface) old_port_ = newPort; } } else { - error(plugin_interface, "The Server Port must be an Integer Number passed using the format 'server:port' or 'server " + error(plugin_interface, + "The Server Port must be an Integer Number passed using the format 'server:port' or 'server " "port'"); } } else { @@ -450,7 +454,8 @@ int uda::plugins::uda::Plugin::get(UDA_PLUGIN_INTERFACE* plugin_interface) old_port_ = newPort; } } else { - error(plugin_interface, "The Server Port must be an Integer Number passed using the format 'server:port' or 'server " + error(plugin_interface, + "The Server Port must be an Integer Number passed using the format 'server:port' or 'server " "port'"); } } else { @@ -476,7 +481,8 @@ int uda::plugins::uda::Plugin::get(UDA_PLUGIN_INTERFACE* plugin_interface) //---------------------------------------------------------------------- // Test for Errors: Close Socket and Free heap - debug(plugin_interface, "Returned from udaGetAPI API: handle = {}, error code = {}\n", handle, udaGetErrorCode(handle)); + debug(plugin_interface, "Returned from udaGetAPI API: handle = {}, error code = {}\n", handle, + udaGetErrorCode(handle)); if (handle < 0) { error(plugin_interface, udaGetServerErrorStackRecordMsg(0)); diff --git a/source/plugins/udaPlugin.cpp b/source/plugins/udaPlugin.cpp index 54c05927..04958c0a 100644 --- a/source/plugins/udaPlugin.cpp +++ b/source/plugins/udaPlugin.cpp @@ -1,22 +1,22 @@ #include "uda/plugins.h" +#include #include -#include #include -#include -#include #include +#include +#include -#include "server/initPluginList.h" -#include "server/serverPlugin.h" -#include "server/serverSubsetData.h" -#include "clientserver/initStructs.h" -#include "clientserver/type_convertor.hpp" -#include "logging/logging.h" #include "clientserver/errorLog.h" +#include "clientserver/initStructs.h" #include "clientserver/makeRequestBlock.h" #include "clientserver/stringUtils.h" +#include "clientserver/type_convertor.hpp" +#include "logging/logging.h" #include "server/getServerEnvironment.h" +#include "server/initPluginList.h" +#include "server/serverPlugin.h" +#include "server/serverSubsetData.h" #include "structures/accessors.h" #include "structures/struct.h" @@ -69,8 +69,7 @@ int initPlugin(const UDA_PLUGIN_INTERFACE* plugin_interface) return 0; } -template -int setReturnDataScalar(UDA_PLUGIN_INTERFACE* plugin_interface, T value, const char* description) +template int setReturnDataScalar(UDA_PLUGIN_INTERFACE* plugin_interface, T value, const char* description) { DATA_BLOCK* data_block = plugin_interface->data_block; initDataBlock(data_block); @@ -92,7 +91,8 @@ int setReturnDataScalar(UDA_PLUGIN_INTERFACE* plugin_interface, T value, const c } template -int setReturnDataArray(UDA_PLUGIN_INTERFACE* plugin_interface, const T* values, size_t rank, const size_t* shape, const char* description) +int setReturnDataArray(UDA_PLUGIN_INTERFACE* plugin_interface, const T* values, size_t rank, const size_t* shape, + const char* description) { DATA_BLOCK* data_block = plugin_interface->data_block; initDataBlock(data_block); @@ -130,15 +130,17 @@ int setReturnDataArray(UDA_PLUGIN_INTERFACE* plugin_interface, const T* values, return 0; } -#define UDA_IMPL_SET_RETURN_FUNCS(NAME, TYPE) \ -int udaPluginReturnData##NAME##Scalar(UDA_PLUGIN_INTERFACE* plugin_interface, const TYPE value, const char* description) \ -{ \ - return setReturnDataScalar(plugin_interface, value, description); \ -} \ -int udaPluginReturnData##NAME##Array(UDA_PLUGIN_INTERFACE* plugin_interface, const TYPE* values, size_t rank, const size_t* shape, const char* description) \ -{ \ - return setReturnDataArray(plugin_interface, values, rank, shape, description); \ -} +#define UDA_IMPL_SET_RETURN_FUNCS(NAME, TYPE) \ + int udaPluginReturnData##NAME##Scalar(UDA_PLUGIN_INTERFACE* plugin_interface, const TYPE value, \ + const char* description) \ + { \ + return setReturnDataScalar(plugin_interface, value, description); \ + } \ + int udaPluginReturnData##NAME##Array(UDA_PLUGIN_INTERFACE* plugin_interface, const TYPE* values, size_t rank, \ + const size_t* shape, const char* description) \ + { \ + return setReturnDataArray(plugin_interface, values, rank, shape, description); \ + } UDA_IMPL_SET_RETURN_FUNCS(Float, float) UDA_IMPL_SET_RETURN_FUNCS(Double, double) @@ -185,8 +187,8 @@ int udaPluginReturnDataStringScalar(UDA_PLUGIN_INTERFACE* plugin_interface, cons return 0; } -int udaPluginReturnData(UDA_PLUGIN_INTERFACE* plugin_interface, void* value, size_t size, UDA_TYPE type, int rank, const int* shape, - const char* description) +int udaPluginReturnData(UDA_PLUGIN_INTERFACE* plugin_interface, void* value, size_t size, UDA_TYPE type, int rank, + const int* shape, const char* description) { DATA_BLOCK* data_block = plugin_interface->data_block; initDataBlock(data_block); @@ -268,8 +270,7 @@ bool udaPluginFindStringArg(const UDA_PLUGIN_INTERFACE* plugin_interface, const return found; } -template -bool findArg(const UDA_PLUGIN_INTERFACE* plugin_interface, T* value, const char* name) +template bool findArg(const UDA_PLUGIN_INTERFACE* plugin_interface, T* value, const char* name) { const char* str; bool found = udaPluginFindStringArg(plugin_interface, &str, name); @@ -300,13 +301,16 @@ bool findArrayArg(const UDA_PLUGIN_INTERFACE* plugin_interface, T** values, size return found; } -#define UDA_IMPL_FIND_FUNCS(NAME, TYPE) \ -bool udaPluginFind##NAME##Arg(const UDA_PLUGIN_INTERFACE* plugin_interface, TYPE* value, const char* name) { \ - return findArg(plugin_interface, value, name); \ -} \ -bool udaPluginFind##NAME##ArrayArg(const UDA_PLUGIN_INTERFACE* plugin_interface, TYPE** value, size_t* nvalues, const char* name) { \ - return findArrayArg(plugin_interface, value, nvalues, name); \ -} +#define UDA_IMPL_FIND_FUNCS(NAME, TYPE) \ + bool udaPluginFind##NAME##Arg(const UDA_PLUGIN_INTERFACE* plugin_interface, TYPE* value, const char* name) \ + { \ + return findArg(plugin_interface, value, name); \ + } \ + bool udaPluginFind##NAME##ArrayArg(const UDA_PLUGIN_INTERFACE* plugin_interface, TYPE** value, size_t* nvalues, \ + const char* name) \ + { \ + return findArrayArg(plugin_interface, value, nvalues, name); \ + } UDA_IMPL_FIND_FUNCS(Float, float) UDA_IMPL_FIND_FUNCS(Double, double) @@ -382,7 +386,9 @@ int udaCallPlugin2(UDA_PLUGIN_INTERFACE* plugin_interface, const char* request, return err; } -int udaPluginReturnCompoundData(UDA_PLUGIN_INTERFACE *plugin_interface, char* data, const char *user_type, const char* description) { +int udaPluginReturnCompoundData(UDA_PLUGIN_INTERFACE* plugin_interface, char* data, const char* user_type, + const char* description) +{ DATA_BLOCK* data_block = plugin_interface->data_block; initDataBlock(data_block); @@ -407,7 +413,9 @@ int udaPluginReturnCompoundData(UDA_PLUGIN_INTERFACE *plugin_interface, char* da return 0; } -int udaPluginReturnCompoundArrayData(UDA_PLUGIN_INTERFACE *plugin_interface, char* data, const char *user_type, const char* description, int rank, int* shape) { +int udaPluginReturnCompoundArrayData(UDA_PLUGIN_INTERFACE* plugin_interface, char* data, const char* user_type, + const char* description, int rank, int* shape) +{ DATA_BLOCK* data_block = plugin_interface->data_block; initDataBlock(data_block); @@ -456,35 +464,40 @@ COMPOUNDFIELD* udaNewCompoundField(const char* name, const char* description, in return field; } -COMPOUNDFIELD* udaNewCompoundArrayField(const char* name, const char* description, int* offset, int type, int rank, int* shape) +COMPOUNDFIELD* udaNewCompoundArrayField(const char* name, const char* description, int* offset, int type, int rank, + int* shape) { COMPOUNDFIELD* field = (COMPOUNDFIELD*)malloc(sizeof(COMPOUNDFIELD)); defineField(field, name, description, offset, type, rank, shape); return field; } -COMPOUNDFIELD* udaNewCompoundUserTypeField(const char* name, const char* description, int* offset, USERDEFINEDTYPE* user_type) +COMPOUNDFIELD* udaNewCompoundUserTypeField(const char* name, const char* description, int* offset, + USERDEFINEDTYPE* user_type) { COMPOUNDFIELD* field = (COMPOUNDFIELD*)malloc(sizeof(COMPOUNDFIELD)); defineUserTypeField(field, name, description, offset, 0, nullptr, user_type, false); return field; } -COMPOUNDFIELD* udaNewCompoundUserTypePointerField(const char* name, const char* description, int* offset, USERDEFINEDTYPE* user_type) +COMPOUNDFIELD* udaNewCompoundUserTypePointerField(const char* name, const char* description, int* offset, + USERDEFINEDTYPE* user_type) { COMPOUNDFIELD* field = (COMPOUNDFIELD*)malloc(sizeof(COMPOUNDFIELD)); defineUserTypeField(field, name, description, offset, 0, nullptr, user_type, true); return field; } -COMPOUNDFIELD* udaNewCompoundUserTypeArrayField(const char* name, const char* description, int* offset, USERDEFINEDTYPE* user_type, int rank, int* shape) +COMPOUNDFIELD* udaNewCompoundUserTypeArrayField(const char* name, const char* description, int* offset, + USERDEFINEDTYPE* user_type, int rank, int* shape) { COMPOUNDFIELD* field = (COMPOUNDFIELD*)malloc(sizeof(COMPOUNDFIELD)); defineUserTypeField(field, name, description, offset, rank, shape, user_type, false); return field; } -USERDEFINEDTYPE* udaNewUserType(const char* name, const char* source, int ref_id, int image_count, char* image, size_t size, size_t num_fields, COMPOUNDFIELD** fields) +USERDEFINEDTYPE* udaNewUserType(const char* name, const char* source, int ref_id, int image_count, char* image, + size_t size, size_t num_fields, COMPOUNDFIELD** fields) { USERDEFINEDTYPE* user_type = (USERDEFINEDTYPE*)malloc(sizeof(USERDEFINEDTYPE)); @@ -519,7 +532,8 @@ int udaRegisterMalloc(UDA_PLUGIN_INTERFACE* plugin_interface, void* data, int co return 0; } -int udaRegisterMallocArray(UDA_PLUGIN_INTERFACE* plugin_interface, void* data, int count, size_t size, const char* type, int rank, int* shape) +int udaRegisterMallocArray(UDA_PLUGIN_INTERFACE* plugin_interface, void* data, int count, size_t size, const char* type, + int rank, int* shape) { udaAddMalloc2(plugin_interface->logmalloclist, data, count, size, type, rank, shape); @@ -531,7 +545,8 @@ int udaPluginPluginsCount(UDA_PLUGIN_INTERFACE* plugin_interface) return plugin_interface->pluginList->count; } -namespace { +namespace +{ int check_plugin_class(UDA_PLUGIN_INTERFACE* plugin_interface, int plugin_num, int plugin_class) { auto plugin_list = plugin_interface->pluginList; @@ -543,13 +558,14 @@ int check_plugin_class(UDA_PLUGIN_INTERFACE* plugin_interface, int plugin_num, i (plugin_list->plugin[plugin_num].is_private == UDA_PLUGIN_PRIVATE && !environment->external_user)); if (plugin_class == UDA_PLUGIN_CLASS_FILE) { - is_valid |= (plugin_list->plugin[plugin_num].format[0] != '\0' && plugin_list->plugin[plugin_num].extension[0] != '\0'); + is_valid |= + (plugin_list->plugin[plugin_num].format[0] != '\0' && plugin_list->plugin[plugin_num].extension[0] != '\0'); } return is_valid; } -} +} // namespace int udaPluginCheckPluginClass(UDA_PLUGIN_INTERFACE* plugin_interface, int plugin_num, const char* plugin_class) { @@ -604,8 +620,10 @@ void udaAddPluginError(UDA_PLUGIN_INTERFACE* plugin_interface, const char* locat { udaLog(UDA_LOG_ERROR, msg); plugin_interface->error_stack.nerrors += 1; - plugin_interface->error_stack.idamerror = (UDA_ERROR*)realloc(plugin_interface->error_stack.idamerror, plugin_interface->error_stack.nerrors * sizeof(UDA_ERROR)); - plugin_interface->error_stack.idamerror[plugin_interface->error_stack.nerrors - 1] = udaCreateError(UDA_CODE_ERROR_TYPE, location, code, msg); + plugin_interface->error_stack.idamerror = (UDA_ERROR*)realloc( + plugin_interface->error_stack.idamerror, plugin_interface->error_stack.nerrors * sizeof(UDA_ERROR)); + plugin_interface->error_stack.idamerror[plugin_interface->error_stack.nerrors - 1] = + udaCreateError(UDA_CODE_ERROR_TYPE, location, code, msg); } int udaPluginIsExternal(UDA_PLUGIN_INTERFACE* plugin_interface) @@ -681,7 +699,8 @@ int udaPluginReturnDataOrder(UDA_PLUGIN_INTERFACE* plugin_interface, int order) return 0; } -int udaPluginReturnDimensionFloatArray(UDA_PLUGIN_INTERFACE* plugin_interface, int dim_n, float* data, size_t size, const char* label, const char* units) +int udaPluginReturnDimensionFloatArray(UDA_PLUGIN_INTERFACE* plugin_interface, int dim_n, float* data, size_t size, + const char* label, const char* units) { DATA_BLOCK* data_block = plugin_interface->data_block; diff --git a/source/plugins/uda_plugin_base.cpp b/source/plugins/uda_plugin_base.cpp index 0bf82c3c..1e476996 100644 --- a/source/plugins/uda_plugin_base.cpp +++ b/source/plugins/uda_plugin_base.cpp @@ -1,5 +1,5 @@ -#include #include "clientserver/stringUtils.h" +#include #include #include diff --git a/source/plugins/viewport/viewport.cpp b/source/plugins/viewport/viewport.cpp index 089997f0..b67b76b5 100644 --- a/source/plugins/viewport/viewport.cpp +++ b/source/plugins/viewport/viewport.cpp @@ -286,7 +286,8 @@ int ViewportPlugin::get(UDA_PLUGIN_INTERFACE* plugin_interface) if (pixel_width && pixel_height) { // Map to pixels if the device coordinate viewport is defined - debug(plugin_interface, "Viewport: Mapping data to device pixel coordinate range (width, height) = {}, {}\n", *pixel_width, + debug(plugin_interface, + "Viewport: Mapping data to device pixel coordinate range (width, height) = {}, {}\n", *pixel_width, *pixel_height); int* column = nullptr; @@ -506,14 +507,16 @@ int ViewportPlugin::get(UDA_PLUGIN_INTERFACE* plugin_interface) free(freq[i]); - debug(plugin_interface, "[{}] {} {} {} {}\n", i, data[i], err_lo[i], err_hi[i], horizontal_pixel_values[i]); + debug(plugin_interface, "[{}] {} {} {} {}\n", i, data[i], err_lo[i], err_hi[i], + horizontal_pixel_values[i]); } // end of loop over pixel_width debug(plugin_interface, "good_count = {}\n", good_count); debug(plugin_interface, "pixel_width = {}\n", *pixel_width); for (int i = 0; i < pixelWidth2; i++) { - debug(plugin_interface, "[{}] {} {} {} {}\n", i, data[i], err_lo[i], err_hi[i], horizontal_pixel_values[i]); + debug(plugin_interface, "[{}] {} {} {} {}\n", i, data[i], err_lo[i], err_hi[i], + horizontal_pixel_values[i]); } // Free allocated heap @@ -561,12 +564,13 @@ int ViewportPlugin::get(UDA_PLUGIN_INTERFACE* plugin_interface) // Return viewport data - size_t shape[] = { (size_t)pixelWidth2 }; + size_t shape[] = {(size_t)pixelWidth2}; udaPluginReturnDataFloatArray(plugin_interface, data.data(), 1, shape, udaGetDataDesc(handle)); udaPluginReturnDataLabel(plugin_interface, udaGetDataLabel(handle)); udaPluginReturnDataUnits(plugin_interface, udaGetDataUnits(handle)); - udaPluginReturnDimensionFloatArray(plugin_interface, 0, horizontal_pixel_values.data(), pixelWidth2, udaGetDimLabel(handle, 0), udaGetDimUnits(handle, 0)); + udaPluginReturnDimensionFloatArray(plugin_interface, 0, horizontal_pixel_values.data(), pixelWidth2, + udaGetDimLabel(handle, 0), udaGetDimUnits(handle, 0)); if (!range) { udaPluginReturnErrorAsymmetry(plugin_interface, true); diff --git a/source/security/clientAuthentication.cpp b/source/security/clientAuthentication.cpp index 91948e02..17be4707 100644 --- a/source/security/clientAuthentication.cpp +++ b/source/security/clientAuthentication.cpp @@ -5,9 +5,9 @@ #include "clientserver/protocol.h" #include "logging/logging.h" #ifndef TESTIDAMSECURITY -# include "include/client.h" # include "clientserver/udaErrors.h" # include "clientserver/xdrlib.h" +# include "include/client.h" #endif #include "authenticationUtils.h" diff --git a/source/security/clientAuthentication.h b/source/security/clientAuthentication.h index 39dbfc84..a3dc85b1 100644 --- a/source/security/clientAuthentication.h +++ b/source/security/clientAuthentication.h @@ -1,13 +1,12 @@ #ifndef UDA_SECURITY_CLIENTAUTHENTICATION_H #define UDA_SECURITY_CLIENTAUTHENTICATION_H -#include "structures/genStructs.h" #include "clientserver/udaStructs.h" +#include "structures/genStructs.h" #include "security.h" -int clientAuthentication(CLIENT_BLOCK* client_block, SERVER_BLOCK* server_block, - LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, - AUTHENTICATION_STEP authenticationStep); +int clientAuthentication(CLIENT_BLOCK* client_block, SERVER_BLOCK* server_block, LOGMALLOCLIST* logmalloclist, + USERDEFINEDTYPELIST* userdefinedtypelist, AUTHENTICATION_STEP authenticationStep); #endif // UDA_SECURITY_CLIENTAUTHENTICATION_H diff --git a/source/security/security.cpp b/source/security/security.cpp index a8f6f18a..7018b08b 100644 --- a/source/security/security.cpp +++ b/source/security/security.cpp @@ -86,10 +86,10 @@ #include -#include #include "clientserver/errorLog.h" #include "logging/logging.h" #include +#include static void logToken(const char* msg, const gcry_mpi_t mpi_token) { diff --git a/source/security/security.h b/source/security/security.h index a2aca891..70607607 100644 --- a/source/security/security.h +++ b/source/security/security.h @@ -37,10 +37,10 @@ typedef enum AuthenticationStep { HOUSEKEEPING = 9, } AUTHENTICATION_STEP; -int udaAuthentication(AUTHENTICATION_STEP authenticationStep, ENCRYPTION_METHOD encryptionMethod, - TOKEN_TYPE tokenType, unsigned short tokenByteLength, gcry_sexp_t publickey, - gcry_sexp_t privatekey, gcry_mpi_t* client_mpiToken, gcry_mpi_t* server_mpiToken, - unsigned char** client_ciphertext, size_t* client_ciphertextLength, - unsigned char** server_ciphertext, size_t* server_ciphertextLength); +int udaAuthentication(AUTHENTICATION_STEP authenticationStep, ENCRYPTION_METHOD encryptionMethod, TOKEN_TYPE tokenType, + unsigned short tokenByteLength, gcry_sexp_t publickey, gcry_sexp_t privatekey, + gcry_mpi_t* client_mpiToken, gcry_mpi_t* server_mpiToken, unsigned char** client_ciphertext, + size_t* client_ciphertextLength, unsigned char** server_ciphertext, + size_t* server_ciphertextLength); #endif // UDA_SECURITY_SECURITY_H diff --git a/source/security/serverAuthentication.h b/source/security/serverAuthentication.h index ef0a05ba..6b5b2688 100644 --- a/source/security/serverAuthentication.h +++ b/source/security/serverAuthentication.h @@ -1,13 +1,12 @@ #ifndef UDA_SECURITY_SERVERAUTHENTICATION_H #define UDA_SECURITY_SERVERAUTHENTICATION_H -#include "structures/genStructs.h" #include "clientserver/udaStructs.h" +#include "structures/genStructs.h" #include "security.h" -int serverAuthentication(CLIENT_BLOCK* client_block, SERVER_BLOCK* server_block, - LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, - AUTHENTICATION_STEP authenticationStep); +int serverAuthentication(CLIENT_BLOCK* client_block, SERVER_BLOCK* server_block, LOGMALLOCLIST* logmalloclist, + USERDEFINEDTYPELIST* userdefinedtypelist, AUTHENTICATION_STEP authenticationStep); #endif // UDA_SECURITY_SERVERAUTHENTICATION_H diff --git a/source/server/applyXML.cpp b/source/server/applyXML.cpp index 57c42b03..b3fdce08 100644 --- a/source/server/applyXML.cpp +++ b/source/server/applyXML.cpp @@ -17,9 +17,9 @@ #include #include -#include #include "clientserver/stringUtils.h" #include "logging/logging.h" +#include int serverParseSignalXML(DATA_SOURCE data_source, SIGNAL signal, SIGNAL_DESC signal_desc, ACTIONS* actions_desc, ACTIONS* actions_sig) diff --git a/source/server/applyXML.h b/source/server/applyXML.h index ccdbd73a..18fbbfc8 100644 --- a/source/server/applyXML.h +++ b/source/server/applyXML.h @@ -3,8 +3,8 @@ #ifndef UDA_SERVER_APPLYXML_H # define UDA_SERVER_APPLYXML_H -# include "clientserver/udaStructs.h" # include "clientserver/parseXML.h" +# include "clientserver/udaStructs.h" int serverParseSignalXML(DATA_SOURCE data_source, SIGNAL signal, SIGNAL_DESC signal_desc, ACTIONS* actions_desc, ACTIONS* actions_sig); diff --git a/source/server/fatServer.cpp b/source/server/fatServer.cpp index 1cc893dc..fb012aa6 100644 --- a/source/server/fatServer.cpp +++ b/source/server/fatServer.cpp @@ -2,16 +2,16 @@ #include #include -#include "clientserver/initStructs.h" -#include "logging/logging.h" #include "clientserver/copyStructs.h" #include "clientserver/errorLog.h" +#include "clientserver/initStructs.h" #include "clientserver/manageSockets.h" #include "clientserver/printStructs.h" #include "clientserver/protocol.h" #include "clientserver/protocolXML.h" #include "clientserver/xdrlib.h" #include "logging/accessLog.h" +#include "logging/logging.h" #include "server/serverPlugin.h" #include "structures/struct.h" @@ -70,21 +70,21 @@ void setLogMallocList(LOGMALLOCLIST* logmalloclist_in) static int startup_fat_server(SERVER_BLOCK* server_block, USERDEFINEDTYPELIST& parseduserdefinedtypelist); static int do_fat_server_closedown(SERVER_BLOCK* server_block, DATA_BLOCK_LIST* data_blocks, ACTIONS* actions_desc, - ACTIONS* actions_sig, DATA_BLOCK_LIST* data_blocks0); + ACTIONS* actions_sig, DATA_BLOCK_LIST* data_blocks0); static int handle_request_fat(REQUEST_BLOCK* request_block, REQUEST_BLOCK* request_block0, CLIENT_BLOCK* client_block, - SERVER_BLOCK* server_block, METADATA_BLOCK* metadata_block, DATA_BLOCK_LIST* data_block, - ACTIONS* actions_desc, ACTIONS* actions_sig); + SERVER_BLOCK* server_block, METADATA_BLOCK* metadata_block, DATA_BLOCK_LIST* data_block, + ACTIONS* actions_desc, ACTIONS* actions_sig); static int fat_client_return(SERVER_BLOCK* server_block, DATA_BLOCK_LIST* data_blocks, DATA_BLOCK_LIST* data_blocks0, - REQUEST_BLOCK* request_block, CLIENT_BLOCK* client_block, METADATA_BLOCK* metadata_block, - LOGSTRUCTLIST* log_struct_list, IoData* io_data); + REQUEST_BLOCK* request_block, CLIENT_BLOCK* client_block, METADATA_BLOCK* metadata_block, + LOGSTRUCTLIST* log_struct_list, IoData* io_data); //-------------------------------------------------------------------------------------- // Server Entry point int fat_server(CLIENT_BLOCK client_block, SERVER_BLOCK* server_block, REQUEST_BLOCK* request_block0, - DATA_BLOCK_LIST* data_blocks0) + DATA_BLOCK_LIST* data_blocks0) { assert(data_blocks0 != nullptr); @@ -135,13 +135,13 @@ int fat_server(CLIENT_BLOCK client_block, SERVER_BLOCK* server_block, REQUEST_BL udaCopyUserDefinedTypeList(&user_defined_type_list, &parseduserdefinedtypelist); err = handle_request_fat(&request_block, request_block0, &client_block, server_block, &metadata_block, &data_blocks, - &actions_desc, &actions_sig); + &actions_desc, &actions_sig); if (err != 0) { return err; } err = fat_client_return(server_block, &data_blocks, data_blocks0, &request_block, &client_block, &metadata_block, - &log_struct_list, &io_data); + &log_struct_list, &io_data); if (err != 0) { return err; } @@ -247,8 +247,8 @@ static int process_hierarchical_data(DATA_BLOCK* data_block, LOGSTRUCTLIST* log_ } int fat_client_return(SERVER_BLOCK* server_block, DATA_BLOCK_LIST* data_blocks, DATA_BLOCK_LIST* data_blocks0, - REQUEST_BLOCK* request_block, CLIENT_BLOCK* client_block, METADATA_BLOCK* metadata_block, - LOGSTRUCTLIST* log_struct_list, IoData* io_data) + REQUEST_BLOCK* request_block, CLIENT_BLOCK* client_block, METADATA_BLOCK* metadata_block, + LOGSTRUCTLIST* log_struct_list, IoData* io_data) { //---------------------------------------------------------------------------- // Gather Server Error State @@ -277,8 +277,8 @@ int fat_client_return(SERVER_BLOCK* server_block, DATA_BLOCK_LIST* data_blocks, } int handle_request_fat(REQUEST_BLOCK* request_block, REQUEST_BLOCK* request_block0, CLIENT_BLOCK* client_block, - SERVER_BLOCK* server_block, METADATA_BLOCK* metadata_block, DATA_BLOCK_LIST* data_blocks, - ACTIONS* actions_desc, ACTIONS* actions_sig) + SERVER_BLOCK* server_block, METADATA_BLOCK* metadata_block, DATA_BLOCK_LIST* data_blocks, + ACTIONS* actions_desc, ACTIONS* actions_sig) { UDA_LOG(UDA_LOG_DEBUG, "Start of Server Error Trap #1 Loop\n"); @@ -382,7 +382,7 @@ int handle_request_fat(REQUEST_BLOCK* request_block, REQUEST_BLOCK* request_bloc } int do_fat_server_closedown(SERVER_BLOCK* server_block, DATA_BLOCK_LIST* data_blocks, ACTIONS* actions_desc, - ACTIONS* actions_sig, DATA_BLOCK_LIST* data_blocks0) + ACTIONS* actions_sig, DATA_BLOCK_LIST* data_blocks0) { //---------------------------------------------------------------------------- // Free Plugin List and Close all open library entries diff --git a/source/server/getPluginAddress.cpp b/source/server/getPluginAddress.cpp index 8fc66caf..f78e4bd3 100644 --- a/source/server/getPluginAddress.cpp +++ b/source/server/getPluginAddress.cpp @@ -4,8 +4,8 @@ #include #include -#include "logging/logging.h" #include "clientserver/errorLog.h" +#include "logging/logging.h" /** * Return the function address for plugin data readers located in external shared libraries diff --git a/source/server/initPluginList.cpp b/source/server/initPluginList.cpp index 9521cec8..de188642 100644 --- a/source/server/initPluginList.cpp +++ b/source/server/initPluginList.cpp @@ -6,8 +6,8 @@ #include "cache/memcache.hpp" #include "clientserver/errorLog.h" #include "clientserver/stringUtils.h" -#include "uda/plugins.h" #include "server/serverPlugin.h" +#include "uda/plugins.h" #include "getPluginAddress.h" diff --git a/source/server/initPluginList.h b/source/server/initPluginList.h index 276b83b7..cfdc3cbd 100644 --- a/source/server/initPluginList.h +++ b/source/server/initPluginList.h @@ -1,6 +1,6 @@ #pragma once -#include "serverPlugin.h" #include "clientserver/udaStructs.h" +#include "serverPlugin.h" void initPluginList(PLUGINLIST* plugin_list, ENVIRONMENT* environment); diff --git a/source/server/serverGetData.cpp b/source/server/serverGetData.cpp index 94449b14..be6540d0 100644 --- a/source/server/serverGetData.cpp +++ b/source/server/serverGetData.cpp @@ -7,13 +7,13 @@ # define strncasecmp _strnicmp #endif -#include "clientserver/initStructs.h" -#include "logging/logging.h" #include "clientserver/errorLog.h" +#include "clientserver/initStructs.h" #include "clientserver/makeRequestBlock.h" #include "clientserver/nameValueSubstitution.h" #include "clientserver/printStructs.h" #include "clientserver/stringUtils.h" +#include "logging/logging.h" #include "applyXML.h" #include "getServerEnvironment.h" diff --git a/source/server/serverGetData.h b/source/server/serverGetData.h index 8d97ede8..855a83b9 100644 --- a/source/server/serverGetData.h +++ b/source/server/serverGetData.h @@ -1,10 +1,10 @@ #pragma once -#include "structures/genStructs.h" -#include "clientserver/udaStructs.h" -#include "serverPlugin.h" #include "clientserver/parseXML.h" #include "clientserver/socketStructs.h" +#include "clientserver/udaStructs.h" +#include "serverPlugin.h" +#include "structures/genStructs.h" int udaGetData(int* depth, REQUEST_DATA* request_data, CLIENT_BLOCK client_block, DATA_BLOCK* data_block, DATA_SOURCE* data_source, SIGNAL* signal_rec, SIGNAL_DESC* signal_desc, ACTIONS* actions_desc, diff --git a/source/server/serverPlugin.cpp b/source/server/serverPlugin.cpp index d1ed3433..37effe61 100644 --- a/source/server/serverPlugin.cpp +++ b/source/server/serverPlugin.cpp @@ -16,15 +16,15 @@ # define dup2 _dup2 #endif -#include "clientserver/initStructs.h" #include "clientserver/errorLog.h" #include "clientserver/expand_path.h" +#include "clientserver/initStructs.h" #include "clientserver/makeRequestBlock.h" #include "clientserver/printStructs.h" #include "clientserver/stringUtils.h" #include "logging/logging.h" -#include "uda/plugins.h" #include "structures/struct.h" +#include "uda/plugins.h" #define REQUEST_READ_START 1000 #define REQUEST_PLUGIN_MCOUNT 100 // Maximum initial number of plugins that can be registered diff --git a/source/server/serverPlugin.h b/source/server/serverPlugin.h index 3680f364..b750f91c 100644 --- a/source/server/serverPlugin.h +++ b/source/server/serverPlugin.h @@ -22,7 +22,7 @@ enum pluginClass { struct PluginList; // Forward declaration typedef struct PluginList PLUGINLIST; -typedef struct UdaPluginInterface { // Standard Plugin interface +typedef struct UdaPluginInterface { // Standard Plugin interface unsigned short interfaceVersion; // Interface Version unsigned short pluginVersion; // Plugin Version unsigned short sqlConnectionType; // Which SQL is the server connected to @@ -87,13 +87,13 @@ void freePluginList(PLUGINLIST* plugin_list); void initPluginData(PLUGIN_DATA* plugin); int udaServerRedirectStdStreams(int reset); int udaServerPlugin(REQUEST_DATA* request, DATA_SOURCE* data_source, SIGNAL_DESC* signal_desc, - const PLUGINLIST* plugin_list, const ENVIRONMENT* environment); -int udaProvenancePlugin(CLIENT_BLOCK* client_block, REQUEST_DATA* original_request, - DATA_SOURCE* data_source, SIGNAL_DESC* signal_desc, const PLUGINLIST* plugin_list, - const char* logRecord, const ENVIRONMENT* environment); + const PLUGINLIST* plugin_list, const ENVIRONMENT* environment); +int udaProvenancePlugin(CLIENT_BLOCK* client_block, REQUEST_DATA* original_request, DATA_SOURCE* data_source, + SIGNAL_DESC* signal_desc, const PLUGINLIST* plugin_list, const char* logRecord, + const ENVIRONMENT* environment); int udaServerMetaDataPluginId(const PLUGINLIST* plugin_list, const ENVIRONMENT* environment); int udaServerMetaDataPlugin(const PLUGINLIST* plugin_list, int plugin_id, REQUEST_DATA* request_block, - SIGNAL_DESC* signal_desc, SIGNAL* signal_rec, DATA_SOURCE* data_source, - const ENVIRONMENT* environment); + SIGNAL_DESC* signal_desc, SIGNAL* signal_rec, DATA_SOURCE* data_source, + const ENVIRONMENT* environment); #endif // UDA_SERVER_SERVERPLUGIN_H diff --git a/source/server/serverProcessing.cpp b/source/server/serverProcessing.cpp index e4968414..831d09c2 100644 --- a/source/server/serverProcessing.cpp +++ b/source/server/serverProcessing.cpp @@ -2,8 +2,8 @@ #include -#include #include "logging/logging.h" +#include template bool reduce_dim(DIMS* ddim) { diff --git a/source/server/serverSubsetData.cpp b/source/server/serverSubsetData.cpp index ffe2ddde..d1870946 100644 --- a/source/server/serverSubsetData.cpp +++ b/source/server/serverSubsetData.cpp @@ -21,15 +21,15 @@ # define strncasecmp _strnicmp #endif -#include "clientserver/initStructs.h" -#include -#include #include "clientserver/compressDim.h" #include "clientserver/errorLog.h" +#include "clientserver/initStructs.h" #include "clientserver/printStructs.h" #include "clientserver/stringUtils.h" #include "logging/logging.h" #include "uda/structured.h" +#include +#include //---------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------------- @@ -1673,16 +1673,46 @@ template struct Abs { T operator()(T value); }; -template <> float Abs::operator()(float value) { return std::fabs(value); } -template <> double Abs::operator()(double value) { return std::fabs(value); } -template <> short Abs::operator()(short value) { return std::abs(value); } -template <> unsigned short Abs::operator()(unsigned short value) { return value; } -template <> int Abs::operator()(int value) { return std::abs(value); } -template <> unsigned int Abs::operator()(unsigned int value) { return value; } -template <> long Abs::operator()(long value) { return std::labs(value); } -template <> unsigned long Abs::operator()(unsigned long value) { return value; } -template <> long long Abs::operator()(long long value) { return std::llabs(value); } -template <> unsigned long long Abs::operator()(unsigned long long value) { return value; } +template <> float Abs::operator()(float value) +{ + return std::fabs(value); +} +template <> double Abs::operator()(double value) +{ + return std::fabs(value); +} +template <> short Abs::operator()(short value) +{ + return std::abs(value); +} +template <> unsigned short Abs::operator()(unsigned short value) +{ + return value; +} +template <> int Abs::operator()(int value) +{ + return std::abs(value); +} +template <> unsigned int Abs::operator()(unsigned int value) +{ + return value; +} +template <> long Abs::operator()(long value) +{ + return std::labs(value); +} +template <> unsigned long Abs::operator()(unsigned long value) +{ + return value; +} +template <> long long Abs::operator()(long long value) +{ + return std::llabs(value); +} +template <> unsigned long long Abs::operator()(unsigned long long value) +{ + return value; +} template int get_subset_indices_for_type(const std::string& operation, DIMS* dim, double value, unsigned int* subset_indices) diff --git a/source/server/serverSubsetData.h b/source/server/serverSubsetData.h index 66f80c45..d5f6112e 100644 --- a/source/server/serverSubsetData.h +++ b/source/server/serverSubsetData.h @@ -1,10 +1,9 @@ #pragma once -#include "structures/genStructs.h" -#include "clientserver/udaStructs.h" #include "clientserver/parseXML.h" +#include "clientserver/udaStructs.h" #include "serverPlugin.h" +#include "structures/genStructs.h" int serverSubsetData(DATA_BLOCK* data_block, const ACTION& action, LOGMALLOCLIST* logmalloclist); -int serverParseServerSide(REQUEST_DATA* request_block, ACTIONS* actions_serverside, - const PLUGINLIST* plugin_list); +int serverParseServerSide(REQUEST_DATA* request_block, ACTIONS* actions_serverside, const PLUGINLIST* plugin_list); diff --git a/source/server/udaLegacyServer.cpp b/source/server/udaLegacyServer.cpp index dbee3fac..2730a6da 100644 --- a/source/server/udaLegacyServer.cpp +++ b/source/server/udaLegacyServer.cpp @@ -5,9 +5,8 @@ #include "udaLegacyServer.h" -#include "clientserver/initStructs.h" -#include "uda/structured.h" #include "clientserver/errorLog.h" +#include "clientserver/initStructs.h" #include "clientserver/makeRequestBlock.h" #include "clientserver/printStructs.h" #include "clientserver/protocol.h" @@ -16,6 +15,7 @@ #include "logging/logging.h" #include "server/serverPlugin.h" #include "structures/struct.h" +#include "uda/structured.h" #include "closeServerSockets.h" #include "createXDRStream.h" diff --git a/source/server/udaLegacyServer.h b/source/server/udaLegacyServer.h index 78213543..1a458ce1 100644 --- a/source/server/udaLegacyServer.h +++ b/source/server/udaLegacyServer.h @@ -1,10 +1,9 @@ #pragma once -#include "uda/types.h" +#include "clientserver/socketStructs.h" #include "clientserver/udaStructs.h" #include "serverPlugin.h" -#include "clientserver/socketStructs.h" - +#include "uda/types.h" /** * UDA Legacy Data Server (protocol versions <= 6) @@ -12,4 +11,3 @@ int legacyServer(CLIENT_BLOCK client_block, const PLUGINLIST* pluginlist, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, SOCKETLIST* socket_list, int protocolVersion, XDR* server_input, XDR* server_output, unsigned int private_flags, int malloc_source); - diff --git a/source/server/udaServer.cpp b/source/server/udaServer.cpp index 8691f9da..9a74df77 100644 --- a/source/server/udaServer.cpp +++ b/source/server/udaServer.cpp @@ -8,13 +8,13 @@ #include -#include "clientserver/initStructs.h" -#include "clientserver/udaErrors.h" #include "cache/memcache.hpp" #include "clientserver/errorLog.h" +#include "clientserver/initStructs.h" #include "clientserver/manageSockets.h" #include "clientserver/printStructs.h" #include "clientserver/protocol.h" +#include "clientserver/udaErrors.h" #include "clientserver/xdrlib.h" #include "logging/accessLog.h" #include "logging/logging.h" @@ -29,8 +29,8 @@ #include "serverLegacyPlugin.h" #include "serverProcessing.h" #include "serverStartup.h" -#include "udaLegacyServer.h" #include "uda/structured.h" +#include "udaLegacyServer.h" #ifdef SECURITYENABLED # include @@ -68,7 +68,7 @@ USERDEFINEDTYPELIST parsed_user_defined_type_list; // Initial set of User Define // Total amount sent for the last data request static PLUGINLIST plugin_list; // List of all data reader plugins (internal and external shared libraries) -ENVIRONMENT environment; // Holds local environment variable values +ENVIRONMENT environment; // Holds local environment variable values static SOCKETLIST socket_list; @@ -83,30 +83,29 @@ typedef struct MetadataBlock { static int startup_server(SERVER_BLOCK* server_block, XDR*& server_input, XDR*& server_output, IoData* io_data); static int handle_request(REQUEST_BLOCK* request_block, CLIENT_BLOCK* client_block, SERVER_BLOCK* server_block, - METADATA_BLOCK* metadata_block, ACTIONS* actions_desc, ACTIONS* actions_sig, - DATA_BLOCK_LIST* data_block_list, int* fatal, int* server_closedown, - uda::cache::UdaCache* cache, LOGSTRUCTLIST* log_struct_list, XDR* server_input, - const unsigned int* total_datablock_size, int server_tot_block_time, int* server_timeout); + METADATA_BLOCK* metadata_block, ACTIONS* actions_desc, ACTIONS* actions_sig, + DATA_BLOCK_LIST* data_block_list, int* fatal, int* server_closedown, + uda::cache::UdaCache* cache, LOGSTRUCTLIST* log_struct_list, XDR* server_input, + const unsigned int* total_datablock_size, int server_tot_block_time, int* server_timeout); static int do_server_loop(REQUEST_BLOCK* request_block, DATA_BLOCK_LIST* data_block_list, CLIENT_BLOCK* client_block, - SERVER_BLOCK* server_block, METADATA_BLOCK* metadata_block, ACTIONS* actions_desc, - ACTIONS* actions_sig, int* fatal, uda::cache::UdaCache* cache, LOGSTRUCTLIST* log_struct_list, - XDR* server_input, XDR* server_output, unsigned int* total_datablock_size, - int server_tot_block_time, int* server_timeout); + SERVER_BLOCK* server_block, METADATA_BLOCK* metadata_block, ACTIONS* actions_desc, + ACTIONS* actions_sig, int* fatal, uda::cache::UdaCache* cache, LOGSTRUCTLIST* log_struct_list, + XDR* server_input, XDR* server_output, unsigned int* total_datablock_size, + int server_tot_block_time, int* server_timeout); -static int -report_to_client(SERVER_BLOCK *server_block, DATA_BLOCK_LIST *data_block_list, CLIENT_BLOCK *client_block, int trap1Err, - METADATA_BLOCK *metadata_block, LOGSTRUCTLIST *log_struct_list, XDR *server_output, - unsigned int *total_datablock_size); +static int report_to_client(SERVER_BLOCK* server_block, DATA_BLOCK_LIST* data_block_list, CLIENT_BLOCK* client_block, + int trap1Err, METADATA_BLOCK* metadata_block, LOGSTRUCTLIST* log_struct_list, + XDR* server_output, unsigned int* total_datablock_size); -static int do_server_closedown(CLIENT_BLOCK* client_block, REQUEST_BLOCK* request_block, DATA_BLOCK_LIST* data_block_list, - int server_tot_block_time, int server_timeout); +static int do_server_closedown(CLIENT_BLOCK* client_block, REQUEST_BLOCK* request_block, + DATA_BLOCK_LIST* data_block_list, int server_tot_block_time, int server_timeout); #ifdef SECURITYENABLED static int authenticateClient(CLIENT_BLOCK* client_block, SERVER_BLOCK* server_block); #else static int handshake_client(CLIENT_BLOCK* client_block, SERVER_BLOCK* server_block, int* server_closedown, - LOGSTRUCTLIST* log_struct_list, XDR* server_input, XDR* server_output); + LOGSTRUCTLIST* log_struct_list, XDR* server_input, XDR* server_output); #endif //-------------------------------------------------------------------------------------- @@ -159,8 +158,8 @@ int uda_server(CLIENT_BLOCK client_block) err = authenticateClient(&client_block, &server_block); #else int server_closedown = 0; - err = - handshake_client(&client_block, &server_block, &server_closedown, &log_struct_list, server_input, server_output); + err = handshake_client(&client_block, &server_block, &server_closedown, &log_struct_list, server_input, + server_output); #endif DATA_BLOCK_LIST data_block_list; @@ -170,8 +169,8 @@ int uda_server(CLIENT_BLOCK client_block) if (!err && !server_closedown) { int fatal = 0; do_server_loop(&request_block, &data_block_list, &client_block, &server_block, &metadata_block, &actions_desc, - &actions_sig, &fatal, cache, &log_struct_list, server_input, server_output, &total_datablock_size, - server_tot_block_time, &server_timeout); + &actions_sig, &fatal, cache, &log_struct_list, server_input, server_output, + &total_datablock_size, server_tot_block_time, &server_timeout); } err = do_server_closedown(&client_block, &request_block, &data_block_list, server_tot_block_time, server_timeout); @@ -179,10 +178,9 @@ int uda_server(CLIENT_BLOCK client_block) return err; } -int -report_to_client(SERVER_BLOCK *server_block, DATA_BLOCK_LIST *data_block_list, CLIENT_BLOCK *client_block, int trap1Err, - METADATA_BLOCK *metadata_block, LOGSTRUCTLIST *log_struct_list, XDR *server_output, - unsigned int *total_datablock_size) +int report_to_client(SERVER_BLOCK* server_block, DATA_BLOCK_LIST* data_block_list, CLIENT_BLOCK* client_block, + int trap1Err, METADATA_BLOCK* metadata_block, LOGSTRUCTLIST* log_struct_list, XDR* server_output, + unsigned int* total_datablock_size) { //---------------------------------------------------------------------------- // Gather Server Error State @@ -379,10 +377,10 @@ report_to_client(SERVER_BLOCK *server_block, DATA_BLOCK_LIST *data_block_list, C } int handle_request(REQUEST_BLOCK* request_block, CLIENT_BLOCK* client_block, SERVER_BLOCK* server_block, - METADATA_BLOCK* metadata_block, ACTIONS* actions_desc, ACTIONS* actions_sig, - DATA_BLOCK_LIST* data_block_list, int* fatal, int* server_closedown, uda::cache::UdaCache* cache, - LOGSTRUCTLIST* log_struct_list, XDR* server_input, const unsigned int* total_datablock_size, - int server_tot_block_time, int* server_timeout) + METADATA_BLOCK* metadata_block, ACTIONS* actions_desc, ACTIONS* actions_sig, + DATA_BLOCK_LIST* data_block_list, int* fatal, int* server_closedown, uda::cache::UdaCache* cache, + LOGSTRUCTLIST* log_struct_list, XDR* server_input, const unsigned int* total_datablock_size, + int server_tot_block_time, int* server_timeout) { UDA_LOG(UDA_LOG_DEBUG, "Start of Server Error Trap #1 Loop\n"); @@ -723,8 +721,8 @@ int handle_request(REQUEST_BLOCK* request_block, CLIENT_BLOCK* client_block, SER for (int i = 0; i < request_block->num_requests; ++i) { auto request = &request_block->requests[i]; if (protocol_version >= 6) { - if ((err = udaServerPlugin(request, &metadata_block->data_source, &metadata_block->signal_desc, &plugin_list, - getServerEnvironment())) != 0) { + if ((err = udaServerPlugin(request, &metadata_block->data_source, &metadata_block->signal_desc, + &plugin_list, getServerEnvironment())) != 0) { return err; } } else { @@ -841,10 +839,10 @@ int handle_request(REQUEST_BLOCK* request_block, CLIENT_BLOCK* client_block, SER } int do_server_loop(REQUEST_BLOCK* request_block, DATA_BLOCK_LIST* data_block_list, CLIENT_BLOCK* client_block, - SERVER_BLOCK* server_block, METADATA_BLOCK* metadata_block, ACTIONS* actions_desc, - ACTIONS* actions_sig, int* fatal, uda::cache::UdaCache* cache, LOGSTRUCTLIST* log_struct_list, - XDR* server_input, XDR* server_output, unsigned int* total_datablock_size, int server_tot_block_time, - int* server_timeout) + SERVER_BLOCK* server_block, METADATA_BLOCK* metadata_block, ACTIONS* actions_desc, + ACTIONS* actions_sig, int* fatal, uda::cache::UdaCache* cache, LOGSTRUCTLIST* log_struct_list, + XDR* server_input, XDR* server_output, unsigned int* total_datablock_size, int server_tot_block_time, + int* server_timeout) { int err = 0; @@ -864,8 +862,8 @@ int do_server_loop(REQUEST_BLOCK* request_block, DATA_BLOCK_LIST* data_block_lis int server_closedown = 0; err = handle_request(request_block, client_block, server_block, metadata_block, actions_desc, actions_sig, - data_block_list, fatal, &server_closedown, cache, log_struct_list, server_input, - total_datablock_size, server_tot_block_time, server_timeout); + data_block_list, fatal, &server_closedown, cache, log_struct_list, server_input, + total_datablock_size, server_tot_block_time, server_timeout); if (server_closedown) { break; @@ -934,7 +932,7 @@ int do_server_loop(REQUEST_BLOCK* request_block, DATA_BLOCK_LIST* data_block_lis } int do_server_closedown(CLIENT_BLOCK* client_block, REQUEST_BLOCK* request_block, DATA_BLOCK_LIST* data_block_list, - int server_tot_block_time, int server_timeout) + int server_tot_block_time, int server_timeout) { //---------------------------------------------------------------------------- // Server Destruct..... @@ -1045,7 +1043,7 @@ int authenticateClient(CLIENT_BLOCK* client_block, SERVER_BLOCK* server_block) #endif int handshake_client(CLIENT_BLOCK* client_block, SERVER_BLOCK* server_block, int* server_closedown, - LOGSTRUCTLIST* log_struct_list, XDR* server_input, XDR* server_output) + LOGSTRUCTLIST* log_struct_list, XDR* server_input, XDR* server_output) { // Exchange version details - once only diff --git a/source/server/udaServer.h b/source/server/udaServer.h index 502574c1..62552b63 100644 --- a/source/server/udaServer.h +++ b/source/server/udaServer.h @@ -5,5 +5,4 @@ int uda_server(CLIENT_BLOCK client_block); int fat_server(CLIENT_BLOCK client_block, SERVER_BLOCK* server_block, REQUEST_BLOCK* request_block0, - DATA_BLOCK_LIST* data_blocks0); - + DATA_BLOCK_LIST* data_blocks0); diff --git a/source/server2/apply_XML.cpp b/source/server2/apply_XML.cpp index 5cf5ef2e..b67f7fbc 100644 --- a/source/server2/apply_XML.cpp +++ b/source/server2/apply_XML.cpp @@ -17,9 +17,9 @@ #include #include -#include #include "clientserver/stringUtils.h" #include "logging/logging.h" +#include int uda::server_parse_signal_XML(DATA_SOURCE data_source, SIGNAL signal, SIGNAL_DESC signal_desc, ACTIONS* actions_desc, ACTIONS* actions_sig) diff --git a/source/server2/get_data.cpp b/source/server2/get_data.cpp index eb595fbf..6165b2f8 100644 --- a/source/server2/get_data.cpp +++ b/source/server2/get_data.cpp @@ -2,16 +2,16 @@ #include "apply_XML.hpp" #include "clientserver/errorLog.h" +#include "clientserver/initStructs.h" #include "clientserver/nameValueSubstitution.h" #include "clientserver/printStructs.h" #include "clientserver/stringUtils.h" -#include "clientserver/initStructs.h" #include "logging/logging.h" #include "make_server_request_block.hpp" +#include "plugins.hpp" +#include "server.hpp" #include "server_plugin.h" #include "server_subset_data.h" -#include "server.hpp" -#include "plugins.hpp" #include "uda/plugins.h" #include diff --git a/source/server2/get_plugin_address.cpp b/source/server2/get_plugin_address.cpp index 498517bf..bee7c1be 100644 --- a/source/server2/get_plugin_address.cpp +++ b/source/server2/get_plugin_address.cpp @@ -4,8 +4,8 @@ #include #include -#include "logging/logging.h" #include "clientserver/errorLog.h" +#include "logging/logging.h" /** * Return the function address for plugin data readers located in external shared libraries diff --git a/source/server2/plugins.cpp b/source/server2/plugins.cpp index ca2ecefc..5132f4ed 100644 --- a/source/server2/plugins.cpp +++ b/source/server2/plugins.cpp @@ -7,9 +7,9 @@ #include "get_plugin_address.hpp" #include "plugins.hpp" +#include "clientserver/errorLog.h" #include "clientserver/stringUtils.h" #include "logging/logging.h" -#include "clientserver/errorLog.h" #include "uda/plugins.h" #define REQUEST_READ_START 1000 diff --git a/source/server2/server.cpp b/source/server2/server.cpp index 95bd06ad..7e0868b0 100644 --- a/source/server2/server.cpp +++ b/source/server2/server.cpp @@ -2,14 +2,14 @@ #include #include -#include #include +#include #include "clientserver/errorLog.h" +#include "clientserver/initStructs.h" #include "clientserver/printStructs.h" #include "clientserver/protocol.h" #include "clientserver/xdrlib.h" -#include "clientserver/initStructs.h" #include "logging/accessLog.h" #include "logging/logging.h" #include "server_exceptions.h" diff --git a/source/server2/server_plugin.cpp b/source/server2/server_plugin.cpp index 5b7cee83..19a7cd6a 100644 --- a/source/server2/server_plugin.cpp +++ b/source/server2/server_plugin.cpp @@ -18,15 +18,15 @@ # define dup2 _dup2 #endif -#include "clientserver/initStructs.h" -#include "logging/logging.h" #include "clientserver/errorLog.h" #include "clientserver/expand_path.h" +#include "clientserver/initStructs.h" #include "clientserver/makeRequestBlock.h" #include "clientserver/printStructs.h" #include "clientserver/stringUtils.h" -#include "uda/plugins.h" +#include "logging/logging.h" #include "structures/struct.h" +#include "uda/plugins.h" #define REQUEST_READ_START 1000 #define REQUEST_PLUGIN_MCOUNT 100 // Maximum initial number of plugins that can be registered diff --git a/source/server2/server_plugin.h b/source/server2/server_plugin.h index 30c864a5..96f7c2b5 100644 --- a/source/server2/server_plugin.h +++ b/source/server2/server_plugin.h @@ -1,8 +1,8 @@ #ifndef UDA_SERVER_SERVERPLUGIN_H #define UDA_SERVER_SERVERPLUGIN_H -#include "plugins.hpp" #include "clientserver/udaStructs.h" +#include "plugins.hpp" #include "uda/types.h" #define REQUEST_READ_START 1000 @@ -11,7 +11,7 @@ typedef struct PluginList PLUGINLIST; -typedef struct UdaPluginInterface { // Standard Plugin interface +typedef struct UdaPluginInterface { // Standard Plugin interface unsigned short interfaceVersion; // Interface Version unsigned short pluginVersion; // Plugin Version unsigned short sqlConnectionType; // Which SQL is the server connected to @@ -41,7 +41,8 @@ namespace uda class Plugins; struct MetadataBlock; -namespace server { +namespace server +{ class Environment; } diff --git a/source/server2/server_processing.cpp b/source/server2/server_processing.cpp index 9b8fbe20..2a122c51 100644 --- a/source/server2/server_processing.cpp +++ b/source/server2/server_processing.cpp @@ -2,8 +2,8 @@ #include -#include #include "logging/logging.h" +#include /** * UDA Server Side Data Processing diff --git a/source/server2/server_subset_data.cpp b/source/server2/server_subset_data.cpp index 480e5d61..f256d342 100644 --- a/source/server2/server_subset_data.cpp +++ b/source/server2/server_subset_data.cpp @@ -17,14 +17,14 @@ # define strncasecmp _strnicmp #endif -#include "clientserver/initStructs.h" -#include #include "clientserver/compressDim.h" #include "clientserver/errorLog.h" +#include "clientserver/initStructs.h" #include "clientserver/printStructs.h" #include "clientserver/stringUtils.h" #include "logging/logging.h" #include "uda/structured.h" +#include //---------------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------------- diff --git a/source/server2/server_subset_data.h b/source/server2/server_subset_data.h index 50afb45d..38aa8bb4 100644 --- a/source/server2/server_subset_data.h +++ b/source/server2/server_subset_data.h @@ -3,9 +3,9 @@ #ifndef UDA_SERVER_SERVERSUBSETDATA_H # define UDA_SERVER_SERVERSUBSETDATA_H -# include "structures/genStructs.h" -# include "clientserver/udaStructs.h" # include "clientserver/parseXML.h" +# include "clientserver/udaStructs.h" +# include "structures/genStructs.h" namespace uda { diff --git a/source/server2/xdr_protocol.cpp b/source/server2/xdr_protocol.cpp index c598ed8a..d2645e82 100644 --- a/source/server2/xdr_protocol.cpp +++ b/source/server2/xdr_protocol.cpp @@ -2,8 +2,8 @@ #include "clientserver/errorLog.h" #include "clientserver/printStructs.h" #include "clientserver/protocol.h" -#include "clientserver/xdrlib.h" #include "clientserver/udaErrors.h" +#include "clientserver/xdrlib.h" #include #ifdef SSLAUTHENTICATION # include "authentication/udaServerSSL.h" diff --git a/source/structures/accessors.cpp b/source/structures/accessors.cpp index fdd656a6..c9d8fee2 100644 --- a/source/structures/accessors.cpp +++ b/source/structures/accessors.cpp @@ -840,63 +840,51 @@ void printImage(const char* image, int imagecount) } } -template -struct TypeNamer { +template struct TypeNamer { static constexpr const char* Name = ""; }; -template <> -struct TypeNamer { +template <> struct TypeNamer { static constexpr const char* Name = "short"; }; -template <> -struct TypeNamer { +template <> struct TypeNamer { static constexpr const char* Name = "int"; }; -template <> -struct TypeNamer { +template <> struct TypeNamer { static constexpr const char* Name = "long long"; }; -template <> -struct TypeNamer { +template <> struct TypeNamer { static constexpr const char* Name = "unsigned short"; }; -template <> -struct TypeNamer { +template <> struct TypeNamer { static constexpr const char* Name = "unsigned int"; }; -template <> -struct TypeNamer { +template <> struct TypeNamer { static constexpr const char* Name = "unsigned long long"; }; -template <> -struct TypeNamer { +template <> struct TypeNamer { static constexpr const char* Name = "float"; }; -template <> -struct TypeNamer { +template <> struct TypeNamer { static constexpr const char* Name = "double"; }; -template <> -struct TypeNamer { +template <> struct TypeNamer { static constexpr const char* Name = "char"; }; -template <> -struct TypeNamer { +template <> struct TypeNamer { static constexpr const char* Name = "unsigned char"; }; -template <> -struct TypeNamer { +template <> struct TypeNamer { static constexpr const char* Name = "string"; }; @@ -938,7 +926,8 @@ void defineArrayField(CompoundField* field, const char* name, const char* desc, * @param type_id Enumerated key indicating the type of data field, e.g. float array * @return Void */ -void defineField(COMPOUNDFIELD* field, const char* name, const char* desc, int* offset, unsigned short type_id, int rank, int* shape) +void defineField(COMPOUNDFIELD* field, const char* name, const char* desc, int* offset, unsigned short type_id, + int rank, int* shape) { initCompoundField(field); strcpy(field->name, name); @@ -1103,7 +1092,7 @@ void defineUserTypeField(COMPOUNDFIELD* field, const char* name, const char* des field->count = 1; } else { field->rank = rank; - field->shape = (int *) malloc(rank * sizeof(int)); + field->shape = (int*)malloc(rank * sizeof(int)); int count = 1; for (int i = 0; i < rank; ++i) { field->shape[i] = shape[i]; diff --git a/source/structures/accessors.h b/source/structures/accessors.h index d0dbd7d5..1545b02c 100644 --- a/source/structures/accessors.h +++ b/source/structures/accessors.h @@ -2,8 +2,8 @@ #include "genStructs.h" -void defineField(COMPOUNDFIELD* field, const char* name, const char* desc, int* offset, - unsigned short type_id, int rank, int* shape); +void defineField(COMPOUNDFIELD* field, const char* name, const char* desc, int* offset, unsigned short type_id, + int rank, int* shape); void defineUserTypeField(COMPOUNDFIELD* field, const char* name, const char* desc, int* offset, int rank, int* shape, USERDEFINEDTYPE* user_type, bool is_pointer); \ No newline at end of file diff --git a/source/structures/genStructs.h b/source/structures/genStructs.h index a76e2cc6..92484fff 100644 --- a/source/structures/genStructs.h +++ b/source/structures/genStructs.h @@ -1,12 +1,12 @@ #ifndef UDA_STRUCTURES_GENSTRUCTS_H #define UDA_STRUCTURES_GENSTRUCTS_H -#include -#include -#include -#include #include #include +#include +#include +#include +#include //------------------------------------------------------------------------------------------------------- // Macro definitions diff --git a/source/structures/parseIncludeFile.cpp b/source/structures/parseIncludeFile.cpp index b7768566..97c0c8d4 100644 --- a/source/structures/parseIncludeFile.cpp +++ b/source/structures/parseIncludeFile.cpp @@ -26,9 +26,9 @@ #include -#include "clientserver/udaDefines.h" #include "clientserver/errorLog.h" #include "clientserver/stringUtils.h" +#include "clientserver/udaDefines.h" #include "struct.h" int parseIncludeFile(USERDEFINEDTYPELIST* userdefinedtypelist, const char* header) diff --git a/source/structures/struct.cpp b/source/structures/struct.cpp index 2914512d..5854b31c 100644 --- a/source/structures/struct.cpp +++ b/source/structures/struct.cpp @@ -54,13 +54,13 @@ #endif #include "clientserver/errorLog.h" +#include "clientserver/protocolXML2Put.h" #include "clientserver/stringUtils.h" #include "clientserver/xdrlib.h" #include "logging/logging.h" -#include "clientserver/protocolXML2Put.h" -#include #include "xdrUserDefinedData.h" +#include #if defined(SERVERBUILD) # include "server/udaServer.h" @@ -1336,8 +1336,8 @@ void udaGetInitialUserDefinedTypeList(USERDEFINEDTYPELIST** anew) // Convert data to standard unsigned long64 initCompoundField(&field); - defineField(&field, "enumarray", "Data with this enumerated type", &offset, - ARRAYULONG64, 0, nullptr); // Data need to be converted to this type + defineField(&field, "enumarray", "Data with this enumerated type", &offset, ARRAYULONG64, 0, + nullptr); // Data need to be converted to this type udaAddCompoundField(&usertype, field); initCompoundField(&field); defineField(&field, "enumarray_rank", "The rank of arraydata", &offset, SCALARINT, 0, nullptr); @@ -2088,8 +2088,8 @@ int xdrAtomicData(LOGMALLOCLIST* logmalloclist, XDR* xdrs, const char* type, int // Send/Receive Array of Structures int xdrUserDefinedTypeData(XDR* xdrs, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, - USERDEFINEDTYPE* userdefinedtype, void** data, int protocolVersion, bool xdr_stdio_flag, - LOGSTRUCTLIST* log_struct_list, int malloc_source) + USERDEFINEDTYPE* userdefinedtype, void** data, int protocolVersion, bool xdr_stdio_flag, + LOGSTRUCTLIST* log_struct_list, int malloc_source) { int rc; @@ -3557,7 +3557,7 @@ int udaGetNodeStructureComponentDataCount(LOGMALLOCLIST* logmalloclist, NTREE* n ntree = udaGetFullNTree(); } ntree = - udaFindNTreeStructureComponent2(logmalloclist, ntree, target, &lastname); // Identify node and component name + udaFindNTreeStructureComponent2(logmalloclist, ntree, target, &lastname); // Identify node and component name if (ntree == nullptr) { return 0; } @@ -3604,7 +3604,7 @@ int udaGetNodeStructureComponentDataRank(LOGMALLOCLIST* logmalloclist, NTREE* nt ntree = udaGetFullNTree(); } ntree = - udaFindNTreeStructureComponent2(logmalloclist, ntree, target, &lastname); // Identify node and component name + udaFindNTreeStructureComponent2(logmalloclist, ntree, target, &lastname); // Identify node and component name if (ntree == nullptr) { return 0; } @@ -3648,7 +3648,7 @@ int* udaGetNodeStructureComponentDataShape(LOGMALLOCLIST* logmalloclist, NTREE* ntree = udaGetFullNTree(); } ntree = - udaFindNTreeStructureComponent2(logmalloclist, ntree, target, &lastname); // Identify node and component name + udaFindNTreeStructureComponent2(logmalloclist, ntree, target, &lastname); // Identify node and component name if (ntree == nullptr) { return nullptr; } @@ -3690,7 +3690,7 @@ int udaGetNodeStructureComponentDataIsPointer(LOGMALLOCLIST* logmalloclist, NTRE ntree = udaGetFullNTree(); } ntree = - udaFindNTreeStructureComponent2(logmalloclist, ntree, target, &lastname); // Identify node and component name + udaFindNTreeStructureComponent2(logmalloclist, ntree, target, &lastname); // Identify node and component name if (ntree == nullptr) { return 0; } @@ -3722,7 +3722,7 @@ int udaGetNodeStructureComponentDataSize(LOGMALLOCLIST* logmalloclist, NTREE* nt ntree = udaGetFullNTree(); } ntree = - udaFindNTreeStructureComponent2(logmalloclist, ntree, target, &lastname); // Identify node and component name + udaFindNTreeStructureComponent2(logmalloclist, ntree, target, &lastname); // Identify node and component name if (ntree == nullptr) { return 0; } @@ -3762,7 +3762,7 @@ const char* udaGetNodeStructureComponentDataDataType(LOGMALLOCLIST* logmalloclis ntree = udaGetFullNTree(); } ntree = - udaFindNTreeStructureComponent2(logmalloclist, ntree, target, &lastname); // Identify node and component name + udaFindNTreeStructureComponent2(logmalloclist, ntree, target, &lastname); // Identify node and component name if (ntree == nullptr) { return "unknown"; } @@ -3802,7 +3802,7 @@ void* udaGetNodeStructureComponentData(LOGMALLOCLIST* logmalloclist, NTREE* ntre ntree = udaGetFullNTree(); } ntree = - udaFindNTreeStructureComponent2(logmalloclist, ntree, target, &lastname); // Identify node and component name + udaFindNTreeStructureComponent2(logmalloclist, ntree, target, &lastname); // Identify node and component name if (ntree == nullptr) { return nullptr; } diff --git a/source/structures/xdrUserDefinedData.cpp b/source/structures/xdrUserDefinedData.cpp index 5a5b298e..27062160 100644 --- a/source/structures/xdrUserDefinedData.cpp +++ b/source/structures/xdrUserDefinedData.cpp @@ -1503,8 +1503,7 @@ int xdrUserDefinedData(XDR* xdrs, LOGMALLOCLIST* logmalloclist, LOGSTRUCTLIST* l if (udaGettypeof(type) != UDA_TYPE_UNKNOWN) { char* z = (char*)*p; - rc = rc && - xdrAtomicData(logmalloclist, xdrs, type, count, size, &z); // Must be an Atomic Type + rc = rc && xdrAtomicData(logmalloclist, xdrs, type, count, size, &z); // Must be an Atomic Type *p = (VOIDTYPE)z; break; } else { diff --git a/source/structures/xdrUserDefinedData.h b/source/structures/xdrUserDefinedData.h index 077eb8e5..4df9a073 100644 --- a/source/structures/xdrUserDefinedData.h +++ b/source/structures/xdrUserDefinedData.h @@ -6,8 +6,8 @@ #include "genStructs.h" int xdrUserDefinedData(XDR* xdrs, LOGMALLOCLIST* logmalloclist, LOGSTRUCTLIST* log_struct_list, - USERDEFINEDTYPELIST* userdefinedtypelist, USERDEFINEDTYPE* userdefinedtype, - void** data, int datacount, int structRank, int* structShape, int index, - NTREE** NTree, int protocolVersion, int malloc_source); + USERDEFINEDTYPELIST* userdefinedtypelist, USERDEFINEDTYPE* userdefinedtype, void** data, + int datacount, int structRank, int* structShape, int index, NTREE** NTree, int protocolVersion, + int malloc_source); #endif // UDA_STRUCTURES_XDRUSERDEFINEDDATA_H diff --git a/source/wrappers/c++/client.cpp b/source/wrappers/c++/client.cpp index 84c1ec65..9eecea01 100644 --- a/source/wrappers/c++/client.cpp +++ b/source/wrappers/c++/client.cpp @@ -186,8 +186,7 @@ int uda::Client::serverPort() backtrace.reserve(num_errors); for (int i = 0; i < num_errors; ++i) { - backtrace.push_back(std::string("[") + udaGetErrorLocation(i) + - "]: " + udaGetErrorMessage(i)); + backtrace.push_back(std::string("[") + udaGetErrorLocation(i) + "]: " + udaGetErrorMessage(i)); } if ((code > 0 && code < 25) || (code > 60 && code < 66)) { diff --git a/source/wrappers/c++/result.cpp b/source/wrappers/c++/result.cpp index c19a4d68..a3277666 100644 --- a/source/wrappers/c++/result.cpp +++ b/source/wrappers/c++/result.cpp @@ -69,17 +69,17 @@ uda::Result::Result(int handle) { if (handle >= 0 && (bool)udaGetProperty("get_meta")) { // TODO: fix reading all meta fields -// SIGNAL_DESC* signal_desc = getIdamSignalDesc(handle); -// meta_["signal_name"] = signal_desc->signal_name; -// meta_["signal_alias"] = signal_desc->signal_alias; -// -// DATA_SOURCE* source = getIdamDataSource(handle); -// meta_["path"] = source->path; -// meta_["filename"] = source->filename; -// meta_["format"] = source->format; -// meta_["exp_number"] = std::to_string(source->exp_number); -// meta_["pass"] = std::to_string(source->pass); -// meta_["pass_date"] = source->pass_date; + // SIGNAL_DESC* signal_desc = getIdamSignalDesc(handle); + // meta_["signal_name"] = signal_desc->signal_name; + // meta_["signal_alias"] = signal_desc->signal_alias; + // + // DATA_SOURCE* source = getIdamDataSource(handle); + // meta_["path"] = source->path; + // meta_["filename"] = source->filename; + // meta_["format"] = source->format; + // meta_["exp_number"] = std::to_string(source->exp_number); + // meta_["pass"] = std::to_string(source->pass); + // meta_["pass_date"] = source->pass_date; } istree_ = (udaSetDataTree(handle) != 0); } diff --git a/source/wrappers/c++/treenode.cpp b/source/wrappers/c++/treenode.cpp index 53d48853..8d26ae21 100644 --- a/source/wrappers/c++/treenode.cpp +++ b/source/wrappers/c++/treenode.cpp @@ -56,13 +56,13 @@ std::string uda::TreeNode::name() const uda::TreeNode uda::TreeNode::findStructureDefinition(const std::string& name) { - return {handle_, udaFindNTreeStructureDefinition(node_, (char *) name.c_str())}; + return {handle_, udaFindNTreeStructureDefinition(node_, (char*)name.c_str())}; } uda::TreeNode uda::TreeNode::findStructureComponent(const std::string& name) { LOGMALLOCLIST* logmalloclist = udaGetLogMallocList(handle_); - return {handle_, udaFindNTreeStructureComponent(logmalloclist, node_, (char *) name.c_str())}; + return {handle_, udaFindNTreeStructureComponent(logmalloclist, node_, (char*)name.c_str())}; } int uda::TreeNode::structureCount() @@ -183,7 +183,7 @@ uda::Scalar uda::TreeNode::atomicScalar(const std::string& target) { LOGMALLOCLIST* logmalloclist = udaGetLogMallocList(handle_); NTREE* node = - udaFindNTreeStructureComponent(logmalloclist, node_, (char *) target.c_str()); // Locate the named variable target + udaFindNTreeStructureComponent(logmalloclist, node_, (char*)target.c_str()); // Locate the named variable target // NTREE * node = udaFindNTreeStructureComponent(node_, target.c_str()); // Locate the named variable target if (node == nullptr) { return Scalar::Null; @@ -313,7 +313,7 @@ uda::Vector getStringVector(LOGMALLOCLIST* logmalloclist, NTREE* node, const std uda::Vector uda::TreeNode::atomicVector(const std::string& target) { LOGMALLOCLIST* logmalloclist = udaGetLogMallocList(handle_); - NTREE* node = udaFindNTreeStructureComponent(logmalloclist, node_, (char *) target.c_str()); + NTREE* node = udaFindNTreeStructureComponent(logmalloclist, node_, (char*)target.c_str()); // NTREE * node = udaFindNTreeStructureComponent(node_, (char *)target.c_str()); // Locate the named variable target if (node == nullptr) { return Vector::Null; @@ -339,8 +339,8 @@ uda::Vector uda::TreeNode::atomicVector(const std::string& target) if (std::string("STRING *") == atypes[i] && ((arank[i] == 0 && apoint[i] == 1) || (arank[i] == 1 && apoint[i] == 0))) { // String array in a single data structure - char** val = - reinterpret_cast(udaGetNodeStructureComponentData(logmalloclist, node, (char*)target.c_str())); + char** val = reinterpret_cast( + udaGetNodeStructureComponentData(logmalloclist, node, (char*)target.c_str())); return uda::Vector(val, (size_t)ashape[i][0]); } else if (arank[i] == 0 && apoint[i] == 1) { int count = udaGetNodeStructureComponentDataCount(logmalloclist, node, (char*)target.c_str()); @@ -428,7 +428,7 @@ static uda::Array getArray(LOGMALLOCLIST* logmalloclist, NTREE* node, const std: uda::Array uda::TreeNode::atomicArray(const std::string& target) { LOGMALLOCLIST* logmalloclist = udaGetLogMallocList(handle_); - NTREE* node = udaFindNTreeStructureComponent(logmalloclist, node_, (char *) target.c_str()); + NTREE* node = udaFindNTreeStructureComponent(logmalloclist, node_, (char*)target.c_str()); // NTREE * node = udaFindNTreeStructureComponent(node_, (char *)target.c_str()); // Locate the named variable target if (node == nullptr) { return Array::Null; @@ -484,7 +484,7 @@ uda::Array uda::TreeNode::atomicArray(const std::string& target) uda::StructData uda::TreeNode::structData(const std::string& target) { LOGMALLOCLIST* logmalloclist = udaGetLogMallocList(handle_); - NTREE* node = udaFindNTreeStructureComponent(logmalloclist, node_, (char *) target.c_str()); + NTREE* node = udaFindNTreeStructureComponent(logmalloclist, node_, (char*)target.c_str()); if (node == nullptr) { return StructData::Null; } diff --git a/source/wrappers/c++/utilities.h b/source/wrappers/c++/utilities.h index 99cb9a89..bddc7c6a 100644 --- a/source/wrappers/c++/utilities.h +++ b/source/wrappers/c++/utilities.h @@ -28,10 +28,10 @@ namespace UtilitiesNs \return Time-window average. */ SingleValueNs::SingleValue timeAverage(const SingleValueNs::SingleValue timeWindow, - const SingleValueNs::SingleValue timePoint, - const SingleValueNs::SingleValue index, - const blitz::Array& times, - const blitz::Array& values); + const SingleValueNs::SingleValue timePoint, + const SingleValueNs::SingleValue index, + const blitz::Array& times, + const blitz::Array& values); //! Assigns the value of an XML attribute to a SingleValueNs::SingleValue object. /*! @@ -41,7 +41,7 @@ SingleValueNs::SingleValue timeAverage(const SingleValueNs::SingleValue< \return If successful returns true, otherwise false */ bool getAttributeValue(const QDomElement& domElement, const std::string& attributeName, - SingleValueNs::SingleValue& attributeValue); + SingleValueNs::SingleValue& attributeValue); //! Assigns the value of an XML attribute to a SingleValueNs::SingleValue object. /*! @@ -51,7 +51,7 @@ bool getAttributeValue(const QDomElement& domElement, const std::string& attribu \return If successful returns true, otherwise false */ bool getAttributeValue(const QDomElement& domElement, const std::string& attributeName, - SingleValueNs::SingleValue& attributeValue); + SingleValueNs::SingleValue& attributeValue); //! Assigns the value of an XML attribute to a blitz::Array object. /*! @@ -65,7 +65,7 @@ bool getAttributeValue(const QDomElement& domElement, const std::string& attribu \return If successful returns true, otherwise false */ bool getAttributeValue(const QDomElement& domElement, const std::string& attributeName, - blitz::Array& attributeValue); + blitz::Array& attributeValue); //! Assigns the value of an XML attribute to a blitz::Array object. /*! @@ -79,7 +79,7 @@ bool getAttributeValue(const QDomElement& domElement, const std::string& attribu \return If successful returns true, otherwise false */ bool getAttributeValue(const QDomElement& domElement, const std::string& attributeName, - blitz::Array& attributeValue); + blitz::Array& attributeValue); //! Assigns the value of an XML attribute to a blitz::Array object. /*! @@ -93,7 +93,7 @@ bool getAttributeValue(const QDomElement& domElement, const std::string& attribu \return If successful returns true, otherwise false */ bool getAttributeValue(const QDomElement& domElement, const std::string& attributeName, - blitz::Array& attributeValue); + blitz::Array& attributeValue); //! Assigns the value of an XML attribute to a std::string object. /*! @@ -102,8 +102,7 @@ bool getAttributeValue(const QDomElement& domElement, const std::string& attribu \param AttributeValue The variable into which to place the contents of the XML attribute (if it hadn't been specified, then returns "notSet"). \return If the variable has been set returns true, otherwise false. */ -bool getAttributeValue(const QDomElement& domElement, const std::string& attributeName, - std::string& attributeValue); +bool getAttributeValue(const QDomElement& domElement, const std::string& attributeName, std::string& attributeValue); /*! \file utilities.h diff --git a/source/wrappers/java/idam_jni.h b/source/wrappers/java/idam_jni.h index 01a1b50b..90d6ee71 100644 --- a/source/wrappers/java/idam_jni.h +++ b/source/wrappers/java/idam_jni.h @@ -3,13 +3,13 @@ /* Header for class Idam */ #ifndef _Included_Idam -#define _Included_Idam +# define _Included_Idam -#include +# include -#ifdef __cplusplus +# ifdef __cplusplus extern "C" { -#endif +# endif /* * Class: Idam * Method: udaGetAPI @@ -416,8 +416,8 @@ JNIEXPORT jint JNICALL Java_Idam_sumArray1(JNIEnv*, jclass, jintArray); */ JNIEXPORT jint JNICALL Java_Idam_sumArray2(JNIEnv*, jclass, jintArray); -#ifdef __cplusplus +# ifdef __cplusplus } -#endif +# endif #endif