30#include <boost/algorithm/string.hpp>
96 void _info(
const std::string&
str)
const;
99 bool _preCheck(
const YAML::Node& node,
unsigned allowed_type,
bool mattered =
true);
101 template <
typename T>
102 T
_as(
const YAML::Node& n,
bool mattered =
true);
104 std::string
_asStr(
const YAML::Node& n,
bool mattered =
true);
112 std::tuple<bool, std::string, std::string>
_setChannelGains(
const YAML::Node& n);
178 std::tuple<unsigned, unsigned, unsigned, unsigned, unsigned, unsigned>
_getSize(
const YAML::Node& n);
201 std::vector<std::tuple<std::string, std::any, bool>>
_constants;
212 if (std::is_same_v<T, int>) {
214 }
else if (std::is_same_v<T, double>) {
215 l =
_preCheck(n, DType::DOUBLE, mattered);
216 }
else if (std::is_same_v<T, std::string>) {
217 l =
_preCheck(n, DType::STRING, mattered);
218 }
else if (std::is_same_v<T, bool>) {
220 }
else if (std::is_same_v<T, char>) {
223 if (l)
return n.as<T>();
224 else if (mattered)
throw(
"Invalid!");
236 else return "Impossible branch in \"Export::_langStr()\"!";
240 if (
lang ==
Lang::CPP)
return "C++ (with Armadillo library)";
243 else if (
lang ==
Lang::PY)
return "Python (with NumPy library)";
245 else return "Impossible branch in \"Export::_langName()\"!";
253 else return "Impossible branch in \"Export::_langExtension()\"!";
261 else return "Impossible branch in \"Export::_langHeaderExtension()\"!";
268 else return "Impossible branch in \"Export::_langMmcesimExtension()\"!";
275 else return "Impossible branch in \"Export::_langCommentSymbol()\"!";
278inline void Export::_info(
const std::string&
str)
const { std::cout <<
"[mmCEsim] export $ " <<
str << std::endl; }
280inline std::string
Export::_asStr(
const YAML::Node& n,
bool mattered) {
return _as<std::string>(n, mattered); }
283 assert((!
_errors.empty() &&
"Check if errors are empty when trying to edit the last record."));
306 if (
auto&& num = n[
"test_num"];
_preCheck(num, DType::INT,
false)) {
307 return num.as<
unsigned>();
Algorithm Parser (.alg Language)
Graph Analysis for Complex Cascaded Channels.
Definition: channel_graph.h:22
std::string _noise
Definition: export.h:196
std::vector< int > _receivers
Definition: export.h:189
std::string _beamforming_F
Definition: export.h:197
bool _setDataParams()
Definition: export.cpp:1106
std::string _langName() const
Definition: export.h:239
Shared_Info *const _s_info
Definition: export.h:187
void _topComment()
Definition: export.cpp:249
struct Export::DataParams _data_params
void _info(const std::string &str) const
Definition: export.h:278
Export(CLI_Options &opt, Shared_Info *const info=nullptr)
Definition: export.cpp:30
std::string _beamforming_W
Definition: export.h:197
void _sounding()
Definition: export.cpp:446
std::string _langMmcesimExtension() const
Definition: export.h:264
std::vector< std::tuple< std::string, std::any, bool > > _constants
Definition: export.h:201
void _generateConstants()
Definition: export.cpp:398
bool _preCheck(const YAML::Node &node, unsigned allowed_type, bool mattered=true)
Definition: export.cpp:119
T _as(const YAML::Node &n, bool mattered=true)
Definition: export.h:210
std::string _received_signal
Definition: export.h:195
std::string _langExtension() const
Definition: export.h:248
std::tuple< unsigned, unsigned, unsigned, unsigned, unsigned, unsigned > _getSize(const YAML::Node &n)
Get the size of the node (Tx/Rx/RIS).
Definition: export.cpp:1224
void _setLang()
Definition: export.cpp:170
bool _already_error_before_export
Definition: export.h:185
Channel_Graph _channel_graph
Definition: export.h:200
std::ofstream & _wComment()
Definition: export.h:300
void _generateBF(unsigned Nt_B)
Generate RIS reflection matrices.
Definition: export.cpp:1154
void _beginning()
Definition: export.cpp:299
void _setLatestError(const std::string &str)
Definition: export.h:282
std::string _asStr(const YAML::Node &n, bool mattered=true)
Definition: export.h:280
std::vector< int > _transmitters
Definition: export.h:188
std::string _langStr() const
Definition: export.h:230
std::string _asVarName(const std::string &str) const
Definition: export.h:295
std::tuple< bool, std::string, std::string > _setChannelGains(const YAML::Node &n)
Definition: export.cpp:223
void _ending()
Definition: export.cpp:905
CLI_Options & _opt
Definition: export.h:182
std::string _langCommentSymbol() const
Definition: export.h:271
bool _loadALG()
Definition: export.cpp:909
std::vector< std::string > _beamforming_RIS
Definition: export.h:198
void _algorithms()
Definition: export.cpp:410
void _checkALGdependency(std::vector< std::string > &algs, bool logged=true)
Definition: export.cpp:1273
std::string _langHeaderExtension() const
Definition: export.h:256
std::map< std::string, std::string > _beamforming
Definition: export.h:199
const int _MAX_RX
Definition: export.h:204
NodeRole
Role of each node.
Definition: export.h:62
unsigned _getTestNum(const YAML::Node &n)
Definition: export.h:305
YAML::Node _config
Definition: export.h:183
std::ofstream & _f()
Definition: export.h:228
std::ofstream * _f_ptr
Definition: export.h:186
YAML_Errors _errors
Definition: export.h:184
DType
Definition: export.h:45
@ STRING
string
Definition: export.h:48
@ SEQ
sequence
Definition: export.h:51
@ INT
int
Definition: export.h:46
@ CHAR
map
Definition: export.h:50
@ BOOL
bool
Definition: export.h:49
@ NUL
null
Definition: export.h:53
@ DOUBLE
double
Definition: export.h:47
@ UNDEF
undefined
Definition: export.h:54
@ MAP
map
Definition: export.h:52
void _generateChannels()
Definition: export.cpp:308
bool _setCascadedChannel()
Definition: export.cpp:998
~Export()
Definition: export.cpp:82
void _estimation(const Macro ¯o, int job_cnt=-1)
Definition: export.cpp:681
std::string _cascaded_channel
Definition: export.h:194
const int _MAX_TX
Definition: export.h:203
bool _isKeyword(const std::string &str) const
Definition: export.h:287
Lang lang
Definition: export.h:206
bool _setVarNames()
Set the variable names defined by users.
Definition: export.cpp:1128
void _reporting()
Definition: export.cpp:708
YAML_Errors exportCode()
Definition: export.cpp:89
Storage of Command Line Options.
Error Codes (Including Warnings)
Keywords List for C++, MATLAB and Python.
static std::array PY_Keywords
Definition: keywords.h:92
static std::array CPP_Keywords
Definition: keywords.h:23
static std::array MATLAB_Keywords
Definition: keywords.h:80
Lang
Export language.
Definition: lang.h:20
@ PY
Python with NumPy library.
@ IPYNB
IPyNb with NumPy library.
@ CPP
C++ with Armadillo library.
str
Definition: version_bump.py:14
std::vector< YAML_Error > YAML_Errors
Definition: read.h:36
Shared Information Between 'Export' and 'Simulate'.
Command line options.
Definition: cli_options.h:22
unsigned max_test_num
Definition: export.h:191
unsigned max_noise_size
Definition: export.h:192
Definition: shared_info.h:17
Terminal Color and Style Control.
static bool contains(const T &container, const typename T::value_type value)
Definition: utils.h:133
Value Vector in .sim File.