Double ended buffer combining vector and stream-like interfaces. * * >> and << read and write unformatted data using the above serialization templates. * Fills with data in linear time; some stringstream implementations take N^2 time. */
| 145 | * Fills with data in linear time; some stringstream implementations take N^2 time. |
| 146 | */ |
| 147 | class CDataStream |
| 148 | { |
| 149 | protected: |
| 150 | typedef CSerializeData vector_type; |
| 151 | vector_type vch; |
| 152 | unsigned int nReadPos; |
| 153 | |
| 154 | int nType; |
| 155 | int nVersion; |
| 156 | public: |
| 157 | |
| 158 | typedef vector_type::allocator_type allocator_type; |
| 159 | typedef vector_type::size_type size_type; |
| 160 | typedef vector_type::difference_type difference_type; |
| 161 | typedef vector_type::reference reference; |
| 162 | typedef vector_type::const_reference const_reference; |
| 163 | typedef vector_type::value_type value_type; |
| 164 | typedef vector_type::iterator iterator; |
| 165 | typedef vector_type::const_iterator const_iterator; |
| 166 | typedef vector_type::reverse_iterator reverse_iterator; |
| 167 | |
| 168 | explicit CDataStream(int nTypeIn, int nVersionIn) |
| 169 | { |
| 170 | Init(nTypeIn, nVersionIn); |
| 171 | } |
| 172 | |
| 173 | CDataStream(const_iterator pbegin, const_iterator pend, int nTypeIn, int nVersionIn) : vch(pbegin, pend) |
| 174 | { |
| 175 | Init(nTypeIn, nVersionIn); |
| 176 | } |
| 177 | |
| 178 | CDataStream(const char* pbegin, const char* pend, int nTypeIn, int nVersionIn) : vch(pbegin, pend) |
| 179 | { |
| 180 | Init(nTypeIn, nVersionIn); |
| 181 | } |
| 182 | |
| 183 | CDataStream(const vector_type& vchIn, int nTypeIn, int nVersionIn) : vch(vchIn.begin(), vchIn.end()) |
| 184 | { |
| 185 | Init(nTypeIn, nVersionIn); |
| 186 | } |
| 187 | |
| 188 | CDataStream(const std::vector<char>& vchIn, int nTypeIn, int nVersionIn) : vch(vchIn.begin(), vchIn.end()) |
| 189 | { |
| 190 | Init(nTypeIn, nVersionIn); |
| 191 | } |
| 192 | |
| 193 | CDataStream(const std::vector<unsigned char>& vchIn, int nTypeIn, int nVersionIn) : vch(vchIn.begin(), vchIn.end()) |
| 194 | { |
| 195 | Init(nTypeIn, nVersionIn); |
| 196 | } |
| 197 | |
| 198 | template <typename... Args> |
| 199 | CDataStream(int nTypeIn, int nVersionIn, Args&&... args) |
| 200 | { |
| 201 | Init(nTypeIn, nVersionIn); |
| 202 | ::SerializeMany(*this, std::forward<Args>(args)...); |
| 203 | } |
| 204 |
nothing calls this directly
no test coverage detected