20 #ifndef CO_DISTRIBUTABLE_H 21 #define CO_DISTRIBUTABLE_H 23 #include <co/dataIStream.h> 24 #include <co/dataOStream.h> 25 #include <co/object.h> 26 #include <servus/serializable.h> 38 template <
class T,
class S = Object,
typename... Args>
60 bool isDirty() const final {
return S::isDirty() || _dirty; }
62 uint128_t
commit(
const uint32_t incarnation = CO_COMMIT_NEXT) final
64 const uint128_t& version = S::commit(incarnation);
78 typename S::ChangeType getChangeType()
const final {
return S::INSTANCE; }
81 S::getInstanceData(os);
82 const auto& data = T::toBinary();
83 os << data.size << Array<const void>(data.ptr.get(), data.size);
88 S::applyInstanceData(is);
89 const size_t size = is.
read<
size_t>();
97 inline std::ostream& operator<<(std::ostream& os,
100 return os << static_cast<const T&>(object);
Distributable Collage object for any servus::Serializable object.
A std::ostream-like interface for object serialization.
Object-oriented network library.
CO_API const void * getRemainingBuffer(const uint64_t size)
Distributable(const Distributable &rhs)
Copy-construct a distributable object.
Distributable(Args...args)
Construct a new distributable object.
void notifyChanged() override
Call whenever the object has been modified so it can be distributed.
A std::istream-like input data stream for binary data.
bool isDirty() const final
uint128_t commit(const uint32_t incarnation=CO_COMMIT_NEXT) final