13 std::unordered_map<std::string, std::string> &allowedMap,
14 std::unordered_map<std::string, std::string> &outArgs,
const std::set<std::string> &booleanArgs)
16 std::set<std::string> allowedKeys;
17 std::set<std::string> allowedShortKeys;
18 for (
const auto& [k, v] : allowedMap) {
19 allowedShortKeys.insert(k);
20 allowedKeys.insert(v);
22 for ( std::int32_t i = 1; i < argc; ++i) {
23 std::string current = argv[i];
26 if (current.rfind(
"--", 0) == 0 || current.rfind(
'-', 0) == 0) {
28 if (current.rfind(
"--", 0) == 0){
29 key = current.substr(2);
31 std::string sKey = current.substr(1);
33 key = allowedMap.at(sKey);
37 if (booleanArgs.find(key) != booleanArgs.end()) {
38 outArgs[key] =
"true";
41 const std::string value = argv[++i];
51void customConsole(
const std::string& appName,
const std::string& message,
const std::string& logLevel ) {
53 const auto now = std::chrono::high_resolution_clock::now();
54 const auto duration = now.time_since_epoch();
55 const auto microseconds = std::chrono::duration_cast<std::chrono::microseconds>(duration);
58 const std::time_t currentTime = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
59 const std::tm* tm = std::localtime(¤tTime);
62 std::ostringstream timestampStream;
63 timestampStream << std::put_time(tm,
"%Y-%m-%d %H:%M:%S");
66 std::cout <<
"[" << timestampStream.str() <<
"."
67 << std::setw(6) << std::setfill(
'0') << microseconds.count() % 1000000
68 <<
"] [" << appName <<
"] "
69 <<
"[" << logLevel <<
"] : "
70 << 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.