YAMI4 C++
outgoing_message.h
1 // Copyright Maciej Sobczak 2008-2019.
2 // This file is part of YAMI4.
3 //
4 // YAMI4 is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // YAMI4 is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with YAMI4. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef YAMICPP_OUTGOING_MESSAGE_H_INCLUDED
18 #define YAMICPP_OUTGOING_MESSAGE_H_INCLUDED
19 
20 #include "message_state.h"
21 #include <yami4-core/dll.h>
22 #include <cstddef>
23 #include <string>
24 #include <vector>
25 
26 namespace yami
27 {
28 
29 namespace details
30 {
31 struct outgoing_message_info;
32 class outgoing_message_manager;
33 } // namespace details
34 
35 class parameters;
36 
45 {
46 public:
47 
49  typedef long long outgoing_message_id;
50 
55 
57 
58  void reset(details::outgoing_message_manager & manager,
59  details::outgoing_message_info & info);
60 
61  void disown_info_object();
62 
64  message_state get_state() const;
65 
78  message_state get_state(std::size_t & sent_bytes,
79  std::size_t & total_byte_count) const;
80 
88  void wait_for_transmission() const;
89 
100  bool wait_for_transmission(std::size_t relative_timeout) const;
101 
113  bool wait_for_transmission_absolute(unsigned long long timeout) const;
114 
127  void wait_for_completion() const;
128 
139  bool wait_for_completion(std::size_t relative_timeout) const;
140 
152  bool wait_for_completion_absolute(unsigned long long timeout) const;
153 
155  const parameters & get_reply() const;
156 
161  const std::vector<char> & get_raw_reply() const;
162 
170  parameters * extract_reply();
171 
175  const std::string & get_exception_msg() const;
176 
181  outgoing_message_id get_message_id() const;
182 
183 private:
185  void operator=(const outgoing_message &);
186 
187  void clean();
188 
189  details::outgoing_message_manager * manager_;
190  details::outgoing_message_info * info_;
191  bool owner_of_info_;
192 };
193 
194 } // namespace yami
195 
196 #endif // YAMICPP_OUTGOING_MESSAGE_H_INCLUDED
message_state
Outgoing message state.
Definition: message_state.h:24
Collection of message parameters.
Definition: parameters.h:71
Namespace devoted to everything related to YAMI4.
Definition: activity_statistics_monitor.cpp:27
long long outgoing_message_id
Outgoing message identifier type.
Definition: outgoing_message.h:49
Outgoing message.
Definition: outgoing_message.h:44