From 1b640dec8bc3f5d4b516dfa130500fe25fbce137 Mon Sep 17 00:00:00 2001 From: Gitea Date: Tue, 3 Apr 2018 00:49:44 +0200 Subject: [PATCH] Store command line arguments --- include/Parameters.hh | 36 +++++++++++++++++++++++++++++++++ src/Parameters.cc | 46 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 include/Parameters.hh create mode 100644 src/Parameters.cc diff --git a/include/Parameters.hh b/include/Parameters.hh new file mode 100644 index 0000000..cecabf6 --- /dev/null +++ b/include/Parameters.hh @@ -0,0 +1,36 @@ +// +// Parameters.hh +// medtech +// +// Created by Baranyai David on 2018. 04. 03.. +// + +#ifndef Parameters_hh +#define Parameters_hh + +#include + +class Parameters +{ +private: + /* Here will be the instance stored. */ + static Parameters* instance; + + /* Private constructor to prevent instancing. */ + Parameters(); + + int ParticleEnergy; + int pgundegree; + +public: + /* Static access method. */ + static Parameters* getInstance(); + + int GetParticleEnergy(); + int GetDegree(); + + void SetParticleEnergy(int); + void SetDegree(int); +}; + +#endif /* Parameters_hh */ diff --git a/src/Parameters.cc b/src/Parameters.cc new file mode 100644 index 0000000..d041e5d --- /dev/null +++ b/src/Parameters.cc @@ -0,0 +1,46 @@ +// +// Parameters.cc +// medtech +// +// Created by Baranyai David on 2018. 04. 03.. +// + +#include "Parameters.hh" + +Parameters* Parameters::getInstance() +{ + if (instance == 0) + { + instance = new Parameters(); + } + + return instance; +} + +Parameters::Parameters() : ParticleEnergy(6), pgundegree(90) +{ + +} + +/* Null, because instance will be initialized on demand. */ +Parameters* Parameters::instance = 0; + +int Parameters::GetParticleEnergy() +{ + return ParticleEnergy; +} + +int Parameters::GetDegree() +{ + return pgundegree; +} + +void Parameters::SetDegree(int d) +{ + pgundegree = d; +} + +void Parameters::SetParticleEnergy(int p) +{ + ParticleEnergy = p; +}