Public Types | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
art::ScheduleID Class Reference

#include <ScheduleID.h>

Public Types

using id_type = uint16_t
 
using size_type = id_type
 

Public Member Functions

constexpr ScheduleID () noexcept=default
 
 ScheduleID (id_type id)
 
 ScheduleID (ScheduleID const &) noexcept=default
 
 ScheduleID (ScheduleID &&) noexcept=default
 
ScheduleIDoperator= (ScheduleID const &) noexcept=default
 
ScheduleIDoperator= (ScheduleID &&) noexcept=default
 
constexpr bool isValid () const noexcept
 
constexpr id_type id () const noexcept
 
ScheduleID next () const
 
bool operator== (ScheduleID const &other) const noexcept
 
bool operator< (ScheduleID const &other) const noexcept
 

Static Public Member Functions

static constexpr ScheduleID first ()
 
static constexpr ScheduleID last ()
 

Private Types

enum  PremadeTypeFlag { PremadeTypeFlag::First, PremadeTypeFlag::Last }
 

Private Member Functions

constexpr ScheduleID (PremadeTypeFlag flag)
 

Static Private Member Functions

static constexpr id_type invalid_id_ () noexcept
 
static constexpr id_type min_id_ () noexcept
 
static constexpr id_type max_id_ () noexcept
 

Private Attributes

id_type id_ {invalid_id_()}
 

Friends

template<typename T >
class PerScheduleContainer
 

Detailed Description

Definition at line 17 of file ScheduleID.h.

Member Typedef Documentation

using art::ScheduleID::id_type = uint16_t

Definition at line 22 of file ScheduleID.h.

Definition at line 25 of file ScheduleID.h.

Member Enumeration Documentation

Enumerator
First 
Last 

Definition at line 28 of file ScheduleID.h.

28 { First, Last };

Constructor & Destructor Documentation

constexpr art::ScheduleID::ScheduleID ( )
defaultnoexcept
art::ScheduleID::ScheduleID ( id_type  id)
explicit

Definition at line 11 of file ScheduleID.cc.

12  {
13  // No need to test against min_id_() since that is the smallest
14  // possible value already.
15  if (id > max_id_()) {
16  // Somebody passed us invalid_id_().
17  throw out_of_range("ScheduleID: Invalid initializer.");
18  }
19  id_ = id;
20  }
constexpr id_type id() const noexcept
Definition: ScheduleID.h:77
static constexpr id_type max_id_() noexcept
Definition: ScheduleID.h:42
art::ScheduleID::ScheduleID ( ScheduleID const &  )
defaultnoexcept
art::ScheduleID::ScheduleID ( ScheduleID &&  )
defaultnoexcept
constexpr art::ScheduleID::ScheduleID ( PremadeTypeFlag  flag)
inlineprivate

Definition at line 88 of file ScheduleID.h.

89  : id_{(flag == PremadeTypeFlag::First) ? min_id_() : max_id_()}
90  {}
static constexpr id_type max_id_() noexcept
Definition: ScheduleID.h:42
static constexpr id_type min_id_() noexcept
Definition: ScheduleID.h:37

Member Function Documentation

static constexpr ScheduleID art::ScheduleID::first ( )
inlinestatic

Definition at line 50 of file ScheduleID.h.

51  {
53  }
constexpr ScheduleID() noexcept=default
constexpr id_type art::ScheduleID::id ( ) const
inlinenoexcept

Definition at line 77 of file ScheduleID.h.

78  {
79  return id_;
80  }
static constexpr id_type art::ScheduleID::invalid_id_ ( )
inlinestaticprivatenoexcept

Definition at line 32 of file ScheduleID.h.

33  {
35  }
static int max(int a, int b)
constexpr bool art::ScheduleID::isValid ( ) const
inlinenoexcept

Definition at line 71 of file ScheduleID.h.

72  {
73  return !(id_ == invalid_id_());
74  }
static constexpr id_type invalid_id_() noexcept
Definition: ScheduleID.h:32
static constexpr ScheduleID art::ScheduleID::last ( )
inlinestatic

Definition at line 55 of file ScheduleID.h.

56  {
58  }
constexpr ScheduleID() noexcept=default
static constexpr id_type art::ScheduleID::max_id_ ( )
inlinestaticprivatenoexcept

Definition at line 42 of file ScheduleID.h.

43  {
44  return invalid_id_() - 1;
45  }
static constexpr id_type invalid_id_() noexcept
Definition: ScheduleID.h:32
static constexpr id_type art::ScheduleID::min_id_ ( )
inlinestaticprivatenoexcept

Definition at line 37 of file ScheduleID.h.

38  {
40  }
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
ScheduleID art::ScheduleID::next ( ) const

Definition at line 23 of file ScheduleID.cc.

24  {
25  return ScheduleID(id_ + 1);
26  }
constexpr ScheduleID() noexcept=default
bool art::ScheduleID::operator< ( ScheduleID const &  other) const
noexcept

Definition at line 35 of file ScheduleID.cc.

36  {
37  return id_ < rhs.id_;
38  }
ScheduleID& art::ScheduleID::operator= ( ScheduleID const &  )
defaultnoexcept
ScheduleID& art::ScheduleID::operator= ( ScheduleID &&  )
defaultnoexcept
bool art::ScheduleID::operator== ( ScheduleID const &  other) const
noexcept

Definition at line 29 of file ScheduleID.cc.

30  {
31  return id_ == rhs.id_;
32  }

Friends And Related Function Documentation

template<typename T >
friend class PerScheduleContainer
friend

Definition at line 19 of file ScheduleID.h.

Member Data Documentation

id_type art::ScheduleID::id_ {invalid_id_()}
private

Definition at line 93 of file ScheduleID.h.


The documentation for this class was generated from the following files: