Skip to content

Commit

Permalink
Add virtual destructors to object interfaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocaster committed Nov 7, 2015
1 parent 5a9cf98 commit 20c9616
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/Common/object_interfaces.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,65 @@
////////////////////////////////////////////////////////////////////////////

#pragma once
#include "xrCore/xrCore.h"

class NET_Packet;
class IReader;
class IWriter;

class IPureDestroyableObject {
public:
virtual void destroy() = 0;
virtual ~IPureDestroyableObject() = 0;

virtual void destroy() = 0;
};

IC IPureDestroyableObject::~IPureDestroyableObject() {}

template <typename _storage_type>
class IPureLoadableObject {
public:
virtual ~IPureLoadableObject() = 0;
virtual void load(_storage_type &storage) = 0;
};

template <typename _storage_type>
IC IPureLoadableObject<_storage_type>::~IPureLoadableObject() {}

template <typename _storage_type>
class IPureSavableObject {
public:
virtual ~IPureSavableObject() = 0;
virtual void save(_storage_type &storage) = 0;
};

template <typename _storage_type>
IC IPureSavableObject<_storage_type>::~IPureSavableObject() {}

template <typename _storage_type_load, typename _storage_type_save>
class IPureSerializeObject : public IPureLoadableObject<_storage_type_load>, public IPureSavableObject<_storage_type_save> {
public:
virtual ~IPureSerializeObject() = 0;
};

template <typename _storage_type_load, typename _storage_type_save>
IC IPureSerializeObject<typename _storage_type_load, typename _storage_type_save>::~IPureSerializeObject() {}

class IPureServerObject : public IPureSerializeObject<IReader,IWriter> {
public:
virtual ~IPureServerObject() = 0;
virtual void STATE_Write (NET_Packet &tNetPacket) = 0;
virtual void STATE_Read (NET_Packet &tNetPacket, u16 size) = 0;
virtual void UPDATE_Write(NET_Packet &tNetPacket) = 0;
virtual void UPDATE_Read (NET_Packet &tNetPacket) = 0;
};

IC IPureServerObject::~IPureServerObject() {}

class IPureSchedulableObject {
public:
virtual ~IPureSchedulableObject() = 0;
virtual void update () = 0;
};

IC IPureSchedulableObject::~IPureSchedulableObject() {}

0 comments on commit 20c9616

Please sign in to comment.