Network type for the TaskHandler.
More...
#include <C_task.hpp>
|
enum | SyncType : uint8_t { SYNC_CHECKSUM
, SYNC_FULL
} |
|
|
| NetworkTypeTasks (fge::TaskHandler *source) |
|
void const * | getSource () const override |
| Get the source pointer that have been used to create this network type.
|
|
bool | applyData (fge::net::Packet const &pck) override |
| Apply the data packed by the same network type from a server.
|
|
void | packData (fge::net::Packet &pck, fge::net::Identity const &id) override |
| Pack the data into a packet and reset the modification flag of the identity.
|
|
void | packData (fge::net::Packet &pck) override |
| Pack the data without any client identity.
|
|
bool | check () const override |
| Check if the value have been modified.
|
|
void | forceCheck () override |
| Force the value to be modified (even if it is not)
|
|
void | forceUncheck () override |
| Remove the forced modification of the value.
|
|
virtual bool | clientsCheckup (fge::net::ClientList const &clients, bool force) |
| Do a clients checkup with the specified client list.
|
|
virtual bool | checkClient (fge::net::Identity const &id) const |
| Check if the modification flag is set for the specified client identity.
|
|
virtual void | forceCheckClient (fge::net::Identity const &id) |
| Force the modification flag to be set for the specified client identity.
|
|
virtual void | forceUncheckClient (fge::net::Identity const &id) |
| Reset the modification flag for the specified client identity.
|
|
virtual void | requireExplicitUpdateClient (fge::net::Identity const &id) |
| Ask for an explicit update of the value for the specified client identity.
|
|
bool | isForced () const |
| Check if the value is forced to be modified.
|
|
void | clearExplicitUpdateFlag () |
|
void | needExplicitUpdate () |
| Tell that this network type need an explicit update from the server.
|
|
bool | isNeedingExplicitUpdate () const |
|
void | clearWaitingUpdateFlag () |
|
void | waitingUpdate () |
| Tell that this network type is waiting for an update.
|
|
bool | isWaitingUpdate () const |
|
std::chrono::microseconds | getLastUpdateTime () const |
|
void | setLastUpdateTime () |
|
|
virtual void | createClientCustomData (void *&ptr) const |
|
virtual void | destroyClientCustomData (void *&ptr) const |
|
virtual void | applyClientCustomData (void *&ptr) const |
|
|
fge::net::NetworkPerClientModificationTable | _g_tableId |
|
bool | _g_needExplicitUpdate {false} |
|
bool | _g_waitingUpdate {false} |
|
bool | _g_force {false} |
|
std::chrono::microseconds | _g_lastUpdateTime {0} |
|
Network type for the TaskHandler.
This class is used to synchronize the tasks of an object.
- See also
- TaskHandler
◆ applyData()
Apply the data packed by the same network type from a server.
- Parameters
-
pck | The packet containing the data |
- Returns
- true if the data has been applied, false otherwise
Implements fge::net::NetworkTypeBase.
◆ check()
bool fge::NetworkTypeTasks::check |
( |
| ) |
const |
|
overridevirtual |
Check if the value have been modified.
- Returns
- true if the value have been modified, false otherwise
Implements fge::net::NetworkTypeBase.
◆ checkClient()
virtual bool fge::net::NetworkTypeBase::checkClient |
( |
fge::net::Identity const & | id | ) |
const |
|
virtualinherited |
Check if the modification flag is set for the specified client identity.
- Parameters
-
id | The client identity to check |
- Returns
- true if the modification flag is set, false otherwise
Reimplemented in fge::net::NetworkTypeScene.
◆ clientsCheckup()
virtual bool fge::net::NetworkTypeBase::clientsCheckup |
( |
fge::net::ClientList const & | clients, |
|
|
bool | force ) |
|
virtualinherited |
Do a clients checkup with the specified client list.
The first step of the checkup is to add client in a table if they are not already in it and remove clients that are not in the list anymore.
Then the checkup check if the value have been modified and apply a modification flag to all clients.
- Parameters
-
clients | The client list to checkup with |
force | true to force the checkup from the complete list of clients |
- Returns
- true if there was a change in the value, false otherwise
Reimplemented in fge::net::NetworkTypeScene.
◆ forceCheck()
void fge::NetworkTypeTasks::forceCheck |
( |
| ) |
|
|
overridevirtual |
◆ forceCheckClient()
◆ forceUncheck()
void fge::NetworkTypeTasks::forceUncheck |
( |
| ) |
|
|
overridevirtual |
◆ forceUncheckClient()
virtual void fge::net::NetworkTypeBase::forceUncheckClient |
( |
fge::net::Identity const & | id | ) |
|
|
virtualinherited |
◆ getSource()
void const * fge::NetworkTypeTasks::getSource |
( |
| ) |
const |
|
overridevirtual |
Get the source pointer that have been used to create this network type.
- Returns
- A pointer to the source object
Implements fge::net::NetworkTypeBase.
◆ isForced()
bool fge::net::NetworkTypeBase::isForced |
( |
| ) |
const |
|
nodiscardinherited |
Check if the value is forced to be modified.
- Returns
- true if the value is forced to be modified, false otherwise
◆ needExplicitUpdate()
void fge::net::NetworkTypeBase::needExplicitUpdate |
( |
| ) |
|
|
inherited |
Tell that this network type need an explicit update from the server.
◆ packData() [1/2]
Pack the data without any client identity.
- Parameters
-
pck | The packet to pack the data into |
Implements fge::net::NetworkTypeBase.
◆ packData() [2/2]
Pack the data into a packet and reset the modification flag of the identity.
- Parameters
-
pck | The packet to pack the data into |
id | The identity of the client to pack the data for |
Implements fge::net::NetworkTypeBase.
◆ requireExplicitUpdateClient()
virtual void fge::net::NetworkTypeBase::requireExplicitUpdateClient |
( |
fge::net::Identity const & | id | ) |
|
|
virtualinherited |
Ask for an explicit update of the value for the specified client identity.
A network type can discard the explicit update if it is not necessary or unimplemented.
- Parameters
-
id | The client identity to ask for an explicit update |
◆ waitingUpdate()
void fge::net::NetworkTypeBase::waitingUpdate |
( |
| ) |
|
|
inherited |
Tell that this network type is waiting for an update.
When a network type is waiting for an update, it will wait for the next update to be applied until a certain delay (FGE_NET_WAITING_UPDATE_DELAY). After this delay, the network type will automatically request an explicit update.
When this method is called, the last update time is reset only if the network type is not already waiting.
- See also
- setLastUpdateTime()
◆ _onApplied
Callback called when the value have been applied.
The documentation for this class was generated from the following file: