66 lines
1.9 KiB
C++
66 lines
1.9 KiB
C++
/*
|
|
Header BitStreamQueue : Manage message received
|
|
|
|
Copyright (C) 2019 AleaJactaEst
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#ifndef BIT_STREAM_QUEUE_H
|
|
#define BIT_STREAM_QUEUE_H
|
|
|
|
#define SIZE_QUEUE_MESSAGE 6
|
|
|
|
#include "core/reference.h"
|
|
#include "modules/bitstream/bitstream.h"
|
|
|
|
class BitStreamField : public Reference
|
|
{
|
|
GDCLASS(BitStreamField, Reference)
|
|
protected:
|
|
static void _bind_methods();
|
|
private:
|
|
uint32_t _id;
|
|
Ref<BitStream> _msgin;
|
|
public:
|
|
uint32_t get_id() const { return this->_id; }
|
|
Ref<BitStream> get_msgin() { return this->_msgin; }
|
|
void put_id(uint32_t id) { this->_id = id; }
|
|
void put_msgin(const Ref<BitStream> & msgin) { this->_msgin = msgin; }
|
|
};
|
|
|
|
class BitStreamQueue : public Reference
|
|
{
|
|
GDCLASS(BitStreamQueue, Reference)
|
|
protected:
|
|
static void _bind_methods();
|
|
private:
|
|
Vector<Ref<BitStreamField> > _msg;
|
|
public:
|
|
BitStreamQueue();
|
|
~BitStreamQueue();
|
|
|
|
void clear();
|
|
int length();
|
|
bool is_index(uint32_t id);
|
|
int get_index(uint32_t id);
|
|
int put_bitstreamfield(Ref<BitStreamField> data);
|
|
Ref<BitStreamField> get_msg(int index);
|
|
Ref<BitStreamField> get_msg_withid(uint32_t id);
|
|
void erase_index(int index);
|
|
void erase_id(uint32_t id);
|
|
};
|
|
|
|
#endif // BIT_STREAM_QUEUE_H
|