Comments (3)
I see, then we will need to introduce a python script at the validation pipeline, similar to validateProcesses.py
, or inside validateProcesses.py
that certifies that no any
statement appear at the process header.
from framework.
Another option would be to avoid using using namespace std;
at the headers? And then write directly std::any
when willing to use the c++17 standard one.
There are not many classes to modify in that case:
galan-gifna:source javi$ grep -rnw . -e "using namespace std" | grep .h:
./framework/tools/inc/TRestReflector.h:28:using namespace std;
./framework/tools/inc/TRestSystemOfUnits.h:20:using namespace std;
./framework/tools/inc/TRestDataBase.h:10:using namespace std;
./framework/tools/inc/TRestStringHelper.h:24:using namespace std;
./framework/tools/inc/TRestTools.h:31:using namespace std;
./framework/tools/inc/TRestPhysics.h:27:using namespace std;
./framework/tools/inc/TRestStringOutput.h:24:using namespace std;
./framework/core/inc/TRestTask.h:22:using namespace std;
./libraries/detector/inc/TRestDetectorGeometry.h:35:using namespace std;
./libraries/detector/inc/TRestDetector.h:35:using namespace std;
./libraries/geant4/inc/TRestGeant4ParticleCollectionDecay0.h:15:using namespace std;
./packages/restG4/include/SteppingAction.hh:15:using namespace std;
./packages/restG4/include/EventAction.hh:37:using namespace std;
./packages/restG4/include/RunAction.hh:44:using namespace std;
./packages/restG4/include/PrimaryGeneratorAction.hh:48:using namespace std;
./packages/restG4/include/PhysicsList.hh:44:using namespace std;
Perhaps then we can just have a validateCode.py
that checks if using namespace std;
is found at the headers files.
from framework.
any
was indeed referring to C++'s std any
.
Aside from that I would personally rather use something inherently safer than something like what we have here now, e.g. std::variant
(obv. not available since we do not target C++17 I suppose):
https://en.cppreference.com/w/cpp/utility/variant
The problem I see with the current approach is that it's inherently unsafe, unless one uses the GetValue
helper. But in practice that doesn't seem to be used, e.g. here:
https://github.com/rest-for-physics/framework/blob/master/source/framework/core/inc/TRestAnalysisTree.h#L118
If the user calls GetObservableValue<int>(…)
but the stored value is actually a float this produces garbage and there's no runtime checks for this. Personally I would remove the ability for direct access to the pointer in TRestReflector
and force the usage of GetValue
. There can be a more verbose and possiblye "dangerous" way, i.e. an unsafe_ptr
proc for the case where one really wants to avoid the if
check. But imo that shouldn't be necessary, because code that is performance critical should never use such objects anyway.
Naming wise I would choose something like RestValue
.
from framework.
Related Issues (20)
- Update the way cuts are introduced inside `TRestDataSet` so that we can use `TRestCut`.
- TRestDataSet does not read the date/time properly if time is not given.
- Bug when processing files with a single event
- Properly uninstalling the files from previous installation HOT 1
- Validating submodules with their corresponding branch HOT 1
- Cling errors when loading REST libraries in a restRoot session HOT 2
- Automatic PR at framework after submodule PR HOT 6
- GitHub Actions framework cache not working as expected
- Update CI Docker Image to official REST-for-Physics image
- Update CI Docker Image to official REST-for-Physics image
- MacOs installation issue, libraries should be placed at `bin`.
- MacOs installation issue. Libraries should be copied to bin. HOT 1
- White spaces produce problems in vectors inside RML file parameters
- Reporting a vulnerability
- Adding units to metadata filter conditions
- Visualisation problem HOT 2
- Libraries do not get uninstalled HOT 3
- Replace library version system. HOT 2
- Recovering event pointer when using `restRoot file.root` HOT 3
- restRoot metadata access does not autocomplete
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from framework.