Skip to content

Commit c4b607b

Browse files
committed
Working on updating plugin tests.
1 parent 65b3680 commit c4b607b

37 files changed

+2135
-2413
lines changed

cmake/CaseConvertors.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
function( snake_to_proper_case input out_var )
2+
string( REPLACE "_" ";" tokens "${input}" )
3+
set( ${out_var} "" )
4+
foreach( token ${tokens} )
5+
string( SUBSTRING ${token} 0 1 first_char )
6+
string( SUBSTRING ${token} 1 -1 remainder )
7+
string( TOUPPER ${first_char} upper_first_char )
8+
string( TOLOWER ${remainder} lower_remainder )
9+
set( new_token "${upper_first_char}${lower_remainder}" )
10+
string( APPEND ${out_var} ${new_token} )
11+
endforeach( )
12+
return( PROPAGATE ${out_var} )
13+
endfunction( snake_to_proper_case )

cmake/udaPlugins.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ macro( uda_plugin )
4848
set( LIBRARIES ${LIBRARIES} ${FILTERED_LINK_LIBS} )
4949

5050
target_link_libraries( ${PLUGIN_LIBNAME} PRIVATE ${LIBRARIES} )
51+
target_include_directories( ${PLUGIN_LIBNAME} PRIVATE ${PLUGIN_EXTRA_INCLUDE_DIRS} )
5152

5253
install(
5354
TARGETS ${PLUGIN_LIBNAME}

include/uda/.clang-tidy

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
Checks: 'bugprone*,readability*,cppcoreguidelines*,modernize*,-modernize-use-trailing-return-type,-cppcoreguidelines-avoid-const-or-ref-data-members'
3+
CheckOptions:
4+
- { key: readability-identifier-naming.NamespaceCase, value: lower_case }
5+
- { key: readability-identifier-naming.ClassCase, value: CamelCase }
6+
- { key: readability-identifier-naming.PrivateMemberPrefix, value: _ }
7+
- { key: readability-identifier-naming.StructCase, value: CamelCase }
8+
- { key: readability-identifier-naming.FunctionCase, value: camelBack }
9+
- { key: readability-identifier-naming.VariableCase, value: lower_case }
10+
- { key: readability-identifier-naming.GlobalConstantCase, value: CamelCase }
11+
- { key: readability-identifier-naming.GlobalConstantPrefix, value: g_ }
12+
- { key: readability-identifier-naming.MacroDefinitionCase, value: UPPER_CASE }
13+
- { key: readability-identifier-length.IgnoredVariableNames, value: '^[ijk]$' }
14+
WarningsAsErrors: '-*'
15+
HeaderFilterRegex: '*.h'
16+
FormatStyle: llvm

include/uda/client.h

Lines changed: 13 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ extern "C" {
2727
# define udaGetBatchAPIWithHost udaGetBatchAPIWithHostFat
2828
#endif
2929

30+
LIBRARY_API void udaLoadConfig(const char* config_name);
31+
3032
LIBRARY_API int udaGetAPI(const char* data_object, const char* data_source);
3133

3234
LIBRARY_API int udaGetBatchAPI(const char** uda_signals, const char** sources, int count, int* handles);
@@ -108,12 +110,10 @@ LIBRARY_API void udaFreePutDataBlock(PUTDATA_BLOCK*);
108110

109111
LIBRARY_API LOGMALLOCLIST* udaGetLogMallocList(int handle);
110112

111-
LIBRARY_API USERDEFINEDTYPE* udaGetUserDefinedType(const int handle);
113+
LIBRARY_API USERDEFINEDTYPE* udaGetUserDefinedType(int handle);
112114

113115
LIBRARY_API USERDEFINEDTYPELIST* udaGetUserDefinedTypeList(int handle);
114116

115-
#define UDA_NUM_CLIENT_THREADS 30
116-
117117
LIBRARY_API void udaSetPrivateFlag(unsigned int flag);
118118

119119
LIBRARY_API void udaResetPrivateFlag(unsigned int flag);
@@ -148,8 +148,6 @@ LIBRARY_API void udaPutServerHost(const char* host);
148148

149149
LIBRARY_API void udaPutServerPort(int port);
150150

151-
LIBRARY_API int udaGetErrorCode(int handle);
152-
153151
LIBRARY_API const char* udaGetErrorMsg(int handle);
154152

155153
LIBRARY_API int udaGetSourceStatus(int handle);
@@ -188,8 +186,6 @@ LIBRARY_API int udaGetDataTypeId(const char* type);
188186

189187
LIBRARY_API int udaGetDataTypeSize(int type);
190188

191-
LIBRARY_API void udaGetErrorModel(int handle, int* model, int* param_n, float* params);
192-
193189
LIBRARY_API int udaGetErrorAsymmetry(int handle);
194190

195191
LIBRARY_API int udaGetErrorModelId(const char* model);
@@ -202,8 +198,6 @@ LIBRARY_API void udaSetSyntheticData(int handle, char* data);
202198

203199
LIBRARY_API void udaSetSyntheticDimData(int handle, int n_dim, char* data);
204200

205-
LIBRARY_API char* udaGetSyntheticData(int handle);
206-
207201
LIBRARY_API char* udaGetData(int handle);
208202

209203
LIBRARY_API char* udaGetDataErrLo(int handle);
@@ -234,15 +228,15 @@ LIBRARY_API char* udaGetAsymmetricError(int handle, bool above);
234228

235229
LIBRARY_API char* udaGetError(int handle);
236230

237-
LIBRARY_API void udaGetDoubleData(int handle, double* fp);
231+
LIBRARY_API void udaGetDoubleData(int handle, double* data);
238232

239-
LIBRARY_API void udaGetFloatData(int handle, float* fp);
233+
LIBRARY_API void udaGetFloatData(int handle, float* data);
240234

241235
LIBRARY_API void udaGetGenericData(int handle, void* data);
242236

243-
LIBRARY_API void udaGetFloatAsymmetricError(int handle, bool above, float* fp);
237+
LIBRARY_API void udaGetFloatAsymmetricError(int handle, bool above, float* data);
244238

245-
LIBRARY_API void udaGetFloatError(int handle, float* fp);
239+
LIBRARY_API void udaGetFloatError(int handle, float* data);
246240

247241
LIBRARY_API const char* udaGetDataLabel(int handle);
248242

@@ -266,8 +260,6 @@ LIBRARY_API int udaGetDimErrorAsymmetry(int handle, int n_dim);
266260

267261
LIBRARY_API void udaGetDimErrorModel(int handle, int n_dim, int* model, int* param_n, float* params);
268262

269-
LIBRARY_API char* udaGetSyntheticDimData(int handle, int n_dim);
270-
271263
LIBRARY_API char* udaGetDimData(int handle, int n_dim);
272264

273265
LIBRARY_API const char* udaGetDimLabel(int handle, int n_dim);
@@ -278,39 +270,29 @@ LIBRARY_API void udaGetDimLabelTdi(int handle, int n_dim, char* label);
278270

279271
LIBRARY_API void udaGetDimUnitsTdi(int handle, int n_dim, char* units);
280272

281-
LIBRARY_API void udaGetDoubleDimData(int handle, int n_dim, double* fp);
273+
LIBRARY_API void udaGetDoubleDimData(int handle, int n_dim, double* data);
282274

283-
LIBRARY_API void udaGetFloatDimData(int handle, int n_dim, float* fp);
275+
LIBRARY_API void udaGetFloatDimData(int handle, int n_dim, float* data);
284276

285277
LIBRARY_API void udaGetGenericDimData(int handle, int n_dim, void* data);
286278

287279
LIBRARY_API char* udaGetDimAsymmetricError(int handle, int n_dim, bool above);
288280

289281
LIBRARY_API char* udaGetDimError(int handle, int n_dim);
290282

291-
LIBRARY_API void udaGetFloatDimAsymmetricError(int handle, int n_dim, bool above, float* fp);
283+
LIBRARY_API void udaGetFloatDimAsymmetricError(int handle, int n_dim, bool above, float* data);
292284

293-
LIBRARY_API void udaGetFloatDimError(int handle, int n_dim, float* fp);
285+
LIBRARY_API void udaGetFloatDimError(int handle, int n_dim, float* data);
294286

295287
LIBRARY_API int udaDataCheckSum(const char* data, int data_n, int type);
296288

297289
LIBRARY_API int udaGetDataCheckSum(int handle);
298290

299291
LIBRARY_API int udaGetDimDataCheckSum(int handle, int n_dim);
300292

301-
LIBRARY_API int udaGetThreadLastHandle();
302-
303-
LIBRARY_API void udaPutThreadLastHandle(int handle);
304-
305-
LIBRARY_API void udaLockThread();
306-
307-
LIBRARY_API void udaUnlockThread();
308-
309-
LIBRARY_API int udaGetMaxThreadCount();
310-
311-
LIBRARY_API int udaSetDataTree(const int handle);
293+
LIBRARY_API int udaSetDataTree(int handle);
312294

313-
LIBRARY_API NTREE* udaGetDataTree(const int handle);
295+
LIBRARY_API NTREE* udaGetDataTree(int handle);
314296

315297
#ifdef __cplusplus
316298
}

source/bin/uda_cli.cpp

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -388,17 +388,17 @@ int main(int argc, const char** argv)
388388
po::positional_options_description p;
389389
p.add("request", 1);
390390

391-
po::variables_map vm;
391+
po::variables_map var_map;
392392
try {
393-
po::store(po::command_line_parser(argc, argv).options(desc).positional(p).run(), vm);
394-
po::notify(vm);
393+
po::store(po::command_line_parser(argc, argv).options(desc).positional(p).run(), var_map);
394+
po::notify(var_map);
395395

396-
conflicting_options(vm, "ping", "request");
397-
if (!vm["ping"].as<bool>() && vm.count("request") == 0) {
396+
conflicting_options(var_map, "ping", "request");
397+
if (!var_map["ping"].as<bool>() && var_map.count("request") == 0) {
398398
throw po::error("either 'ping' or 'request' must be provided");
399399
}
400400
} catch (po::error& err) {
401-
if (vm["help"].as<bool>()) {
401+
if (var_map["help"].as<bool>()) {
402402
std::cout << "Usage: " << argv[0] << " [options] request\n";
403403
std::cout << desc << "\n";
404404
return 1;
@@ -410,42 +410,42 @@ int main(int argc, const char** argv)
410410
}
411411
};
412412

413-
if (vm["help"].as<bool>()) {
413+
if (var_map["help"].as<bool>()) {
414414
std::cout << "Usage: " << argv[0] << " [options] request\n";
415415
std::cout << desc << "\n";
416416
return 1;
417417
}
418418

419-
if (vm.count("host")) {
420-
uda::Client::setServerHostName(vm["host"].as<std::string>());
419+
if (var_map.count("host") != 0) {
420+
uda::Client::setServerHostName(var_map["host"].as<std::string>());
421421
}
422422

423-
if (vm.count("port")) {
424-
uda::Client::setServerPort(static_cast<int>(vm["port"].as<int>()));
423+
if (var_map.count("port") != 0) {
424+
uda::Client::setServerPort(var_map["port"].as<int>());
425425
}
426426

427427
std::string request;
428-
if (vm["ping"].as<bool>()) {
428+
if (var_map["ping"].as<bool>()) {
429429
request = "HELP::ping()";
430430
} else {
431-
request = vm["request"].as<std::string>();
431+
request = var_map["request"].as<std::string>();
432432
}
433433

434434
if (request == "-") {
435-
std::stringstream ss;
435+
std::stringstream stream;
436436
std::string line;
437437
while (std::getline(std::cin, line)) {
438-
ss << line;
438+
stream << line;
439439
}
440-
request = ss.str();
440+
request = stream.str();
441441
}
442442
std::cout << "request: " << request << "\n";
443443

444-
std::string source = vm["source"].as<std::string>();
444+
std::string source = var_map["source"].as<std::string>();
445445

446446
uda::Client client;
447447
try {
448-
auto& res = client.get(request, source);
448+
const auto& res = client.get(request, source);
449449

450450
if (res.isTree()) {
451451
print_tree(res.tree(), "");

0 commit comments

Comments
 (0)