20 #ifndef CO_DISTRIBUTABLE_H
21 #define CO_DISTRIBUTABLE_H
23 #include <co/object.h>
24 #include <co/dataIStream.h>
25 #include <co/dataOStream.h>
26 #include <servus/serializable.h>
47 : T( rhs ),
Object( rhs ), _dirty( false ) {}
52 bool isDirty() const final {
return _dirty; }
55 uint128_t
commit(
const uint32_t incarnation = CO_COMMIT_NEXT ) final
70 const auto& data = T::toBinary();
71 os << data.size << Array< const void >( data.ptr.get(), data.size );
76 const size_t size = is.read<
size_t >();
77 T::fromBinary( is.getRemainingBuffer( size ), size );
83 template<
class T >
inline
84 std::ostream& operator << ( std::ostream& os, const Distributable< T >& object )
86 return os << static_cast< const T& >( object );
virtual CO_API uint128_t commit(const uint32_t incarnation=CO_COMMIT_NEXT)
Commit a new version of this object.
ChangeType
Object change handling characteristics, see Programming Guide.
Distributable Collage object for any servus::Serializable object.
A std::ostream-like interface for object serialization.
uint128_t commit(const uint32_t incarnation=CO_COMMIT_NEXT) final
Object-oriented network library.
void notifyChanged() final
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
Distributable(const Distributable &rhs)
Copy-construct a distributable object.
Distributable()
Construct a new distributable object.