VMware VMware GemFire Native C++ Reference 10.4.3
Loading...
Searching...
No Matches
apache::geode::client::CacheableDate Class Reference

Implement a date object based on epoch of January 1, 1970 00:00:00 GMT that can serve as a distributable key object for caching as well as being a date value. More...

#include <CacheableDate.hpp>

Inherits internal::DataSerializablePrimitive, and apache::geode::client::CacheableKey.

Public Member Functions

 CacheableDate (const duration &value)
 Construct from std::chrono::seconds since POSIX epoch.
 
 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.
 
virtual int32_t hashcode () const override
 Returns a hash code value for this object.
 
virtual int64_t milliseconds () const
 
virtual size_t objectSize () const override
 
virtual bool operator== (const CacheableKey &other) const override
 
std::string toString () const override
 Display this object as 'string', which depends on the implementation in the subclasses.
 

Static Public Member Functions

static std::shared_ptr< CacheableDatecreate ()
 Factory method for creating an instance of CacheableDate.
 
template<class _T >
static std::shared_ptr< CacheableKeycreate (_T value)
 Factory method that creates the key type that matches the type of value.
 
static std::shared_ptr< SerializablecreateDeserializable ()
 creation function for dates.
 

Detailed Description

Implement a date object based on epoch of January 1, 1970 00:00:00 GMT that can serve as a distributable key object for caching as well as being a date value.

Constructor & Destructor Documentation

◆ CacheableDate() [1/3]

apache::geode::client::CacheableDate::CacheableDate ( const time_t  value = 0)
explicit

Constructor, used for deserialization.

◆ CacheableDate() [2/3]

apache::geode::client::CacheableDate::CacheableDate ( const time_point &  value)
explicit

Construct from std::chrono::time_point<std::chrono::system_clock>.

◆ CacheableDate() [3/3]

apache::geode::client::CacheableDate::CacheableDate ( const duration &  value)
explicit

Construct from std::chrono::seconds since POSIX epoch.

Member Function Documentation

◆ create() [1/2]

static std::shared_ptr< CacheableDate > apache::geode::client::CacheableDate::create ( )
inlinestatic

Factory method for creating an instance of CacheableDate.

◆ create() [2/2]

template<class _T >
static std::shared_ptr< CacheableKey > apache::geode::client::CacheableKey::create ( _T  value)
staticinherited

Factory method that creates the key type that matches the type of value.

For user defined derivations of CacheableKey, the method apache::geode::client::CacheableKey::create may be overloaded.

◆ createDeserializable()

static std::shared_ptr< Serializable > apache::geode::client::CacheableDate::createDeserializable ( )
static

creation function for dates.

◆ hashcode()

virtual int32_t apache::geode::client::CacheableDate::hashcode ( ) const
overridevirtual

Returns a hash code value for this object.

The result is the exclusive OR of the two halves of the primitive long value returned by the milliseconds() method.

Returns
the hashcode for this object.

Implements apache::geode::client::CacheableKey.

◆ milliseconds()

virtual int64_t apache::geode::client::CacheableDate::milliseconds ( ) const
virtual
Returns
milliseconds elapsed since January 1, 1970, 00:00:00 GMT.

◆ objectSize()

virtual size_t apache::geode::client::CacheableDate::objectSize ( ) const
inlineoverridevirtual
Returns
the size of the object in bytes

Reimplemented from apache::geode::client::Serializable.

◆ operator==()

virtual bool apache::geode::client::CacheableDate::operator== ( const CacheableKey other) const
overridevirtual
Returns
true if this key matches other.

Implements apache::geode::client::CacheableKey.

◆ toString()

std::string apache::geode::client::CacheableDate::toString ( ) const
overridevirtual

Display this object as 'string', which depends on the implementation in the subclasses.

The default implementation renders the classname.

Reimplemented from apache::geode::client::Serializable.


Apache Geode C++ Cache API Documentation