mmCEsim 0.3.0
mmWave Channel Estimation Simulation
calc.h
Go to the documentation of this file.
1
12#ifndef _EXPORT_CALC_H_
13#define _EXPORT_CALC_H_
14
15#include "_boost_config.h"
17#include "log_global.h"
18#include "utils.h"
19#include <boost/algorithm/string/replace.hpp>
20#include <string>
21#include <tuple>
22
23class Calc {
24 public:
25 Calc(const std::string& str);
26
34 std::string as(std::string lang, std::string* msg = nullptr) const;
35
36 static std::string as(const std::string& str, std::string lang, std::string* msg = nullptr);
37
38 private:
39 bool _changeOperator(std::string& str, std::string lang, std::string* msg = nullptr) const;
40
41 bool _changeFunction(std::string& str, std::string lang, std::string* msg = nullptr) const;
42
43 bool _changeSuperScript(std::string& str, std::string lang, std::string* msg = nullptr) const;
44
45 bool _changeSubScript(std::string& str, std::string lang, int8_t* d = nullptr, std::string* msg = nullptr) const;
46
47 bool _changeParen(std::string& str, std::string lang, std::string* msg = nullptr) const;
48
49 void _msg(std::string* msg, const std::string& content) const;
50
51 void _addArma(std::string& str, const std::string& func) const;
52
53 void _addMmce(std::string& str, const std::string& func) const;
54
55 std::string _str;
56};
57
58inline std::string Calc::as(const std::string& str, std::string lang, std::string* msg) {
59 Calc calc(str);
60 return calc.as(lang);
61}
62
63inline void Calc::_msg(std::string* msg, const std::string& content) const {
64 if (msg) *msg = content;
65}
66
67inline void Calc::_addArma(std::string& str, const std::string& func) const {
68 boost::replace_all(str, std::string("\\") + func, "arma::" + func);
69}
70
71inline void Calc::_addMmce(std::string& str, const std::string& func) const {
72 boost::replace_all(str, std::string("\\") + func, "mmce::" + func);
73}
74
75#endif
Boost Configurations.
Definition: calc.h:23
bool _changeSuperScript(std::string &str, std::string lang, std::string *msg=nullptr) const
Definition: calc.cpp:133
void _msg(std::string *msg, const std::string &content) const
Definition: calc.h:63
Calc(const std::string &str)
Definition: calc.cpp:18
std::string _str
Definition: calc.h:55
void _addArma(std::string &str, const std::string &func) const
Definition: calc.h:67
bool _changeSubScript(std::string &str, std::string lang, int8_t *d=nullptr, std::string *msg=nullptr) const
Definition: calc.cpp:172
std::string as(std::string lang, std::string *msg=nullptr) const
Convert the Alg CALC contents into a language command.
Definition: calc.cpp:20
bool _changeParen(std::string &str, std::string lang, std::string *msg=nullptr) const
Definition: calc.cpp:351
bool _changeOperator(std::string &str, std::string lang, std::string *msg=nullptr) const
Definition: calc.cpp:39
bool _changeFunction(std::string &str, std::string lang, std::string *msg=nullptr) const
Definition: calc.cpp:48
void _addMmce(std::string &str, const std::string &func) const
Definition: calc.h:71
Global Access of Log.
str
Definition: version_bump.py:14
content
Definition: version_bump.py:54
Global Access of Type Track.
Utilities.