YAMI4 C++
incoming_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_INCOMING_MESSAGE_H_INCLUDED
18 #define YAMICPP_INCOMING_MESSAGE_H_INCLUDED
19 
20 #include "parameters.h"
21 #include <yami4-core/dll.h>
22 #include <string>
23 #include <vector>
24 
25 namespace yami
26 {
27 
28 namespace details
29 {
30 class agent_impl;
31 struct incoming_message_info;
32 } // namespace details
33 
49 {
50 public:
51  incoming_message(details::agent_impl & agent,
52  details::incoming_message_info & info);
53 
62 
64 
69  const std::string & get_source() const;
70 
72  const std::string & get_object_name() const;
73 
75  const std::string & get_message_name() const;
76 
78  const parameters & get_parameters() const;
79 
87  parameters * extract_parameters();
88 
93  const std::vector<char> & get_raw_content() const;
94 
102  void reply(const serializable & body = parameters(),
103  std::size_t priority = 0);
104 
113  void reject(const std::string & reason = std::string(),
114  std::size_t priority = 0);
115 
116 private:
118  void operator=(const incoming_message &);
119 
120  details::agent_impl & agent_;
121  std::string source_;
122  std::string object_name_;
123  std::string message_name_;
124  long long message_id_;
125  parameters * params_;
126  std::vector<char> * raw_buffer_;
127  bool already_used_;
128 };
129 
130 } // namespace yami
131 
132 #endif // YAMICPP_INCOMING_MESSAGE_H_INCLUDED
Message broker.
Definition: agent.h:56
Incoming message.
Definition: incoming_message.h:48
Collection of message parameters.
Definition: parameters.h:71
Namespace devoted to everything related to YAMI4.
Definition: activity_statistics_monitor.cpp:27
Common interface for serializable data source.
Definition: serializable.h:32