SNode.C
Loading...
Searching...
No Matches
Int_1.cpp
Go to the documentation of this file.
1/*
2 * SNode.C - a slim toolkit for network communication
3 * Copyright (C) Volker Christian <me@vchrist.at>
4 * 2020, 2021, 2022, 2023, 2024, 2025
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include "iot/mqtt-fast/types/Int_1.h"
21
22#ifndef DOXYGEN_SHOULD_SKIP_THIS
23
24#endif // DOXYGEN_SHOULD_SKIP_THIS
25
26namespace iot::mqtt_fast::types {
27
28 Int_1::Int_1(core::socket::SocketContext* socketContext)
29 : iot::mqtt_fast::types::TypeBase(socketContext) {
30 }
31
32 std::size_t Int_1::construct() {
33 const std::size_t consumed = read(buffer + length - needed, needed);
34
35 needed -= consumed;
36 completed = needed == 0;
37
38 return consumed;
39 }
40
41 uint8_t Int_1::getValue() {
42 return *reinterpret_cast<uint8_t*>(buffer);
43 }
44
45 void Int_1::reset() {
46 length = 1;
47 needed = 1;
48
50 }
51
52} // namespace iot::mqtt_fast::types
std::size_t construct() override
Definition Int_1.cpp:32
void reset() override
Definition Int_1.cpp:45
Int_1(core::socket::SocketContext *socketContext=nullptr)
Definition Int_1.cpp:28
TypeBase(core::socket::SocketContext *socketContext)
Definition TypeBase.cpp:30
std::size_t read(char *buf, std::size_t count)
Definition TypeBase.cpp:42