20#ifndef GEODE_CACHEABLEENUM_H_
21#define GEODE_CACHEABLEENUM_H_
28#include "CacheableString.hpp"
29#include "internal/geode_base.hpp"
54 :
public internal::DataSerializablePrimitive,
57 std::string m_enumClassName;
58 std::string m_enumName;
64 : m_enumClassName(
nullptr),
68 inline CacheableEnum(std::string enumClassName, std::string enumName,
70 : m_enumClassName(std::move(enumClassName)),
71 m_enumName(std::move(enumName)),
82 return std::make_shared<CacheableEnum>();
85 void toData(
DataOutput& output)
const override;
87 virtual void fromData(
DataInput& input)
override;
91 size += m_enumClassName.length();
92 size += m_enumName.length();
96 virtual DSCode getDsCode()
const override {
return DSCode::CacheableEnum; }
101 virtual std::string
toString()
const override {
return "CacheableEnum"; }
113 static std::shared_ptr<CacheableEnum>
create(std::string enumClassName,
114 std::string enumName,
116 return std::make_shared<CacheableEnum>(enumClassName, enumName, ordinal);
129 virtual int32_t
hashcode()
const override {
return m_hashcode; }
135 void calculateHashcode();
Since C++ enums cannot be directly passed as a parameter to PdxWriter's writeObject and PdxReader's r...
Definition: CacheableEnum.hpp:55
static std::shared_ptr< Serializable > createDeserializable()
creation function for enum.
Definition: CacheableEnum.hpp:81
int32_t getEnumOrdinal() const
Definition: CacheableEnum.hpp:126
virtual bool operator==(const CacheableKey &other) const override
const std::string & getEnumName() const
Definition: CacheableEnum.hpp:123
virtual size_t objectSize() const override
return the size in bytes of the instance being serialized.
Definition: CacheableEnum.hpp:89
const std::string & getEnumClassName() const
Definition: CacheableEnum.hpp:120
virtual int32_t hashcode() const override
Definition: CacheableEnum.hpp:129
virtual std::string toString() const override
Display this object as c string.
Definition: CacheableEnum.hpp:101
static std::shared_ptr< CacheableEnum > create(std::string enumClassName, std::string enumName, int32_t ordinal)
Factory method for creating an instance of CacheableEnum.
Definition: CacheableEnum.hpp:113
Represents a cacheable key.
Definition: CacheableKey.hpp:40
Provide operations for reading primitive data values, byte arrays, strings, Serializable objects from...
Definition: DataInput.hpp:59
Provide operations for writing primitive data values, byte arrays, strings, Serializable objects to a...
Definition: DataOutput.hpp:48