ifw-ccf  2.0.0
base.hpp
Go to the documentation of this file.
1 
5 #ifndef CCF_COMMON_BASE_HPP_H_
6 #define CCF_COMMON_BASE_HPP_H_
7 
8 #include <fmt/format.h>
9 
10 #include <boost/exception/diagnostic_information.hpp>
11 
12 #include <Recif.hpp>
13 #include <core/utils/base/base.hpp>
14 #include <core/utils/system/system.hpp>
15 #include <core/utils/time/time.hpp>
16 #include <core/utils/conversion/conversion.hpp>
17 #include <utils/bat/config.hpp>
18 
19 #include <ccf/mptk/manager.hpp>
20 #include <ccf/common/dataType.hpp>
21 
22 namespace ccf {
24 
26  enum class LogLevel {
27  OFF = 0,
28  FATAL = 100,
29  ERROR = 200,
30  WARN = 300,
31  INFO = 400,
32  DEBUG = 500,
33  DEBUG2 = 501,
34  DEBUG3 = 502,
35  TRACE = 600,
36  NOT_SET = -1
37  };
38 
40  // @{
41  namespace loglevel {
42  constexpr auto OFF = "OFF";
43  constexpr auto FATAL = "FATAL";
44  constexpr auto ERROR = "ERROR";
45  constexpr auto WARN = "WARN";
46  constexpr auto INFO = "INFO";
47  constexpr auto DEBUG = "DEBUG";
48  constexpr auto DEBUG2 = "DEBUG2";
49  constexpr auto DEBUG3 = "DEBUG3";
50  constexpr auto TRACE = "TRACE";
51  }
52  // @}
53 
54  inline LogLevel LogLevelToNb(const std::string& log_level) {
55  static std::map<std::string, LogLevel> s_log_level_str_to_nb_map =
61  try {
62  return s_log_level_str_to_nb_map[log_level];
63  } catch (...) {
64  throw std::runtime_error("Invalid log level given: " + log_level);
65  }
66  }
67 
68  inline std::string LogLevelToString(const LogLevel log_level) {
69  static std::map<LogLevel, std::string> s_log_level_nb_to_str_map =
75  return s_log_level_nb_to_str_map[log_level];
76  }
77 
79  constexpr auto CCF_VERSION = "1.2.0";
80 
82  constexpr auto IFW_VERSION = "4.0";
83 
84  constexpr auto NO_VALUE = "__NO__VALUE__";
85 
87 
88  const std::string DB_DELIM = std::string(utils::bat::CONFIG_DB_DELIMITER);
89 
90  // @{
91  const std::string DB_NODE_SM_STATUS_STATE =
92  ("sm" + DB_DELIM + "status" + DB_DELIM + "state");
93  const std::string DB_NODE_SM_STATUS_SUBSTATE =
94  ("sm" + DB_DELIM + "status" + DB_DELIM + "substate");
95  const std::string DB_NODE_SM_STATE =
96  ("sm" + DB_DELIM + "state");
97  // @}
98 
100  // @{
101  constexpr auto META_KEY_EXPO_RATE = "MetaExpoType";
102  constexpr auto META_KEY_EXPO_TIME = "MetaExpoTime";
103  constexpr auto META_KEY_EXPO_WIN_BINX = "MetaExpoWinBinX";
104  constexpr auto META_KEY_EXPO_WIN_BINY = "MetaExpoWinBinY";
105  constexpr auto META_KEY_EXPO_WIN_STARTX = "MetaExpoWinStartX";
106  constexpr auto META_KEY_EXPO_WIN_STARTY = "MetaExpoWinStartY";
107  constexpr auto META_KEY_SYSTEM = "MetaSystem";
108  constexpr auto META_KEY_CAM_NAME = "MetaCamName";
109  constexpr auto META_KEY_CAM_ID = "MetaCamId";
110  constexpr auto META_KEY_CAM_MODEL = "MetaCamModel";
111  constexpr auto META_KEY_CAM_CHIPMODEL = "MetaCamChipModel";
112  constexpr auto META_KEY_CAM_TYPE = "MetaCamType";
113  // @}
114 
116  // @{
117  constexpr auto STATE_ON_NOT_OP_NOT_READY = "On::NotOperational::NotReady";
118  constexpr auto STATE_ON_NOT_OP_READY = "On::NotOperational::Ready";
119  constexpr auto STATE_ON_OP_IDLE = "On::Operational::Idle";
120  constexpr auto STATE_ON_OP_ACQ = "On::Operational::Acquisition";
121  constexpr auto STATE_ON_OP_ACQ_NOT_REC = "On::Operational::Acquisition::NotRecording";
122  constexpr auto STATE_ON_OP_ACQ_REC = "On::Operational::Acquisition::Recording";
123  // @}
124 
125  enum class ThreadType {
126  MONITOR = 1,
127  ACQUISITION,
128  PROCESSING,
129  PUBLISHER,
130  UNDEFINED = -1
131  };
132 
134  void SendThrMsg(const std::string& command,
135  const std::string& sender_thread_id,
136  const std::string& receiver_thread_id,
137  const std::string& data);
138 
140  bool ReceiveThrMsg(const std::string& receiver_thread_id,
141  const double time_out,
142  ccf::mptk::Message& message);
143 
147  void DecomposeSmStatus(const std::string& sm_state,
148  std::string& sum_state,
149  std::string& sum_substate);
150 
152  class Base {
153  public:
154 
157  return s_mptk_mgr;
158  }
159 
161  static void SetLogLevel(const ccf::LogLevel log_level);
162 
164  static ccf::LogLevel GetLogLevel();
165 
166  Base();
167  ~Base();
168 
170  const std::string& GetClassName() const;
171 
174 
175  protected:
177  void SetClassName(const std::string& class_name);
178 
180  void SetLogger(log4cplus::Logger& logger);
181 
183 
184  private:
185  static ccf::mptk::Manager s_mptk_mgr;
186  static ccf::LogLevel s_log_level;
187  std::string m_class_name;
188  };
189 
191  void AssertPtr(const void* ptr,
192  const std::string& object,
193  const std::string& location);
194 
196  enum class HwStatus {
197  NOT_OK = 0,
198  OK
199  };
200 
202  enum class Status {
203  FAILURE = 0,
204  SUCCESS = 1
205  };
206 
208  // @{
209  constexpr auto SUCCESS = "Success";
210  constexpr auto FAILURE = "Failure";
211  // @}
212 
214  std::string StatusToStr(ccf::Status status);
215 
217  enum class Bitpix {
218  UNKNOWN = -1,
219  BYTE = 8, // 8 bit
220  PRESCALED = -8, // Prescaled
221  INT16 = 16, // 16 bit signed
222  UINT16 = -16, // 16 bit unsigned
223  INT32 = 32, // 32 bit integer
224  FLOAT = -32, // 32 bit floating point
225  INT64 = 64, // 64 bit integer (long long int)
226  DOUBLE = -64 // 64 bit double precision
227  };
228 
230  inline DataTypes BitpixToDataType(const Bitpix bitpix) {
231  switch (bitpix) {
232  case Bitpix::BYTE:
233  return DataTypes::BYTE;
234  case Bitpix::INT16:
235  return DataTypes::INT16;
236  case Bitpix::UINT16:
237  return DataTypes::UINT16;
238  case Bitpix::INT32:
239  return DataTypes::INT32;
240  case Bitpix::FLOAT:
241  return DataTypes::FLOAT;
242  case Bitpix::INT64:
243  return DataTypes::INT64;
244  case Bitpix::DOUBLE:
245  return DataTypes::DOUBLE;
246  default:
247  return DataTypes::INVALID;
248  }
249  }
250 
252  inline static Bitpix DataTypeToBitpix(const DataTypes data_type) {
253  switch (data_type) {
254  case DataTypes::BYTE:
255  return Bitpix::BYTE;
256  break;
257  case DataTypes::INT16:
258  return Bitpix::INT16;
259  break;
260  case DataTypes::UINT16:
261  return Bitpix::UINT16;
262  break;
263  case DataTypes::INT32:
264  return Bitpix::INT32;
265  break;
266  case DataTypes::FLOAT:
267  return Bitpix::FLOAT;
268  break;
269  case DataTypes::DOUBLE:
270  return Bitpix::DOUBLE;
271  break;
272  default:
273  return Bitpix::UNKNOWN;
274  }
275  }
276 
278  enum class PubType {
279  UNDEFINED = -1,
280  RECORDING = 1,
282  };
283 
285  enum class PubStatus {
286  ACTIVE = recif::RecStatusNames::Active,
287  COMPLETED = recif::RecStatusNames::Completed,
288  STOPPED = recif::RecStatusNames::Stopped,
289  ABORTED = recif::RecStatusNames::Aborted,
290  FAILED = recif::RecStatusNames::Failed,
291  UNDEFINED = recif::RecStatusNames::Undefined
292  };
293 
295  void ResetRecStatusObj(std::shared_ptr<recif::RecStatus>& rec_status_obj,
296  const recif::RecStatusNames rec_status = recif::RecStatusNames::Undefined);
297 
299  void CopyRecStatusObj(const std::shared_ptr<recif::RecStatus>& src_rec_status_obj,
300  const std::shared_ptr<recif::RecStatus>& trg_rec_status_obj);
301 
303  enum class ProcStatus {
304  UNDEFINED = -1,
305  IDLE = 1,
306  PROCESSING = 32,
307  FINISHED = 128,
308  FAILED = 256
309  };
310 
311  // TODO: Change name to Acquisition Mode.
313  enum class ExpoMode {
314  FINITE = 1,
315  CONTINUOUS,
316  INACTIVE
317  };
318 
320 // @{
321  constexpr auto CFG_NODE_ACQUISITION = "acquisition";
322  constexpr auto CFG_NODE_MONITORING = "monitoring";
323  constexpr auto CFG_NODE_PROCESSING = "processing";
324  constexpr auto CFG_NODE_RECORDING = "recording";
325  constexpr auto CFG_NODE_SERVER = "server";
326  constexpr auto CFG_NODE_TASKS = "tasks";
327 
328  constexpr auto CFG_KEY_ADAPTER = "adapter";
329  constexpr auto CFG_KEY_ADDRESS = "address";
330  constexpr auto CFG_KEY_ALLOW_FRAME_SKIPPING = "allow_frame_skipping";
331  constexpr auto CFG_KEY_ALLOW_LOST_FRAMES = "allow_lost_frames";
332  constexpr auto CFG_KEY_DEVICES = "devices";
333  constexpr auto CFG_KEY_HEIGHT = "height";
334  constexpr auto CFG_KEY_ID = "id";
335  constexpr auto CFG_KEY_IMAGE_DIR = "image_dir";
336  constexpr auto CFG_KEY_INIT_SETUP = "init_setup";
337  constexpr auto CFG_KEY_INPUT_QUEUE_SIZE = "input_queue_size";
338  constexpr auto CFG_KEY_MANUFACTURER = "manufacturer";
339  constexpr auto CFG_KEY_MAPPING = "mapping";
340  constexpr auto CFG_KEY_MAX_RATE = "max_rate";
341  constexpr auto CFG_KEY_MAX_RESOLUTION = "max_resolution";
342  constexpr auto CFG_KEY_METADATA_MAP = "metadata_map";
343  constexpr auto CFG_KEY_MODEL = "model";
344  constexpr auto CFG_KEY_NAME = "name";
345  constexpr auto CFG_KEY_NAMES = "names";
346  constexpr auto CFG_KEY_NB_OF_SAMPLES = "nb_of_samples";
347  constexpr auto CFG_KEY_OUPUT_QUEUE_SIZE = "output_queue_size";
348  constexpr auto CFG_KEY_PERIOD = "period";
349  constexpr auto CFG_KEY_PIPELINE = "pipeline";
350  constexpr auto CFG_KEY_PROPERTIES = "properties";
351  constexpr auto CFG_KEY_PROTOCOL = "protocol";
352  constexpr auto CFG_KEY_PUBLISHERS = "publishers";
353  constexpr auto CFG_KEY_RECIPES = "recipes";
354  constexpr auto CFG_KEY_REC_HIST_EXP = "rec_hist_expiration";
355  constexpr auto CFG_KEY_REC_HIST_SIZE = "rec_hist_size";
356  constexpr auto CFG_KEY_RESOLUTION = "resolution";
357  constexpr auto CFG_KEY_SDK = "sdk";
358  constexpr auto CFG_KEY_SIMULATION = "simulation";
359  constexpr auto CFG_KEY_SIM_ADDRESS = "sim_address";
360  constexpr auto CFG_KEY_TYPE = "type";
361  constexpr auto CFG_KEY_VALUE = "value";
362  constexpr auto CFG_KEY_WIDTH = "width";
363 // @}
364 
366  // @{
367  constexpr auto SETUP_NODE_EXPO = "expo";
368  constexpr auto SETUP_NODE_SIM = "sim";
369 
370  constexpr auto SETUP_KEY_ADDRESS = "address";
371  constexpr auto SETUP_KEY_BASENAME = "basename";
372  constexpr auto SETUP_KEY_BIN_X = "bin_x";
373  constexpr auto SETUP_KEY_BIN_Y = "bin_y";
374  constexpr auto SETUP_KEY_DELAY = "delay";
375  constexpr auto SETUP_KEY_ENABLED = "enabled";
376  constexpr auto SETUP_KEY_FILE = "file";
377  constexpr auto SETUP_KEY_FORMAT = "format";
378  constexpr auto SETUP_KEY_FRAME_RATE = "frame_rate";
379  constexpr auto SETUP_KEY_FRAME_RATE_LIMIT = "frame_rate_limit";
380  constexpr auto SETUP_KEY_MAX_RATE = "max_rate";
381  constexpr auto SETUP_KEY_MAX_SHIFT = "max_shift";
382  constexpr auto SETUP_KEY_MAX_SHIFT_PR_FRAME = "max_shift_pr_frame";
383  constexpr auto SETUP_KEY_MAX_SIZE = "max_size";
384  constexpr auto SETUP_KEY_MODE = "mode";
385  constexpr auto SETUP_KEY_NB = "nb";
386  constexpr auto SETUP_KEY_RATE = "rate";
387  constexpr auto SETUP_KEY_NOISE = "noise";
388  constexpr auto SETUP_KEY_PORT = "port";
389  constexpr auto SETUP_KEY_TIME = "time";
390  constexpr auto SETUP_KEY_TYPE = "type";
391  constexpr auto SETUP_KEY_WIN_START_X = "win_start_x";
392  constexpr auto SETUP_KEY_WIN_START_Y = "win_start_y";
393  constexpr auto SETUP_KEY_WIN_WIDTH = "win_width";
394  constexpr auto SETUP_KEY_WIN_HEIGHT = "win_height";
395 // @}
396 
398  // @{
399  constexpr auto EXPO_MODE_FINITE = "Finite";
400  constexpr auto EXPO_MODE_CONTINUOUS = "Continuous";
401  constexpr auto EXPO_MODE_INACTIVE = "Inactive";
402  // @}
403 
404  // Prefix prepended to Recording Session IDs.
405  constexpr auto REC_ID_PREFIX = "RecId";
406 
408  ExpoMode ExpoModeToNb(const std::string& expo_mode);
409 
411  enum class SimType {
412  FILE = 1,
413  PATTERN1
414  };
415 
417  // @{
418  constexpr auto SIM_TYPE_FILE_STR = "File";
419  constexpr auto SIM_TYPE_PATTERN1_STR = "Pattern1";
420  // @}
421 
423  // @{
424  constexpr auto PUB_STAT_NAME_ACTIVE = "Active";
425  constexpr auto PUB_STAT_NAME_COMPLETED = "Completed";
426  constexpr auto PUB_STAT_NAME_STOPPED = "Stopped";
427  constexpr auto PUB_STAT_NAME_ABORTED = "Aborted";
428  constexpr auto PUB_STAT_NAME_FAILED = "Failed";
429  constexpr auto PUB_STAT_NAME_UNDEFINED = "Undefined";
430  // @}
431 
433  std::string RecStatusNameToStr(recif::RecStatusNames rec_status_nb);
434 
436  std::string PubStatusNameToStr(PubStatus pub_status_nb);
437 
438  // /// Log level string to number representation.
439  // LogLevel LogLevelStrToNb(const std::string& log_level);
440 
442  std::string BuildKey(const std::vector<std::string>& elements);
443 
445  std::vector<std::string> SplitKey(const std::string& key);
446 
447 }
448 
450 inline std::string CcfThreadName() {
451  char thread_name[32];
452  pthread_getname_np(pthread_self(), thread_name, 32);
453  return thread_name;
454 }
455 
457 #define CCFLOC (std::string(__FILE__) + ":" + std::to_string(__LINE__) + ":" + \
458  std::string(__FUNCTION__) + ":" + CcfThreadName())
459 #define CCFL0C (std::string(__FILE__) + ":" + std::to_string(__LINE__) + ":" + \
460  std::string(__FUNCTION__) + ":" + CcfThreadName() + ": ")
461 
468 // class CCF_TRACE_CLASS {
469 // public:
470 // static int8_t s_nesting_level;
471 // static std::string s_padding_chars;
472 
473 // /// Constructor registering the location and optional scope description (user defined).
474 // /// It generate the scope entering log entry.
475 // CCF_TRACE_CLASS(log4cplus::Logger& logger,
476 // const std::string& location,
477 // const std::string& scope = "") {
478 // if (s_nesting_level == -2) {
479 // s_nesting_level = -1;
480 // }
481 // s_nesting_level++;
482 // m_time_at_scope_entry = core::utils::time::Time();
483 // m_location = location;
484 // m_scope = scope;
485 // m_id = core::utils::base::GenUniqueId();
486 // m_logger = &logger;
487 // if (scope != "") {
488 // LOG4CPLUS_TRACE(logger, (s_padding_chars.substr(0, s_nesting_level) + "ENTERING:" +
489 // m_id + ": " + location + ":" + scope));
490 // } else {
491 // LOG4CPLUS_TRACE(logger, (s_padding_chars.substr(0, s_nesting_level) + "ENTERING:" +
492 // m_id + ": " + location));
493 // }
494 // };
495 
496 // /// Destructor generating the scope exit trace log.
497 // ~CCF_TRACE_CLASS() {
498 // if (m_scope != "") {
499 // LOG4CPLUS_TRACE(*m_logger, (s_padding_chars.substr(0, s_nesting_level) + "LEAVING:" +
500 // m_id + ": " + m_location + ":" + m_scope + " (" +
501 // core::utils::conversion::NbToStr((core::utils::time::Time() -
502 // m_time_at_scope_entry), "%.6E") + " s)"));
503 // } else {
504 // LOG4CPLUS_TRACE(*m_logger, (s_padding_chars.substr(0, s_nesting_level) + "LEAVING:" +
505 // m_id + ": " + m_location + " (" +
506 // core::utils::conversion::NbToStr((core::utils::time::Time() -
507 // m_time_at_scope_entry), "%.6E") + " s)"));
508 // }
509 // s_nesting_level--;
510 // };
511 
512 // protected:
513 
514 // private:
515 // double m_time_at_scope_entry;
516 // std::string m_location;
517 // std::string m_scope;
518 // std::string m_id;
519 // log4cplus::Logger* m_logger;
520 // };
521 
524 inline void CcfDebug(const std::string& location,
525  const std::string& msg) {
526  fprintf(stdout, "%s:%s#> %s\n", core::utils::time::IsoTimeNow().c_str(), location.c_str(), msg.c_str());
527  fflush(stdout);
528 }
529 
531 #define INFO_LOG_GUARD if (ccf::Base::GetLogLevel() >= ccf::LogLevel::INFO)
532 
534 #define DEBUG_LOG_GUARD if (ccf::Base::GetLogLevel() >= ccf::LogLevel::DEBUG)
535 
537 #define DEBUG2_LOG_GUARD if (ccf::Base::GetLogLevel() >= ccf::LogLevel::DEBUG2)
538 
540 #define DEBUG3_LOG_GUARD if (ccf::Base::GetLogLevel() >= ccf::LogLevel::DEBUG3)
541 
543 #define TRACE_LOG_GUARD if (ccf::Base::GetLogLevel() >= ccf::LogLevel::TRACE)
544 
546 #define CCFERROR(logger, msg) LOG4CPLUS_ERROR(logger, CCFLOC << ": " << msg)
547 
549 #define CCFWARNING(logger, msg) LOG4CPLUS_WARN(logger, CCFLOC << ": " << msg)
550 
552 #define CCFINFO(logger, msg) INFO_LOG_GUARD { LOG4CPLUS_INFO(logger, CCFLOC << ": " << msg); }
553 
555 #define CCFDEBUG(logger, msg) DEBUG_LOG_GUARD { LOG4CPLUS_DEBUG(logger, CCFLOC << ": " << msg); }
556 
558 #define CCFDEBUG2(logger, msg) DEBUG2_LOG_GUARD { LOG4CPLUS_DEBUG(logger, CCFLOC << ": " << msg); }
559 
561 #define CCFDEBUG3(logger, msg) DEBUG3_LOG_GUARD { LOG4CPLUS_DEBUG(logger, CCFLOC << ": " << msg); }
562 
563 // /// TRACE log macro. Includes the location ("CCFLOC") in the log message.
564 //#define C CFTRACE(logger) TRACE_LOG_GUARD { LOG4CPLUS_TRACE_METHOD(logger __PRETTY_FUNCTION__); }
565 
568 #define CCFTHROW(msg) throw rad::Exception(CCFLOC + ": " + msg)
569 
570 #endif // CCF_COMMON_BASE_HPP_H_
ccf::META_KEY_CAM_MODEL
constexpr auto META_KEY_CAM_MODEL
Definition: base.hpp:110
ccf::Base
Class to be used as parent all CCF classes.
Definition: base.hpp:152
ccf::DB_NODE_SM_STATE
const std::string DB_NODE_SM_STATE
Definition: base.hpp:95
ccf::CFG_KEY_ADDRESS
constexpr auto CFG_KEY_ADDRESS
Definition: base.hpp:329
ccf::SETUP_KEY_TYPE
constexpr auto SETUP_KEY_TYPE
Definition: base.hpp:390
ccf::loglevel::ERROR
constexpr auto ERROR
Definition: base.hpp:44
ccf::CFG_KEY_IMAGE_DIR
constexpr auto CFG_KEY_IMAGE_DIR
Definition: base.hpp:335
ccf::CFG_KEY_OUPUT_QUEUE_SIZE
constexpr auto CFG_KEY_OUPUT_QUEUE_SIZE
Definition: base.hpp:347
ccf::IFW_VERSION
constexpr auto IFW_VERSION
Version of IFW.
Definition: base.hpp:82
ccf::SETUP_KEY_FORMAT
constexpr auto SETUP_KEY_FORMAT
Definition: base.hpp:377
ccf::CFG_KEY_METADATA_MAP
constexpr auto CFG_KEY_METADATA_MAP
Definition: base.hpp:342
ccf::SETUP_KEY_BIN_X
constexpr auto SETUP_KEY_BIN_X
Definition: base.hpp:372
ccf::SETUP_KEY_MAX_RATE
constexpr auto SETUP_KEY_MAX_RATE
Definition: base.hpp:380
ccf::PUB_STAT_NAME_FAILED
constexpr auto PUB_STAT_NAME_FAILED
Definition: base.hpp:428
ccf::ThreadType::MONITOR
@ MONITOR
ccf::META_KEY_EXPO_RATE
constexpr auto META_KEY_EXPO_RATE
Definition: base.hpp:101
dataType.hpp
CcfThreadName
std::string CcfThreadName()
Return thread name allocated.
Definition: base.hpp:450
ccf::StatusToStr
std::string StatusToStr(ccf::Status status)
Convert the status from number to string.
Definition: base.cpp:124
ccf::CFG_KEY_MANUFACTURER
constexpr auto CFG_KEY_MANUFACTURER
Definition: base.hpp:338
ccf::Base::GetLogLevel
static ccf::LogLevel GetLogLevel()
Return the current CCF log level.
Definition: base.cpp:84
ccf::CFG_KEY_PROPERTIES
constexpr auto CFG_KEY_PROPERTIES
Definition: base.hpp:350
ccf::PubType
PubType
A Publisher may be Recording or Not-Recording. A Recording Publisher publishes data into files.
Definition: base.hpp:278
ccf::CFG_KEY_PROTOCOL
constexpr auto CFG_KEY_PROTOCOL
Definition: base.hpp:351
ccf::CFG_KEY_REC_HIST_EXP
constexpr auto CFG_KEY_REC_HIST_EXP
Definition: base.hpp:354
ccf::AssertPtr
void AssertPtr(const void *ptr, const std::string &object, const std::string &location)
Check that pointer is not nullptr and raise rad::exception in case it is.
Definition: base.cpp:53
ccf::STATE_ON_NOT_OP_READY
constexpr auto STATE_ON_NOT_OP_READY
Definition: base.hpp:118
ccf::CFG_KEY_PIPELINE
constexpr auto CFG_KEY_PIPELINE
Definition: base.hpp:349
ccf::DecomposeSmStatus
void DecomposeSmStatus(const std::string &sm_state, std::string &sum_state, std::string &sum_substate)
Definition: base.cpp:184
ccf::CFG_KEY_SIMULATION
constexpr auto CFG_KEY_SIMULATION
Definition: base.hpp:358
ccf::SETUP_KEY_ADDRESS
constexpr auto SETUP_KEY_ADDRESS
Definition: base.hpp:370
ccf::Base::SetLogger
void SetLogger(log4cplus::Logger &logger)
Set reference to logger used in this context.
Definition: base.cpp:92
ccf::Base::SetLogLevel
static void SetLogLevel(const ccf::LogLevel log_level)
Set the log level.
Definition: base.cpp:79
ccf::SETUP_KEY_FRAME_RATE_LIMIT
constexpr auto SETUP_KEY_FRAME_RATE_LIMIT
Definition: base.hpp:379
ccf::CFG_KEY_NAME
constexpr auto CFG_KEY_NAME
Definition: base.hpp:344
ccf::PUB_STAT_NAME_STOPPED
constexpr auto PUB_STAT_NAME_STOPPED
Definition: base.hpp:426
ccf::META_KEY_CAM_TYPE
constexpr auto META_KEY_CAM_TYPE
Definition: base.hpp:112
ccf::STATE_ON_OP_IDLE
constexpr auto STATE_ON_OP_IDLE
Definition: base.hpp:119
ccf::SETUP_KEY_MAX_SHIFT
constexpr auto SETUP_KEY_MAX_SHIFT
Definition: base.hpp:381
manager.hpp
ccf::SETUP_KEY_NB
constexpr auto SETUP_KEY_NB
Definition: base.hpp:385
ccf::META_KEY_EXPO_TIME
constexpr auto META_KEY_EXPO_TIME
Definition: base.hpp:102
ccf::CFG_KEY_ALLOW_FRAME_SKIPPING
constexpr auto CFG_KEY_ALLOW_FRAME_SKIPPING
Definition: base.hpp:330
ccf::META_KEY_CAM_NAME
constexpr auto META_KEY_CAM_NAME
Definition: base.hpp:108
ccf::EXPO_MODE_FINITE
constexpr auto EXPO_MODE_FINITE
Definition: base.hpp:399
ccf::Base::Base
Base()
Definition: base.cpp:63
ccf::META_KEY_EXPO_WIN_STARTX
constexpr auto META_KEY_EXPO_WIN_STARTX
Definition: base.hpp:105
ccf::loglevel::OFF
constexpr auto OFF
Definition: base.hpp:42
ccf::CFG_KEY_ADAPTER
constexpr auto CFG_KEY_ADAPTER
Definition: base.hpp:328
ccf::Base::~Base
~Base()
Definition: base.cpp:67
ccf::CFG_KEY_RESOLUTION
constexpr auto CFG_KEY_RESOLUTION
Definition: base.hpp:356
ccf::SimType::FILE
@ FILE
ccf::FAILURE
constexpr auto FAILURE
Definition: base.hpp:210
ccf::SIM_TYPE_PATTERN1_STR
constexpr auto SIM_TYPE_PATTERN1_STR
Definition: base.hpp:419
ccf::Bitpix::UNKNOWN
@ UNKNOWN
ccf::NO_VALUE
constexpr auto NO_VALUE
Definition: base.hpp:84
ccf::loglevel::TRACE
constexpr auto TRACE
Definition: base.hpp:50
ccf::SETUP_KEY_ENABLED
constexpr auto SETUP_KEY_ENABLED
Definition: base.hpp:375
ccf::CFG_KEY_RECIPES
constexpr auto CFG_KEY_RECIPES
Definition: base.hpp:353
ccf::CFG_KEY_MAPPING
constexpr auto CFG_KEY_MAPPING
Definition: base.hpp:339
ccf::PubStatus::ACTIVE
@ ACTIVE
ccf::SimType
SimType
Simulation type.
Definition: base.hpp:411
ccf::LogLevel::OFF
@ OFF
ccf::PUB_STAT_NAME_COMPLETED
constexpr auto PUB_STAT_NAME_COMPLETED
Definition: base.hpp:425
ccf::SETUP_KEY_FRAME_RATE
constexpr auto SETUP_KEY_FRAME_RATE
Definition: base.hpp:378
ccf::SETUP_KEY_MAX_SIZE
constexpr auto SETUP_KEY_MAX_SIZE
Definition: base.hpp:383
ccf::mptk::Manager
IFW CTD Multiprocessing Toolkit Manager class.
Definition: manager.hpp:21
ccf::Base::GetClassName
const std::string & GetClassName() const
Return the allocated name of the class.
Definition: base.cpp:69
ccf::META_KEY_CAM_ID
constexpr auto META_KEY_CAM_ID
Definition: base.hpp:109
CcfDebug
void CcfDebug(const std::string &location, const std::string &msg)
Class used to generate TRACE logs.
Definition: base.hpp:524
ccf::STATE_ON_OP_ACQ_REC
constexpr auto STATE_ON_OP_ACQ_REC
Definition: base.hpp:122
ccf::EXPO_MODE_CONTINUOUS
constexpr auto EXPO_MODE_CONTINUOUS
Definition: base.hpp:400
ccf::Status
Status
General status variable.
Definition: base.hpp:202
ccf::loglevel::INFO
constexpr auto INFO
Definition: base.hpp:46
ccf::HwStatus
HwStatus
HW status values.
Definition: base.hpp:196
ccf::CFG_KEY_MAX_RESOLUTION
constexpr auto CFG_KEY_MAX_RESOLUTION
Definition: base.hpp:341
ccf::SETUP_KEY_DELAY
constexpr auto SETUP_KEY_DELAY
Definition: base.hpp:374
ccf::PubStatus
PubStatus
Defines the various possible states of a Data Publisher.
Definition: base.hpp:285
ccf::META_KEY_EXPO_WIN_BINX
constexpr auto META_KEY_EXPO_WIN_BINX
Definition: base.hpp:103
ccf::CFG_KEY_ID
constexpr auto CFG_KEY_ID
Definition: base.hpp:334
ccf::LogLevelToNb
LogLevel LogLevelToNb(const std::string &log_level)
Definition: base.hpp:54
ccf::SETUP_KEY_BASENAME
constexpr auto SETUP_KEY_BASENAME
Definition: base.hpp:371
ccf::CFG_NODE_TASKS
constexpr auto CFG_NODE_TASKS
Definition: base.hpp:326
ccf::CFG_KEY_PERIOD
constexpr auto CFG_KEY_PERIOD
Definition: base.hpp:348
ccf::SETUP_KEY_MODE
constexpr auto SETUP_KEY_MODE
Definition: base.hpp:384
ccf::STATE_ON_OP_ACQ
constexpr auto STATE_ON_OP_ACQ
Definition: base.hpp:120
ccf::PubStatusNameToStr
std::string PubStatusNameToStr(PubStatus pub_status_nb)
Publisher status, number representation to string.
Definition: base.cpp:132
ccf::ThreadType
ThreadType
Definition: base.hpp:125
ccf::SETUP_KEY_WIN_HEIGHT
constexpr auto SETUP_KEY_WIN_HEIGHT
Definition: base.hpp:394
ccf::ProcStatus
ProcStatus
Possible states for a Processing Recipe defined.
Definition: base.hpp:303
ccf::CFG_NODE_SERVER
constexpr auto CFG_NODE_SERVER
Definition: base.hpp:325
ccf::SETUP_KEY_MAX_SHIFT_PR_FRAME
constexpr auto SETUP_KEY_MAX_SHIFT_PR_FRAME
Definition: base.hpp:382
ccf::CFG_KEY_VALUE
constexpr auto CFG_KEY_VALUE
Definition: base.hpp:361
ccf::SETUP_NODE_SIM
constexpr auto SETUP_NODE_SIM
Definition: base.hpp:368
ccf::PUB_STAT_NAME_ABORTED
constexpr auto PUB_STAT_NAME_ABORTED
Definition: base.hpp:427
ccf::SETUP_KEY_NOISE
constexpr auto SETUP_KEY_NOISE
Definition: base.hpp:387
ccf::Base::Mptk
static ccf::mptk::Manager & Mptk()
Return reference to internal MPTK instance (singleton).
Definition: base.hpp:156
ccf::CopyRecStatusObj
void CopyRecStatusObj(const std::shared_ptr< recif::RecStatus > &src_rec_status_obj, const std::shared_ptr< recif::RecStatus > &trg_rec_status_obj)
Cope the members of one Recording Status Object to another.
Definition: base.cpp:167
ccf::Status::FAILURE
@ FAILURE
ccf
Definition: appBase.cpp:8
ccf::Bitpix
Bitpix
CCF image data types. Based on the values defined for BITPIX in the FITS standard.
Definition: base.hpp:217
ccf::Base::m_logger
log4cplus::Logger m_logger
Definition: base.hpp:182
ccf::mptk::Message
IFW CTD Multiprocessing Toolkit Message class.
Definition: message.hpp:19
ccf::BitpixToDataType
DataTypes BitpixToDataType(const Bitpix bitpix)
Converts the FITS BITPIX value into a data type.
Definition: base.hpp:230
ccf::ExpoMode::FINITE
@ FINITE
ccf::SETUP_KEY_WIN_START_Y
constexpr auto SETUP_KEY_WIN_START_Y
Definition: base.hpp:392
ccf::CFG_KEY_ALLOW_LOST_FRAMES
constexpr auto CFG_KEY_ALLOW_LOST_FRAMES
Definition: base.hpp:331
ccf::CFG_KEY_NB_OF_SAMPLES
constexpr auto CFG_KEY_NB_OF_SAMPLES
Definition: base.hpp:346
ccf::CFG_KEY_INIT_SETUP
constexpr auto CFG_KEY_INIT_SETUP
Definition: base.hpp:336
ccf::CFG_NODE_RECORDING
constexpr auto CFG_NODE_RECORDING
Definition: base.hpp:324
ccf::loglevel::FATAL
constexpr auto FATAL
Definition: base.hpp:43
ccf::CFG_KEY_NAMES
constexpr auto CFG_KEY_NAMES
Definition: base.hpp:345
ccf::SETUP_KEY_BIN_Y
constexpr auto SETUP_KEY_BIN_Y
Definition: base.hpp:373
ccf::loglevel::DEBUG3
constexpr auto DEBUG3
Definition: base.hpp:49
ccf::SETUP_KEY_PORT
constexpr auto SETUP_KEY_PORT
Definition: base.hpp:388
ccf::META_KEY_EXPO_WIN_BINY
constexpr auto META_KEY_EXPO_WIN_BINY
Definition: base.hpp:104
ccf::ProcStatus::UNDEFINED
@ UNDEFINED
ccf::EXPO_MODE_INACTIVE
constexpr auto EXPO_MODE_INACTIVE
Definition: base.hpp:401
ccf::STATE_ON_NOT_OP_NOT_READY
constexpr auto STATE_ON_NOT_OP_NOT_READY
Definition: base.hpp:117
ccf::loglevel::DEBUG2
constexpr auto DEBUG2
Definition: base.hpp:48
ccf::CFG_KEY_SDK
constexpr auto CFG_KEY_SDK
Definition: base.hpp:357
ccf::loglevel::DEBUG
constexpr auto DEBUG
Definition: base.hpp:47
ccf::ResetRecStatusObj
void ResetRecStatusObj(std::shared_ptr< recif::RecStatus > &rec_status_obj, const recif::RecStatusNames rec_status)
Reset the members of the Recording Status Object.
Definition: base.cpp:149
ccf::LogLevelToString
std::string LogLevelToString(const LogLevel log_level)
Definition: base.hpp:68
ccf::loglevel::WARN
constexpr auto WARN
Definition: base.hpp:45
ccf::SendThrMsg
void SendThrMsg(const std::string &command, const std::string &sender_thread_id, const std::string &receiver_thread_id, const std::string &data)
Send MPTK message via internal Message Bus.
Definition: base.cpp:36
ccf::CFG_KEY_MAX_RATE
constexpr auto CFG_KEY_MAX_RATE
Definition: base.hpp:340
ccf::SETUP_KEY_WIN_START_X
constexpr auto SETUP_KEY_WIN_START_X
Definition: base.hpp:391
ccf::LogLevel
LogLevel
Log levels defined for CCF; adds two debugging levels: DEBUG2, DEBUG3.
Definition: base.hpp:26
ccf::SIM_TYPE_FILE_STR
constexpr auto SIM_TYPE_FILE_STR
Definition: base.hpp:418
ccf::ExpoMode
ExpoMode
Exposure modes.
Definition: base.hpp:313
ccf::CFG_KEY_WIDTH
constexpr auto CFG_KEY_WIDTH
Definition: base.hpp:362
ccf::PUB_STAT_NAME_UNDEFINED
constexpr auto PUB_STAT_NAME_UNDEFINED
Definition: base.hpp:429
ccf::DB_NODE_SM_STATUS_STATE
const std::string DB_NODE_SM_STATUS_STATE
Definition: base.hpp:91
ccf::CFG_NODE_MONITORING
constexpr auto CFG_NODE_MONITORING
Definition: base.hpp:322
ccf::DB_DELIM
const std::string DB_DELIM
Definition: base.hpp:88
ccf::META_KEY_SYSTEM
constexpr auto META_KEY_SYSTEM
Definition: base.hpp:107
ccf::CFG_KEY_SIM_ADDRESS
constexpr auto CFG_KEY_SIM_ADDRESS
Definition: base.hpp:359
ccf::CFG_NODE_PROCESSING
constexpr auto CFG_NODE_PROCESSING
Definition: base.hpp:323
ccf::META_KEY_EXPO_WIN_STARTY
constexpr auto META_KEY_EXPO_WIN_STARTY
Definition: base.hpp:106
ccf::CFG_KEY_DEVICES
constexpr auto CFG_KEY_DEVICES
Definition: base.hpp:332
ccf::PubType::UNDEFINED
@ UNDEFINED
ccf::CFG_KEY_MODEL
constexpr auto CFG_KEY_MODEL
Definition: base.hpp:343
ccf::META_KEY_CAM_CHIPMODEL
constexpr auto META_KEY_CAM_CHIPMODEL
Definition: base.hpp:111
ccf::ExpoModeToNb
ExpoMode ExpoModeToNb(const std::string &expo_mode)
Convert exposure mode from number representation to string.
Definition: base.cpp:96
ccf::CFG_KEY_PUBLISHERS
constexpr auto CFG_KEY_PUBLISHERS
Definition: base.hpp:352
ccf::REC_ID_PREFIX
constexpr auto REC_ID_PREFIX
Definition: base.hpp:405
ccf::PUB_STAT_NAME_ACTIVE
constexpr auto PUB_STAT_NAME_ACTIVE
Definition: base.hpp:424
ccf::ReceiveThrMsg
bool ReceiveThrMsg(const std::string &receiver_thread_id, const double time_out, ccf::mptk::Message &message)
Receive a message from the given thread. Returns true if message received.
Definition: base.cpp:45
ccf::SETUP_KEY_FILE
constexpr auto SETUP_KEY_FILE
Definition: base.hpp:376
ccf::SETUP_KEY_WIN_WIDTH
constexpr auto SETUP_KEY_WIN_WIDTH
Definition: base.hpp:393
ccf::CFG_KEY_HEIGHT
constexpr auto CFG_KEY_HEIGHT
Definition: base.hpp:333
ccf::RecStatusNameToStr
std::string RecStatusNameToStr(recif::RecStatusNames rec_status_nb)
Recording Status name, number to string representation.
Definition: base.cpp:144
ccf::Base::Loggger
log4cplus::Logger & Loggger()
Return reference to logger used in this context.
Definition: base.cpp:88
ccf::DB_NODE_SM_STATUS_SUBSTATE
const std::string DB_NODE_SM_STATUS_SUBSTATE
Definition: base.hpp:93
ccf::CFG_KEY_REC_HIST_SIZE
constexpr auto CFG_KEY_REC_HIST_SIZE
Definition: base.hpp:355
ccf::STATE_ON_OP_ACQ_NOT_REC
constexpr auto STATE_ON_OP_ACQ_NOT_REC
Definition: base.hpp:121
ccf::CFG_KEY_INPUT_QUEUE_SIZE
constexpr auto CFG_KEY_INPUT_QUEUE_SIZE
Definition: base.hpp:337
ccf::DataTypes
DataTypes
Definition: dataType.hpp:46
ccf::CCF_VERSION
constexpr auto CCF_VERSION
Version of CCF.
Definition: base.hpp:79
ccf::SETUP_KEY_RATE
constexpr auto SETUP_KEY_RATE
Definition: base.hpp:386
ccf::SUCCESS
constexpr auto SUCCESS
Definition: base.hpp:209
ccf::CFG_NODE_ACQUISITION
constexpr auto CFG_NODE_ACQUISITION
Definition: base.hpp:321
ccf::HwStatus::NOT_OK
@ NOT_OK
ccf::CFG_KEY_TYPE
constexpr auto CFG_KEY_TYPE
Definition: base.hpp:360
ccf::BuildKey
std::string BuildKey(const std::vector< std::string > &elements)
Build a concatenated key from a number of elements (<el1>.<el2.>...).
Definition: base.cpp:218
ccf::SETUP_NODE_EXPO
constexpr auto SETUP_NODE_EXPO
Definition: base.hpp:367
ccf::SETUP_KEY_TIME
constexpr auto SETUP_KEY_TIME
Definition: base.hpp:389
ccf::SplitKey
std::vector< std::string > SplitKey(const std::string &key)
Split up a concatenated key.
Definition: base.cpp:222
ccf::Logger
log4cplus::Logger & Logger()
Definition: base.cpp:9
ccf::Base::SetClassName
void SetClassName(const std::string &class_name)
Set the name of the class in question.
Definition: base.cpp:74