FastEngine 0.9.3
A multiplayer oriented 2D engine made with Vulkan.
Loading...
Searching...
No Matches
fge::BitBank< TNbytes > Class Template Reference

A class to manage a group of bits. More...

#include <C_bitBank.hpp>

Public Member Functions

void clear ()
 Clear the bank.
 
void set (std::size_t index, bool flag)
 Set a bit to 1 or 0.
 
bool get (std::size_t index) const
 Get the value of a bit.
 
uint8_t getByte (std::size_t index) const
 Get the specified byte.
 
std::size_t getSize () const
 Get the number of bytes in the bank.
 
void pack (fge::net::Packet &pck)
 Pack the bank data into the packet.
 
void unpack (fge::net::Packet &pck)
 Unpack the bank data from the packet.
 

Detailed Description

template<std::size_t TNbytes>
class fge::BitBank< TNbytes >

A class to manage a group of bits.

Template Parameters
TNbytesThe number of bytes in the bank.

Member Function Documentation

◆ clear()

template<std::size_t TNbytes>
void fge::BitBank< TNbytes >::clear ( )

Clear the bank.

This function clear the bank by setting all bits to 0.

◆ get()

template<std::size_t TNbytes>
bool fge::BitBank< TNbytes >::get ( std::size_t index) const
nodiscard

Get the value of a bit.

This function get the value of the bit at the specified index.

Parameters
indexThe index of the bit to get
Returns
The value of the bit or 0 if out of range

◆ getByte()

template<std::size_t TNbytes>
uint8_t fge::BitBank< TNbytes >::getByte ( std::size_t index) const
nodiscard

Get the specified byte.

Parameters
indexThe index of the byte to get
Returns
The wanted byte or 0 if out of range

◆ getSize()

template<std::size_t TNbytes>
std::size_t fge::BitBank< TNbytes >::getSize ( ) const
nodiscard

Get the number of bytes in the bank.

Returns
The number of bytes in the bank

◆ pack()

template<std::size_t TNbytes>
void fge::BitBank< TNbytes >::pack ( fge::net::Packet & pck)

Pack the bank data into the packet.

Parameters
pckThe network packet to pack the bank data into

◆ set()

template<std::size_t TNbytes>
void fge::BitBank< TNbytes >::set ( std::size_t index,
bool flag )

Set a bit to 1 or 0.

This function set the bit at the specified index to 1 or 0.

Parameters
indexThe index of the bit to set
flagThe value to set the bit to

◆ unpack()

template<std::size_t TNbytes>
void fge::BitBank< TNbytes >::unpack ( fge::net::Packet & pck)

Unpack the bank data from the packet.

Parameters
pckThe network packet to unpack the bank data from

The documentation for this class was generated from the following files: