YAMI4 Core
raw_buffer_data_source.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 YAMICORE_RAW_BUFFER_DATA_SOURCE_H_INCLUDED
18 #define YAMICORE_RAW_BUFFER_DATA_SOURCE_H_INCLUDED
19 
20 #include "core.h"
21 #include "dll.h"
22 #include "serializable.h"
23 
24 namespace yami
25 {
26 
27 namespace core
28 {
29 
38 {
39 public:
40 
56  raw_buffer_data_source(const char * * buffers,
57  const std::size_t * buffer_sizes,
58  std::size_t num_of_buffers);
59 
65  raw_buffer_data_source(const char * buffer, std::size_t buffer_size);
66 
76  virtual result get_serialize_buffer_size(std::size_t & size) const;
77 
98  virtual result serialize(char * * target_buffers,
99  const std::size_t * target_buffer_sizes,
100  std::size_t num_of_target_buffers) const;
101 
102 private:
103 
105  void operator=(const raw_buffer_data_source &);
106 
107  const char * * buffers_;
108  const std::size_t * buffer_sizes_;
109  std::size_t num_of_buffers_;
110 
111  // helpers for single buffer case
112  const char * single_buffer[1];
113  std::size_t single_buffer_size[1];
114 };
115 
116 } // namespace core
117 
118 } // namespace yami
119 
120 #endif // YAMICORE_RAW_BUFFER_DATA_SOURCE_H_INCLUDED
Serializable wrapper for the raw binary data.
Definition: raw_buffer_data_source.h:37
Namespace devoted for everything related to YAMI4.
Definition: agent.h:25
Common interface for serializable data source.
Definition: serializable.h:35
result
General type for reporting success and error states.
Definition: core.h:32