| D++ (DPP) C++ Discord API Bot Library

Search
Loading...
Searching...
No Matches
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:
[legend]
Collaboration diagram for dpp::managed:
[legend]

## Public Member Functions

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

## 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.

## 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

  nid | ID to set

## ◆ managed() [3/4]

dpp::managed::managed | ( | const managed & | rhs | ) |

default

Copy constructor.

Parameters

  rhs | Object to copy

## ◆ managed() [4/4]

dpp::managed::managed | ( | managed && | rhs | ) |

default

Move constructor.

Effectively equivalent to copy constructor

Parameters

  rhs | Object to move from

## ◆ ~managed()

virtual dpp::managed::~managed | ( |  | ) |

virtual default

Destroy the managed object.

## Member Function Documentation

## ◆ get_creation_time()

double dpp::managed::get_creation_time | ( |  | ) | const

inline constexpr noexcept

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!=()

bool dpp::managed::operator!= | ( | const managed & | other | ) | const

inline constexpr noexcept

Comparison operator for comparing two managed objects by id.

Parameters

  other | Other 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

  rhs | Object to copy

## ◆ operator=() [2/2]

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

default

Move assignment operator.

Parameters

  rhs | Object to move from

## ◆ operator==()

bool dpp::managed::operator== | ( | const managed & | other | ) | const

inline constexpr noexcept

Comparison operator for comparing two managed objects by id.

Parameters

  other | Other 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 9.0.13 D++ Library version 9.0.12 D++ Library version 9.0.11 D++ Library version 9.0.10 D++ Library version 9.0.9 D++ Library version 9.0.8 D++ Library version 9.0.7 D++ Library version 9.0.6 D++ Library version 9.0.5 D++ Library version 9.0.4 D++ Library version 9.0.3 D++ Library version 9.0.2 D++ Library version 9.0.1 D++ Library version 9.0.0 D++ Library version 1.0.2 D++ Library version 1.0.1 D++ Library version 1.0.0