From d6c1b80cdbd87df96f3f648d67ccdbba6794f957 Mon Sep 17 00:00:00 2001 From: Romain Forlot Date: Mon, 6 Mar 2017 18:45:35 +0100 Subject: Sort and comment the code Change-Id: I1860c0d5fb03ce2217d5553159a090298596d939 Signed-off-by: Romain Forlot --- src/can-signals.cpp | 44 +++++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 27 deletions(-) (limited to 'src/can-signals.cpp') diff --git a/src/can-signals.cpp b/src/can-signals.cpp index bf6b4a4..07689a0 100644 --- a/src/can-signals.cpp +++ b/src/can-signals.cpp @@ -42,56 +42,46 @@ std::vector> SIGNALS = { }, }; -/** - * @brief Can signal event map making access to afb_event - * externaly to an openxc existing structure. +/** + * @fn std::vector& get_can_signals() * - * @desc Event map is making relation between CanSignal generic name - * and the afb_event struct used by application framework to pushed - * to the subscriber. + * @return A reference to a vector of signals */ -std::map subscribed_signals; - -/** -* @brief Mutex allowing safe manipulation on subscribed_signals map. -* @desc To ensure that the map object isn't modified when we read it, you -* have to set this mutex before use subscribed_signals map object. -*/ -std::mutex subscribed_signals_mutex; - -std::mutex& get_subscribed_signals_mutex() -{ - return subscribed_signals_mutex; -} - -std::map& get_subscribed_signals() -{ - return subscribed_signals; -} - std::vector& get_can_signals() { return SIGNALS[MESSAGE_SET_ID]; } +/** + * @fn size_t getSignalCount() + * + * @return the length of the array returned by get_can_signals(). + */ size_t getSignalCount() { return SIGNALS[MESSAGE_SET_ID].size(); } +/** + * @brief Retrieve can arbitration id of a given CanSignal + * + * @param[in] CanSignal& - a const reference to a CanSignal + * + * @return uint32_t - unsigned integer representing the arbitration id. + */ uint32_t get_signal_id(const CanSignal& sig) { return sig.message->id; } /** - * @fn std::vector find_signals(const openxc_DynamicField &key) + * @fn void find_can_signals(const openxc_DynamicField& key, std::vector& found_signals) * @brief return signals name found searching through CAN_signals and OBD2 pid * * @param[in] const openxc_DynamicField : can contain numeric or string value in order to search against * can signals or obd2 signals name. + * @param[out] std::vector& found_signals : provided vector to fill with ponter to signals matched. * - * @return std::vector Vector of signals name found. */ void find_can_signals(const openxc_DynamicField& key, std::vector& found_signals) { -- cgit 1.2.3-korg