Diag-Client-Lib
conversation_manager.h
Go to the documentation of this file.
1 /* Diagnostic Client library
2  * Copyright (C) 2024 Avijit Dey
3  *
4  * This Source Code Form is subject to the terms of the Mozilla Public
5  * License, v. 2.0. If a copy of the MPL was not distributed with this
6  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
7  */
8 #ifndef DIAGNOSTIC_CLIENT_LIB_APPL_SRC_DCM_CONVERSATION_CONVERSATION_MANAGER_H
9 #define DIAGNOSTIC_CLIENT_LIB_APPL_SRC_DCM_CONVERSATION_CONVERSATION_MANAGER_H
10 /* includes */
11 #include <optional>
12 #include <string_view>
13 #include <variant>
14 
21 
22 namespace diag {
23 namespace client {
24 namespace conversation_manager {
25 
30  public:
40 
44  ~ConversationManager() noexcept = default;
45 
49  void Startup() noexcept;
50 
54  void Shutdown() noexcept;
55 
62  diag::client::conversation::Conversation &GetDiagnosticClientConversation(
63  std::string_view conversation_name) noexcept;
64 
65  private:
73  std::variant<conversation::DMConversationType, conversation::VDConversationType> conversation_type{};
74 
78  std::unique_ptr<diag::client::conversation::Conversation> conversation{};
79  };
80 
85 
89  std::unordered_map<std::string, ConversationStorage> conversation_map_;
90 
97 };
98 } // namespace conversation_manager
99 } // namespace client
100 } // namespace diag
101 #endif // DIAGNOSTIC_CLIENT_LIB_APPL_SRC_DCM_CONVERSATION_CONVERSATION_MANAGER_H
Class to manage all the conversation created from usr request.
void StoreConversationConfig(diag::client::config_parser::DcmClientConfig &config) noexcept
Function to store the dcm client configuration internally.
diag::client::conversation::Conversation & GetDiagnosticClientConversation(std::string_view conversation_name) noexcept
Function to get DM conversation object based on conversation name.
void Shutdown() noexcept
Function to shutdown the ConversationManager.
ConversationManager(diag::client::config_parser::DcmClientConfig config, diag::client::uds_transport::UdsTransportProtocolManager &uds_transport_mgr) noexcept
Constructs an instance of ConversationManager.
void Startup() noexcept
Function to start the ConversationManager.
~ConversationManager() noexcept=default
Destructs an instance of ConversationManager.
std::unordered_map< std::string, ConversationStorage > conversation_map_
Map to store conversation object(dm) along with conversation name.
uds_transport::UdsTransportProtocolManager & uds_transport_mgr_
Store the reference to uds transport manager.