Skip to content

Commit d00bb0e

Browse files
committed
Removing check on attribute characters
1 parent 32ca7e0 commit d00bb0e

File tree

18 files changed

+190
-63
lines changed

18 files changed

+190
-63
lines changed

CMake.in.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ SET(OFBUILD_CUSTOM_CMAKE_VERSION "${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.
2323
SET(OPENFLUID_VERSION_MAJOR 2)
2424
SET(OPENFLUID_VERSION_MINOR 2)
2525
SET(OPENFLUID_VERSION_PATCH 1)
26-
SET(OPENFLUID_VERSION_STATUS "alpha2") # example: SET(OPENFLUID_VERSION_STATUS "rc1")
26+
SET(OPENFLUID_VERSION_STATUS "alpha3") # example: SET(OPENFLUID_VERSION_STATUS "rc1")
2727

2828
SET(OPENFLUID_VERSION_FULL "${OPENFLUID_VERSION_MAJOR}.${OPENFLUID_VERSION_MINOR}.${OPENFLUID_VERSION_PATCH}")
2929

resources/tests/miscdata/SignatureSerializer/ref_sim.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,18 @@
9393
"description": "coefficient",
9494
"siunit": "",
9595
"type": ""
96+
},
97+
{
98+
"name": "coeff 2",
99+
"description": "coefficient with a space",
100+
"siunit": "",
101+
"type": ""
102+
},
103+
{
104+
"name": "coeff&3",
105+
"description": "coefficient with weïrd char",
106+
"siunit": "",
107+
"type": ""
96108
}
97109
]
98110
},

resources/tests/miscdata/SignatureSerializer/ref_sim_unordered.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,18 @@
9393
"description": "coefficient",
9494
"siunit": "",
9595
"type": ""
96+
},
97+
{
98+
"name": "coeff 2",
99+
"description": "coefficient with a space",
100+
"siunit": "",
101+
"type": ""
102+
},
103+
{
104+
"name": "coeff&3",
105+
"description": "coefficient with weïrd char",
106+
"siunit": "",
107+
"type": ""
96108
}
97109
]
98110
},

resources/tests/miscdata/SignatureSerializer/ref_sim_unordered_array.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,18 @@
9393
"description": "coefficient",
9494
"siunit": "",
9595
"type": ""
96+
},
97+
{
98+
"name": "coeff 2",
99+
"description": "coefficient with a space",
100+
"siunit": "",
101+
"type": ""
102+
},
103+
{
104+
"name": "coeff&3",
105+
"description": "coefficient with weïrd char",
106+
"siunit": "",
107+
"type": ""
96108
}
97109
]
98110
},

share/openfluid/waresdev/migration/include/201xx-202xx/SimulatorSignatureMacros.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
*/
119119
#define DECLARE_PRODUCED_VARIABLE(name,uclass,description,unit) \
120120
Signature->SimulatorHandledData.ProducedVars\
121-
.push_back(openfluid::ware::SignatureSpatialDataItem((name),uclass,description,unit));
121+
.push_back(openfluid::ware::SignatureVariableItem((name),uclass,description,unit));
122122

123123
/**
124124
@deprecated Since version 2.1.0. Use #DECLARE_PRODUCED_VARIABLE instead
@@ -130,7 +130,7 @@
130130
*/
131131
#define DECLARE_UPDATED_VARIABLE(name,uclass,description,unit) \
132132
Signature->SimulatorHandledData.UpdatedVars\
133-
.push_back(openfluid::ware::SignatureSpatialDataItem((name),uclass,description,unit));
133+
.push_back(openfluid::ware::SignatureVariableItem((name),uclass,description,unit));
134134

135135
/**
136136
@deprecated Since version 2.1.0. Use #DECLARE_UPDATED_VARIABLE instead

src/openfluid/machine/GeneratorSignature.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ GeneratorSignature::GeneratorSignature(openfluid::fluidx::GeneratorDescriptor::G
8888
{
8989
TypedVarName += "["+VarDimType+"]";
9090
}
91-
SimulatorHandledData.ProducedVars.push_back(openfluid::ware::SignatureSpatialDataItem(TypedVarName,
91+
SimulatorHandledData.ProducedVars.push_back(openfluid::ware::SignatureVariableItem(TypedVarName,
9292
VarPair.UnitsClass,"",""));
9393
}
9494
}

src/openfluid/machine/tests/Engine_TEST.cpp

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,15 @@
4545

4646
#include <boost/test/unit_test.hpp>
4747

48-
#include <openfluid/ware/PluggableSimulator.hpp>
48+
#include <openfluid/base/RunContextManager.hpp>
4949
#include <openfluid/machine/ModelInstance.hpp>
5050
#include <openfluid/machine/ModelItemInstance.hpp>
5151
#include <openfluid/machine/MonitoringInstance.hpp>
5252
#include <openfluid/machine/Engine.hpp>
5353
#include <openfluid/machine/SimulationBlob.hpp>
5454
#include <openfluid/machine/MachineListener.hpp>
55-
#include <openfluid/base/RunContextManager.hpp>
55+
#include <openfluid/ware/PluggableSimulator.hpp>
56+
#include <openfluid/tools/IDHelpers.hpp>
5657

5758
#include "tests-config.hpp"
5859

@@ -118,11 +119,11 @@ BOOST_AUTO_TEST_CASE(check_construction)
118119

119120
openfluid::machine::Engine Eng(SBlob,Model,Monitoring,MachineListen);
120121

121-
BOOST_CHECK_THROW(openfluid::ware::SignatureSpatialDataItem("var1[toto]","UA","",""),
122+
BOOST_CHECK_THROW(openfluid::ware::SignatureVariableItem("var1[toto]","UA","",""),
122123
openfluid::base::FrameworkException);
123-
BOOST_CHECK_THROW(openfluid::ware::SignatureSpatialDataItem("var1(double)","UA","",""),
124+
BOOST_CHECK_THROW(openfluid::ware::SignatureVariableItem("var1(double)","UA","",""),
124125
openfluid::base::FrameworkException);
125-
BOOST_CHECK_THROW(openfluid::ware::SignatureSpatialDataItem("var1[double","UA","",""),
126+
BOOST_CHECK_THROW(openfluid::ware::SignatureVariableItem("var1[double","UA","",""),
126127
openfluid::base::FrameworkException);
127128

128129
delete MachineListen;
@@ -159,8 +160,8 @@ BOOST_AUTO_TEST_CASE(check_pretests)
159160
openfluid::machine::WareContainer<openfluid::ware::SimulatorSignature> Cont1(openfluid::ware::WareType::SIMULATOR);
160161
auto Sign1 = new openfluid::ware::SimulatorSignature();
161162
Sign1->ID = "MySim1";
162-
Sign1->HandledData.RequiredVars.push_back(openfluid::ware::SignatureSpatialDataItem("var1","UA","",""));
163-
Sign1->SimulatorHandledData.UpdatedVars.push_back(openfluid::ware::SignatureSpatialDataItem("var5[]","UB","",""));
163+
Sign1->HandledData.RequiredVars.push_back(openfluid::ware::SignatureVariableItem("var1","UA","",""));
164+
Sign1->SimulatorHandledData.UpdatedVars.push_back(openfluid::ware::SignatureVariableItem("var5[]","UB","",""));
164165
Cont1.setSignature(Sign1);
165166
Cont1.validate();
166167

@@ -179,7 +180,7 @@ BOOST_AUTO_TEST_CASE(check_pretests)
179180
openfluid::machine::WareContainer<openfluid::ware::SimulatorSignature> Cont2(openfluid::ware::WareType::SIMULATOR);
180181
auto Sign2 = new openfluid::ware::SimulatorSignature();
181182
Sign2->ID = "MySim0";
182-
Sign2->SimulatorHandledData.ProducedVars.push_back(openfluid::ware::SignatureSpatialDataItem("var1","UA","",""));
183+
Sign2->SimulatorHandledData.ProducedVars.push_back(openfluid::ware::SignatureVariableItem("var1","UA","",""));
183184
Cont2.setSignature(Sign2);
184185
Cont2.validate();
185186

@@ -198,7 +199,7 @@ BOOST_AUTO_TEST_CASE(check_pretests)
198199
openfluid::machine::WareContainer<openfluid::ware::SimulatorSignature> Cont3(openfluid::ware::WareType::SIMULATOR);
199200
auto Sign3 = new openfluid::ware::SimulatorSignature();
200201
Sign3->ID = "MySim2";
201-
Sign3->HandledData.RequiredVars.push_back(openfluid::ware::SignatureSpatialDataItem("var5[]","UB","",""));
202+
Sign3->HandledData.RequiredVars.push_back(openfluid::ware::SignatureVariableItem("var5[]","UB","",""));
202203
Cont3.setSignature(Sign3);
203204
Cont3.validate();
204205

@@ -217,7 +218,7 @@ BOOST_AUTO_TEST_CASE(check_pretests)
217218
openfluid::machine::WareContainer<openfluid::ware::SimulatorSignature> Cont4(openfluid::ware::WareType::SIMULATOR);
218219
auto Sign4 = new openfluid::ware::SimulatorSignature();
219220
Sign4->ID = "MySim0.5";
220-
Sign4->HandledData.RequiredVars.push_back(openfluid::ware::SignatureSpatialDataItem("var1","UA","",""));
221+
Sign4->HandledData.RequiredVars.push_back(openfluid::ware::SignatureVariableItem("var1","UA","",""));
221222
Cont4.setSignature(Sign4);
222223
Cont4.validate();
223224

@@ -254,8 +255,8 @@ BOOST_AUTO_TEST_CASE(check_pretests)
254255
openfluid::machine::WareContainer<openfluid::ware::SimulatorSignature> Cont6(openfluid::ware::WareType::SIMULATOR);
255256
auto Sign6 = new openfluid::ware::SimulatorSignature();
256257
Sign6->ID = "MySim4";
257-
Sign6->HandledData.RequiredVars.push_back(openfluid::ware::SignatureSpatialDataItem("var1","UA","",""));
258-
Sign6->SimulatorHandledData.ProducedVars.push_back(openfluid::ware::SignatureSpatialDataItem("var7","UC","",""));
258+
Sign6->HandledData.RequiredVars.push_back(openfluid::ware::SignatureVariableItem("var1","UA","",""));
259+
Sign6->SimulatorHandledData.ProducedVars.push_back(openfluid::ware::SignatureVariableItem("var7","UC","",""));
259260
Cont6.setSignature(Sign6);
260261
Cont6.validate();
261262

@@ -306,9 +307,9 @@ BOOST_AUTO_TEST_CASE(check_typed_pretests)
306307
auto Sign1 = new openfluid::ware::SimulatorSignature();
307308
Sign1->ID = "MySim1";
308309
Sign1->HandledData.RequiredVars.push_back(
309-
openfluid::ware::SignatureSpatialDataItem("var1[double]","UA","",""));
310+
openfluid::ware::SignatureVariableItem("var1[double]","UA","",""));
310311
Sign1->SimulatorHandledData.UpdatedVars.push_back(
311-
openfluid::ware::SignatureSpatialDataItem("var5[vector]","UB","",""));
312+
openfluid::ware::SignatureVariableItem("var5[vector]","UB","",""));
312313
Cont1.setSignature(Sign1);
313314
Cont1.validate();
314315

@@ -328,7 +329,7 @@ BOOST_AUTO_TEST_CASE(check_typed_pretests)
328329
auto Sign2 = new openfluid::ware::SimulatorSignature();
329330
Sign2->ID = "MySim0";
330331
Sign2->SimulatorHandledData.ProducedVars.push_back(
331-
openfluid::ware::SignatureSpatialDataItem("var1[double]","UA","",""));
332+
openfluid::ware::SignatureVariableItem("var1[double]","UA","",""));
332333
Cont2.setSignature(Sign2);
333334
Cont2.validate();
334335

@@ -348,7 +349,7 @@ BOOST_AUTO_TEST_CASE(check_typed_pretests)
348349
auto Sign3 = new openfluid::ware::SimulatorSignature();
349350
Sign3->ID = "MySim2";
350351
Sign3->HandledData.RequiredVars.push_back(
351-
openfluid::ware::SignatureSpatialDataItem("var5[vector]","UB","",""));
352+
openfluid::ware::SignatureVariableItem("var5[vector]","UB","",""));
352353
Cont3.setSignature(Sign3);
353354
Cont3.validate();
354355

@@ -367,7 +368,7 @@ BOOST_AUTO_TEST_CASE(check_typed_pretests)
367368
openfluid::machine::WareContainer<openfluid::ware::SimulatorSignature> Cont4(openfluid::ware::WareType::SIMULATOR);
368369
auto Sign4 = new openfluid::ware::SimulatorSignature();
369370
Sign4->ID = "MySim0.5";
370-
Sign4->HandledData.RequiredVars.push_back(openfluid::ware::SignatureSpatialDataItem("var1","UA","",""));
371+
Sign4->HandledData.RequiredVars.push_back(openfluid::ware::SignatureVariableItem("var1","UA","",""));
371372
Cont4.setSignature(Sign4);
372373
Cont4.validate();
373374

@@ -404,8 +405,8 @@ BOOST_AUTO_TEST_CASE(check_typed_pretests)
404405
openfluid::machine::WareContainer<openfluid::ware::SimulatorSignature> Cont6(openfluid::ware::WareType::SIMULATOR);
405406
auto Sign6 = new openfluid::ware::SimulatorSignature();
406407
Sign6->ID = "MySim0.5";
407-
Sign6->HandledData.RequiredVars.push_back(openfluid::ware::SignatureSpatialDataItem("var1","UA","",""));
408-
Sign6->SimulatorHandledData.ProducedVars.push_back(openfluid::ware::SignatureSpatialDataItem("var7","UC","",""));
408+
Sign6->HandledData.RequiredVars.push_back(openfluid::ware::SignatureVariableItem("var1","UA","",""));
409+
Sign6->SimulatorHandledData.ProducedVars.push_back(openfluid::ware::SignatureVariableItem("var7","UC","",""));
409410
Cont6.setSignature(Sign6);
410411
Cont6.validate();
411412

src/openfluid/tools/IDHelpers.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,16 @@ std::string classIDToString(const openfluid::core::UnitsClass_t& Class, openflui
5858
// =====================================================================
5959

6060

61+
bool isNonEmpty(const std::string& Str)
62+
{
63+
return Str.length() > 0;
64+
}
65+
66+
67+
// =====================================================================
68+
// =====================================================================
69+
70+
6171
bool isValidAlphaNumName(const std::string& Name)
6272
{
6373
// authorized chars: a to z, A to Z, 0 to 9

src/openfluid/tools/IDHelpers.hpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
#include <string>
4848

4949
#include <openfluid/core/TypeDefs.hpp>
50-
#include <openfluid/ware/WareSignature.hpp>
50+
//#include <openfluid/ware/WareSignature.hpp>
51+
#include <openfluid/ware/TypeDefs.hpp>
5152
#include <openfluid/dllexport.hpp>
5253
#include <openfluid/tools/VarHelpers.hpp>
5354

@@ -86,6 +87,14 @@ constexpr auto UnitsClassNameRuleString("^[^;:#]+$");
8687
std::string OPENFLUID_API classIDToString(const openfluid::core::UnitsClass_t& Class, openfluid::core::UnitID_t ID);
8788

8889

90+
/**
91+
Checks whether a string is empty
92+
@param[in] Str the string to check
93+
@return true if the string is not empty
94+
*/
95+
bool OPENFLUID_API isNonEmpty(const std::string& Str);
96+
97+
8998
/**
9099
Checks whether an alphanumeric name is valid or not.\n
91100
To be valid, a name must only contain alphanumeric characters.

src/openfluid/ware/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
SET(OPENFLUID_WARE_CPP WareIssues.cpp SimulatorSignature.cpp
2+
SET(OPENFLUID_WARE_CPP WareIssues.cpp WareSignature.cpp
33
PluggableWare.cpp SimulationDrivenWare.cpp SimulationInspectorWare.cpp SimulationContributorWare.cpp
44
PluggableSimulator.cpp PluggableObserver.cpp
55
WareParamsTree.cpp

0 commit comments

Comments
 (0)