Skip to content

Commit 9d6c9b9

Browse files
committed
Fix for attribute filtering on windows
1 parent 3219d9f commit 9d6c9b9

File tree

7 files changed

+91
-46
lines changed

7 files changed

+91
-46
lines changed

src/openfluid/tools/IDHelpers.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,6 @@ 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-
7161
bool isValidAlphaNumName(const std::string& Name)
7262
{
7363
// authorized chars: a to z, A to Z, 0 to 9

src/openfluid/tools/IDHelpers.hpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,14 +86,6 @@ constexpr auto UnitsClassNameRuleString("^[^;:#]+$");
8686
std::string OPENFLUID_API classIDToString(const openfluid::core::UnitsClass_t& Class, openfluid::core::UnitID_t ID);
8787

8888

89-
/**
90-
Checks whether a string is empty
91-
@param[in] Str the string to check
92-
@return true if the string is not empty
93-
*/
94-
bool OPENFLUID_API isNonEmpty(const std::string& Str);
95-
96-
9789
/**
9890
Checks whether an alphanumeric name is valid or not.\n
9991
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
@@ -9,7 +9,7 @@ SET(OPENFLUID_WARE_CPP WareIssues.cpp WareSignature.cpp
99
SET(OPENFLUID_WARE_HPP WareIssues.hpp WareSignature.hpp SimulatorSignature.hpp ObserverSignature.hpp
1010
PluggableWare.hpp SimulationDrivenWare.hpp SimulationInspectorWare.hpp SimulationContributorWare.hpp
1111
PluggableSimulator.hpp PluggableObserver.hpp
12-
TypeDefs.hpp
12+
TypeDefs.hpp DataItemUtils.hpp
1313
LoopMacros.hpp ThreadedLoopMacros.hpp
1414
WareException.hpp
1515
WareRNG.hpp
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*
2+
3+
This file is part of OpenFLUID software
4+
Copyright(c) 2007, INRA - Montpellier SupAgro
5+
6+
7+
== GNU General Public License Usage ==
8+
9+
OpenFLUID is free software: you can redistribute it and/or modify
10+
it under the terms of the GNU General Public License as published by
11+
the Free Software Foundation, either version 3 of the License, or
12+
(at your option) any later version.
13+
14+
OpenFLUID is distributed in the hope that it will be useful,
15+
but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
GNU General Public License for more details.
18+
19+
You should have received a copy of the GNU General Public License
20+
along with OpenFLUID. If not, see <http://www.gnu.org/licenses/>.
21+
22+
23+
== Other Usage ==
24+
25+
Other Usage means a use of OpenFLUID that is inconsistent with the GPL
26+
license, and requires a written agreement between You and INRA.
27+
Licensees for Other Usage of OpenFLUID may use this file in accordance
28+
with the terms contained in the written agreement between You and INRA.
29+
30+
*/
31+
32+
33+
/**
34+
@file DataItemUtils.hpp
35+
36+
@author Armel THÖNI <armel.thoni@inrae.fr>
37+
*/
38+
39+
#pragma once
40+
41+
42+
#include <string>
43+
44+
#include <openfluid/dllexport.hpp>
45+
46+
47+
namespace openfluid { namespace ware {
48+
49+
// contains minimal functions used by signature data item constructors
50+
51+
52+
/**
53+
Transmits a given variable name to container without changing type
54+
@param[in] VO the string to use
55+
@param[in] V the string to populate
56+
@param[in] T the type to change (ignored)
57+
@return true always
58+
*/
59+
inline bool OPENFLUID_API identityExtractor(const std::string& VO, std::string& V, openfluid::core::Value::Type& /*T*/)
60+
{
61+
V = VO;
62+
return true;
63+
}
64+
65+
66+
// =====================================================================
67+
// =====================================================================
68+
69+
70+
/**
71+
Checks whether a string is empty
72+
@param[in] Str the string to check
73+
@return true if the string is not empty
74+
*/
75+
inline bool OPENFLUID_API isNonEmpty(const std::string& Str)
76+
{
77+
return Str.length() > 0;
78+
}
79+
80+
81+
} } // namespaces

src/openfluid/ware/WareSignature.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@
4242
#include <openfluid/config.hpp>
4343
#include <openfluid/ware/TypeDefs.hpp>
4444
#include <openfluid/ware/WareIssues.hpp>
45-
#include <openfluid/tools/MiscHelpers.hpp>
46-
#include <openfluid/tools/StringHelpers.hpp>
4745
#include <openfluid/ware/WareSignature.hpp>
4846

4947

src/openfluid/ware/WareSignature.hpp

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#include <openfluid/dllexport.hpp>
4141
#include <openfluid/config.hpp>
4242
#include <openfluid/ware/TypeDefs.hpp>
43+
#include <openfluid/ware/DataItemUtils.hpp>
4344
#include <openfluid/ware/WareIssues.hpp>
4445
#include <openfluid/tools/MiscHelpers.hpp>
4546
#include <openfluid/tools/IDHelpers.hpp>
@@ -227,24 +228,6 @@ class OPENFLUID_API WareSignature
227228
// =====================================================================
228229

229230

230-
/**
231-
Transmits a given variable name to container without changing type
232-
@param[in] VO the string to use
233-
@param[in] V the string to populate
234-
@param[in] T the type to change (ignored)
235-
@return true always
236-
*/
237-
static bool identityExtractor(const std::string& VO, std::string& V, openfluid::core::Value::Type& /*T*/)
238-
{
239-
V = VO;
240-
return true;
241-
}
242-
243-
244-
// =====================================================================
245-
// =====================================================================
246-
247-
248231
/**
249232
Class for storage of the definition of data handled by the simulator.
250233
*/
@@ -262,10 +245,10 @@ class OPENFLUID_API SignatureDataItem
262245

263246
SignatureDataItem(const std::string& N, const std::string& D, const std::string& SI,
264247
std::function<bool(const std::string&,std::string&,
265-
openfluid::core::Value::Type&)> Extractor=identityExtractor);
248+
openfluid::core::Value::Type&)> Extractor=openfluid::ware::identityExtractor);
266249

267250
SignatureDataItem(const std::string& N, const std::string& D, const std::string& SI,
268-
openfluid::core::Value::Type T, std::function<bool(const std::string&)> Validator=openfluid::tools::isNonEmpty);
251+
openfluid::core::Value::Type T, std::function<bool(const std::string&)> Validator=openfluid::ware::isNonEmpty);
269252
};
270253

271254

@@ -288,13 +271,13 @@ class OPENFLUID_API SignatureSpatialDataItem : public SignatureDataItem
288271
SignatureSpatialDataItem(const std::string& N, const openfluid::core::UnitsClass_t& U,
289272
const std::string& D, const std::string& SI,
290273
std::function<bool(const std::string&,std::string&,
291-
openfluid::core::Value::Type&)> Extractor=identityExtractor):
274+
openfluid::core::Value::Type&)> Extractor=openfluid::ware::identityExtractor):
292275
SignatureDataItem(N,D,SI,Extractor),UnitsClass(U)
293276
{ }
294277

295278
SignatureSpatialDataItem(const std::string& N, const openfluid::core::UnitsClass_t& U,
296279
const std::string& D, const std::string& SI, openfluid::core::Value::Type T,
297-
std::function<bool(const std::string&)> Validator=openfluid::tools::isNonEmpty):
280+
std::function<bool(const std::string&)> Validator=openfluid::ware::isNonEmpty):
298281
SignatureDataItem(N,D,SI,T,Validator),UnitsClass(U)
299282
{ }
300283
};

src/openfluid/waresdev/WareCppWriterHelpers.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
#include <openfluid/dllexport.hpp>
4949
#include <openfluid/tools/IDHelpers.hpp>
5050
#include <openfluid/ware/TypeDefs.hpp>
51+
#include <openfluid/ware/DataItemUtils.hpp>
5152
#include <openfluid/ware/WareSignature.hpp>
5253
#include <openfluid/waresdev/WareSignatureSerializer.hpp>
5354

@@ -333,7 +334,7 @@ struct DataJsonConverter
333334
{
334335

335336
static openfluid::ware::SignatureDataItem readDataItemFromJSON(const openfluid::thirdparty::json& Item,
336-
std::function<bool(const std::string&)> Validator=openfluid::tools::isNonEmpty)
337+
std::function<bool(const std::string&)> Validator=openfluid::ware::isNonEmpty)
337338
{
338339
openfluid::ware::SignatureDataItem Data;
339340

@@ -553,7 +554,7 @@ struct DataJsonConverter
553554

554555

555556
static openfluid::ware::SignatureSpatialDataItem readSpatialDataItemFromJSON(const openfluid::thirdparty::json& Item,
556-
std::function<bool(const std::string&)> Validator=openfluid::tools::isNonEmpty)
557+
std::function<bool(const std::string&)> Validator=openfluid::ware::isNonEmpty)
557558
{
558559
openfluid::ware::SignatureSpatialDataItem Data;
559560

@@ -590,7 +591,7 @@ struct DataJsonConverter
590591

591592
static std::vector<openfluid::ware::SignatureSpatialDataItem>
592593
readSpatialDataListFromJSON(const openfluid::thirdparty::json& Json,
593-
std::function<bool(const std::string&)> Validator=openfluid::tools::isNonEmpty)
594+
std::function<bool(const std::string&)> Validator=openfluid::ware::isNonEmpty)
594595
{
595596
std::vector<openfluid::ware::SignatureSpatialDataItem> List;
596597

0 commit comments

Comments
 (0)