16 std::unordered_map<std::string, std::string> &allowedMap,
17 std::unordered_map<std::string, std::string> &outArgs,
const std::set<std::string> &booleanArgs)
19 std::set<std::string> allowedKeys;
20 std::set<std::string> allowedShortKeys;
21 for (
const auto& [k, v] : allowedMap) {
22 allowedShortKeys.insert(k);
23 allowedKeys.insert(v);
25 for ( std::int32_t i = 1; i < argc; ++i) {
26 std::string current = argv[i];
29 if (current.rfind(
"--", 0) == 0 || current.rfind(
'-', 0) == 0) {
31 if (current.rfind(
"--", 0) == 0){
32 key = current.substr(2);
34 std::string sKey = current.substr(1);
36 key = allowedMap.at(sKey);
40 if (booleanArgs.find(key) != booleanArgs.end()) {
41 outArgs[key] =
"true";
44 const std::string value = argv[++i];
54void customConsole(
const std::string& appName,
const std::string& message,
const std::string& logLevel ) {
56 const auto now = std::chrono::high_resolution_clock::now();
57 const auto duration = now.time_since_epoch();
58 const auto microseconds = std::chrono::duration_cast<std::chrono::microseconds>(duration);
61 const std::time_t currentTime = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
62 const std::tm* tm = std::localtime(¤tTime);
65 std::ostringstream timestampStream;
66 timestampStream << std::put_time(tm,
"%Y-%m-%d %H:%M:%S");
69 std::cout <<
"[" << timestampStream.str() <<
"."
70 << std::setw(6) << std::setfill(
'0') << microseconds.count() % 1000000
71 <<
"] [" << appName <<
"] "
72 <<
"[" << logLevel <<
"] : "
73 << message << std::endl;
void customConsole(const std::string &appName, const std::string &message, const std::string &logLevel)
Prints log to console adding various information about.
CCSDS::ResultBool parseArguments(const std::int32_t argc, char *argv[], std::unordered_map< std::string, std::string > &allowedMap, std::unordered_map< std::string, std::string > &outArgs, const std::set< std::string > &booleanArgs)
This is the source file that holds the execution logic of ccsds_encoder binary file.