20#ifndef GEODE_CACHEABLEDATE_H_ 
   21#define GEODE_CACHEABLEDATE_H_ 
   28#include "CacheableString.hpp" 
   29#include "ExceptionTypes.hpp" 
   30#include "internal/geode_globals.hpp" 
   44    : 
public internal::DataSerializablePrimitive,
 
   54  typedef std::chrono::system_clock clock;
 
   55  typedef std::chrono::time_point<clock> time_point;
 
   56  typedef std::chrono::milliseconds duration;
 
   76  void toData(
DataOutput& output) const override;
 
   78  virtual 
void fromData(
DataInput& input) override;
 
   85  virtual DSCode getDsCode() const override;
 
   88  virtual 
size_t objectSize()
 const override { 
return sizeof(
CacheableDate); }
 
  104  explicit operator time_t()
 const { 
return m_timevalue / 1000; }
 
  105  explicit operator time_point()
 const {
 
  106    return clock::from_time_t(0) + duration(m_timevalue);
 
  108  explicit operator duration()
 const { 
return duration(m_timevalue); }
 
  113  static std::shared_ptr<CacheableDate> 
create() {
 
  114    return std::make_shared<CacheableDate>();
 
  117  static std::shared_ptr<CacheableDate> create(
const time_t& value) {
 
  118    return std::make_shared<CacheableDate>(value);
 
  121  static std::shared_ptr<CacheableDate> create(
const time_point& value) {
 
  122    return std::make_shared<CacheableDate>(value);
 
  125  static std::shared_ptr<CacheableDate> create(
const duration& value) {
 
  126    return std::make_shared<CacheableDate>(value);
 
  134    CacheableDate::time_point value) {
 
  140    CacheableDate::time_point value) {
 
Implement a date object based on epoch of January 1, 1970 00:00:00 GMT that can serve as a distributa...
Definition: CacheableDate.hpp:45
 
std::string toString() const override
Display this object as 'string', which depends on the implementation in the subclasses.
 
virtual bool operator==(const CacheableKey &other) const override
 
CacheableDate(const time_point &value)
Construct from std::chrono::time_point<std::chrono::system_clock>.
 
CacheableDate(const time_t value=0)
Constructor, used for deserialization.
 
CacheableDate(const duration &value)
Construct from std::chrono::seconds since POSIX epoch.
 
static std::shared_ptr< CacheableDate > create()
Factory method for creating an instance of CacheableDate.
Definition: CacheableDate.hpp:113
 
virtual int64_t milliseconds() const
 
virtual int32_t hashcode() const override
Returns a hash code value for this object.
 
Represents a cacheable key.
Definition: CacheableKey.hpp:40
 
static std::shared_ptr< CacheableKey > create(_T value)
Factory method that creates the key type that matches the type of value.
 
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
 
This base class is the superclass of all user objects in the cache that can be serialized.
Definition: Serializable.hpp:53
 
static std::shared_ptr< Serializable > create(_T value)
Factory method that creates the Serializable object that matches the type of value.