Started work on generic network ordered list object
This commit is contained in:
parent
ed4810e6ee
commit
2f7ebfe083
8 changed files with 439 additions and 130 deletions
33
include/Helpers/NetworkingObjects/NetObjPtr.decl.hpp
Normal file
33
include/Helpers/NetworkingObjects/NetObjPtr.decl.hpp
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
#pragma once
|
||||
#include "NetObjIDGenerator.hpp"
|
||||
#include <type_traits>
|
||||
|
||||
namespace NetworkingObjects {
|
||||
class NetObjManager;
|
||||
template <typename T> class NetObjPtr {
|
||||
public:
|
||||
NetObjPtr();
|
||||
NetObjPtr(const NetObjPtr& other);
|
||||
NetObjPtr& operator=(const NetObjPtr& other);
|
||||
~NetObjPtr();
|
||||
template <typename S> NetObjPtr<S> cast() const;
|
||||
NetObjManager* get_obj_man() const;
|
||||
NetObjID get_net_id() const;
|
||||
T* get() const;
|
||||
std::add_lvalue_reference_t<T> operator*() const requires(!std::is_void_v<T>);
|
||||
T* operator->() const;
|
||||
operator bool() const;
|
||||
std::strong_ordering operator<=>(const NetObjPtr<T>& rhs) const;
|
||||
void send_client_update(const std::string& channel, std::function<void(const NetObjPtr<T>&, cereal::PortableBinaryOutputArchive&)> sendUpdateFunc) const;
|
||||
void send_server_update_to_all_clients(const std::string& channel, std::function<void(const NetObjPtr<T>&, cereal::PortableBinaryOutputArchive&)> sendUpdateFunc) const;
|
||||
void write_create_message(cereal::PortableBinaryOutputArchive& a) const;
|
||||
private:
|
||||
friend class NetObjManager;
|
||||
template <typename S> friend class NetObjPtr;
|
||||
|
||||
NetObjPtr(NetObjManager* initObjMan, NetObjID initID, const std::shared_ptr<T>& initPtr);
|
||||
NetObjManager* objMan;
|
||||
NetObjID id;
|
||||
std::shared_ptr<T> sharedPtr;
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue