tools/fw-logger/fw-logs-formating-options.cpp
Go to the documentation of this file.
1 // License: Apache 2.0. See LICENSE file in root directory.
2 // Copyright(c) 2019 Intel Corporation. All Rights Reserved.
4 #include "fw-logs-xml-helper.h"
5 #include <sstream>
6 
7 
8 using namespace std;
9 
10 namespace fw_logger
11 {
12  fw_log_event::fw_log_event()
13  : num_of_params(0),
14  line("")
15  {}
16 
17  fw_log_event::fw_log_event(int input_num_of_params, const string& input_line)
18  : num_of_params(input_num_of_params),
19  line(input_line)
20  {}
21 
22 
23  fw_logs_formating_options::fw_logs_formating_options(const string& xml_full_file_path)
24  : _xml_full_file_path(xml_full_file_path)
25  {}
26 
27 
29  {
30  }
31 
32  bool fw_logs_formating_options::get_event_data(int id, fw_log_event* log_event_data) const
33  {
34  auto event_it = _fw_logs_event_list.find(id);
35  if (event_it != _fw_logs_event_list.end())
36  {
37  *log_event_data = event_it->second;
38  return true;
39  }
40  else
41  {
42  stringstream ss;
43  ss << "*** Unrecognized Log Id: ";
44  ss << id;
45  ss << "! P1 = 0x{0:x}, P2 = 0x{1:x}, P3 = 0x{2:x}";
46  log_event_data->line = ss.str();
47  log_event_data->num_of_params = 3;
48  return false;
49  }
50  }
51 
53  {
54  auto file_it = _fw_logs_file_names_list.find(id);
55  if (file_it != _fw_logs_file_names_list.end())
56  {
57  *file_name = file_it->second;
58  return true;
59  }
60  else
61  {
62  *file_name = "Unknown";
63  return false;
64  }
65  }
66 
67  bool fw_logs_formating_options::get_thread_name(uint32_t thread_id, string* thread_name) const
68  {
69  auto file_it = _fw_logs_thread_names_list.find(thread_id);
70  if (file_it != _fw_logs_thread_names_list.end())
71  {
72  *thread_name = file_it->second;
73  return true;
74  }
75  else
76  {
77  *thread_name = "Unknown";
78  return false;
79  }
80  }
81 
82  std::unordered_map<string, std::vector<kvp>> fw_logs_formating_options::get_enums() const
83  {
85  }
86 
88  {
90  return fw_logs_xml.build_log_meta_data(this);
91  }
92 }
std::unordered_map< std::string, std::vector< std::pair< int, std::string > > > _fw_logs_enum_names_list
std::unordered_map< int, std::string > _fw_logs_thread_names_list
bool get_event_data(int id, fw_log_event *log_event_data) const
GLenum GLuint id
bool get_thread_name(uint32_t thread_id, std::string *thread_name) const
std::unordered_map< int, fw_log_event > _fw_logs_event_list
unsigned int uint32_t
Definition: stdint.h:80
std::unordered_map< int, std::string > _fw_logs_file_names_list
std::unordered_map< std::string, std::vector< kvp > > get_enums() const
bool build_log_meta_data(fw_logs_formating_options *logs_formating_options)
bool get_file_name(int id, std::string *file_name) const
fw_logs_formating_options(const std::string &xml_full_file_path)


librealsense2
Author(s): Sergey Dorodnicov , Doron Hirshberg , Mark Horn , Reagan Lopez , Itay Carpis
autogenerated on Mon May 3 2021 02:47:15