3es  0.7
3esresource.h
1 //
2 // author: Kazys Stepanas
3 //
4 #ifndef _3ESRESOURCE_H_
5 #define _3ESRESOURCE_H_
6 
7 #include "3es-core.h"
8 
9 #include <cstdint>
10 
11 namespace tes
12 {
13  class PacketWriter;
14  struct TransferProgress;
15 
34  class _3es_coreAPI Resource
35  {
36  public:
38  virtual ~Resource();
39 
42  virtual uint32_t id() const = 0;
43 
47  virtual uint16_t typeId() const = 0;
48 
50  inline uint64_t uniqueKey() const { return ((uint64_t)typeId() << 32) | (uint64_t)id(); }
51 
57  virtual Resource *clone() const = 0;
58 
66  virtual int create(PacketWriter &packet) const = 0;
67 
75  virtual int destroy(PacketWriter &packet) const = 0;
76 
99  virtual int transfer(PacketWriter &packet, int byteLimit, TransferProgress &progress) const = 0;
100  };
101 }
102 
103 #endif // _3ESRESOURCE_H_
uint64_t uniqueKey() const
Returns a unique key for this resource, based on the typeId() and id().
Definition: 3esresource.h:50
Definition: 3esbounds.h:13
A structure tracking progress of a data transfer.
Definition: 3estransferprogress.h:18
The Resource base class defines an interface for any resource used by Shape objects such as MeshSet...
Definition: 3esresource.h:34
A utility class for writing payload data to a PacketHeader.
Definition: 3espacketwriter.h:34