D++ (DPP)
C++ Discord API Bot Library
dpp::managed Class Reference

The managed class is the base class for various types that can be stored in a cache that are identified by a dpp::snowflake id. More...

#include <managed.h>

+ Inheritance diagram for dpp::managed:
+ Collaboration diagram for dpp::managed:

Public Member Functions

 managed ()=default
 Constructor, initialises id to 0. More...
 
 managed (const snowflake nid)
 Constructor, initialises ID. More...
 
 managed (const managed &rhs)=default
 Copy constructor. More...
 
 managed (managed &&rhs)=default
 Move constructor. More...
 
virtual ~managed ()=default
 Destroy the managed object. More...
 
managedoperator= (const managed &rhs)=default
 Copy assignment operator. More...
 
managedoperator= (managed &&rhs)=default
 Move assignment operator. More...
 
constexpr double get_creation_time () const noexcept
 Get the creation time of this object according to Discord. More...
 
constexpr bool operator== (const managed &other) const noexcept
 Comparison operator for comparing two managed objects by id. More...
 
constexpr bool operator!= (const managed &other) const noexcept
 Comparison operator for comparing two managed objects by id. More...
 

Public Attributes

snowflake id = {}
 Unique ID of object set by Discord. This value contains a timestamp, worker ID, internal server ID, and an incrementing value. Only the timestamp is relevant to us as useful metadata. More...
 

Detailed Description

The managed class is the base class for various types that can be stored in a cache that are identified by a dpp::snowflake id.

Constructor & Destructor Documentation

◆ managed() [1/4]

dpp::managed::managed ( )
default

Constructor, initialises id to 0.

◆ managed() [2/4]

dpp::managed::managed ( const snowflake  nid)
inline

Constructor, initialises ID.

Parameters
nidID to set

◆ managed() [3/4]

dpp::managed::managed ( const managed rhs)
default

Copy constructor.

Parameters
rhsObject to copy

◆ managed() [4/4]

dpp::managed::managed ( managed &&  rhs)
default

Move constructor.

Effectively equivalent to copy constructor

Parameters
rhsObject to move from

◆ ~managed()

virtual dpp::managed::~managed ( )
virtualdefault

Destroy the managed object.

Member Function Documentation

◆ get_creation_time()

constexpr double dpp::managed::get_creation_time ( ) const
inlineconstexprnoexcept

Get the creation time of this object according to Discord.

Returns
double creation time inferred from the snowflake ID. The minimum possible value is the first second of 2015.

◆ operator!=()

constexpr bool dpp::managed::operator!= ( const managed other) const
inlineconstexprnoexcept

Comparison operator for comparing two managed objects by id.

Parameters
otherOther object to compare against
Returns
true objects are not the same id
false objects are the same id

◆ operator=() [1/2]

managed & dpp::managed::operator= ( const managed rhs)
default

Copy assignment operator.

Parameters
rhsObject to copy

◆ operator=() [2/2]

managed & dpp::managed::operator= ( managed &&  rhs)
default

Move assignment operator.

Parameters
rhsObject to move from

◆ operator==()

constexpr bool dpp::managed::operator== ( const managed other) const
inlineconstexprnoexcept

Comparison operator for comparing two managed objects by id.

Parameters
otherOther object to compare against
Returns
true objects are the same id
false objects are not the same id

Member Data Documentation

◆ id

snowflake dpp::managed::id = {}

Unique ID of object set by Discord. This value contains a timestamp, worker ID, internal server ID, and an incrementing value. Only the timestamp is relevant to us as useful metadata.

D++ Library version 10.0.31D++ Library version 10.0.30D++ Library version 10.0.29D++ Library version 10.0.28D++ Library version 10.0.27D++ Library version 10.0.26D++ Library version 10.0.25D++ Library version 10.0.24D++ Library version 10.0.23D++ Library version 10.0.22D++ Library version 10.0.21D++ Library version 10.0.20D++ Library version 10.0.19D++ Library version 10.0.18D++ Library version 10.0.17D++ Library version 10.0.16D++ Library version 10.0.15D++ Library version 10.0.14D++ Library version 10.0.13D++ Library version 10.0.12D++ Library version 10.0.11D++ Library version 10.0.10D++ Library version 10.0.9D++ Library version 10.0.8D++ Library version 10.0.7D++ Library version 10.0.6D++ Library version 10.0.5D++ Library version 10.0.4D++ Library version 10.0.3D++ Library version 10.0.2D++ Library version 10.0.1D++ Library version 10.0.0D++ Library version 9.0.19D++ Library version 9.0.18D++ Library version 9.0.17D++ Library version 9.0.16D++ Library version 9.0.15D++ Library version 9.0.14D++ Library version 9.0.13D++ Library version 9.0.12D++ Library version 9.0.11D++ Library version 9.0.10D++ Library version 9.0.9D++ Library version 9.0.8D++ Library version 9.0.7D++ Library version 9.0.6D++ Library version 9.0.5D++ Library version 9.0.4D++ Library version 9.0.3D++ Library version 9.0.2D++ Library version 9.0.1D++ Library version 9.0.0D++ Library version 1.0.2D++ Library version 1.0.1D++ Library version 1.0.0