#include <month.hpp>
|
constexpr auto | operator== (const Month &x, const Month &y) -> bool |
| Compare exact equality between two Month instances. More...
|
|
constexpr auto | operator!= (const Month &x, const Month &y) -> bool |
| Compare exact inequality between two Month instances. More...
|
|
constexpr auto | operator< (const Month &x, const Month &y) -> bool |
| Check if one Month instance is less than another. More...
|
|
constexpr auto | operator<= (const Month &x, const Month &y) -> bool |
| Check if one Month instance is less than or equal to another. More...
|
|
constexpr auto | operator> (const Month &x, const Month &y) -> bool |
| Check if one Month instance is greater than another. More...
|
|
constexpr auto | operator>= (const Month &x, const Month &y) -> bool |
| Check if one Month instance is greater than or equal to another. More...
|
|
template<typename CharT , typename Traits > |
auto | operator<< (std::basic_ostream< CharT, Traits > &os, const Month &m) -> std::basic_ostream< CharT, Traits > & |
| Output a string representation of Month instance to an output stream. More...
|
|
Definition at line 29 of file month.hpp.
◆ Month() [1/2]
carma_cooperative_perception::Month::Month |
( |
| ) |
|
|
default |
◆ Month() [2/2]
constexpr carma_cooperative_perception::Month::Month |
( |
std::uint8_t |
month_value | ) |
|
|
inlineexplicitconstexpr |
Create a Month instance with the specified value.
- Parameters
-
[in] | month_value | Numerical value of the month; typically between [1, 12] |
Definition at line 41 of file month.hpp.
std::uint8_t month_value_
◆ get_value()
uint8_t carma_cooperative_perception::Month::get_value |
( |
| ) |
const |
|
inline |
◆ ok()
constexpr auto carma_cooperative_perception::Month::ok |
( |
| ) |
const -> bool
|
|
inlineconstexpr |
Checks if Month instance's value is within valid Gregorian calendar range.
- Returns
- true if Month instance's value is within [1, 12]; false otherwise
Definition at line 120 of file month.hpp.
121 {
122 constexpr auto jan_value{1U};
123 constexpr auto dec_value{12U};
124
126 }
References month_value_.
◆ operator unsigned()
constexpr carma_cooperative_perception::Month::operator unsigned |
( |
| ) |
const |
|
inlineexplicitconstexpr |
◆ operator++() [1/2]
constexpr auto carma_cooperative_perception::Month::operator++ |
( |
| ) |
-> Month &
|
|
inlineconstexpr |
Pre-increment operator overload.
- Returns
- Reference to Month instance being incremented
Definition at line 48 of file month.hpp.
49 {
50 constexpr auto jan_value{1U};
51 constexpr auto dec_value{12U};
52
54
57 }
58
59 return *this;
60 }
References month_value_.
◆ operator++() [2/2]
constexpr auto carma_cooperative_perception::Month::operator++ |
( |
int |
| ) |
-> Month
|
|
inlineconstexpr |
Post-increment operator overload.
- Parameters
-
[in] | _ | Dummy parameter used to distinguish from the pre-increment operator |
- Returns
- Copy of Month instance before it was incremented
Definition at line 69 of file month.hpp.
70 {
71 Month previous{*
this};
72 ++(*this);
73
74 return previous;
75 }
◆ operator--() [1/2]
constexpr auto carma_cooperative_perception::Month::operator-- |
( |
| ) |
-> Month &
|
|
inlineconstexpr |
Pre-decrement operator overload.
- Returns
- Reference to Month instance being decremented
Definition at line 82 of file month.hpp.
83 {
84 constexpr auto dec_value{12U};
85
87
90 }
91
92 return *this;
93 }
References month_value_.
◆ operator--() [2/2]
constexpr auto carma_cooperative_perception::Month::operator-- |
( |
int |
| ) |
-> Month
|
|
inlineconstexpr |
Post-decrement operator overload.
- Parameters
-
[in] | _ | Dummy parameter used to distinguish from the pre-decrement operator |
- Returns
- Copy of Month instance before it was decremented
Definition at line 102 of file month.hpp.
103 {
104 Month previous{*
this};
105 --(*this);
106
107 return previous;
108 }
◆ operator!=
constexpr auto operator!= |
( |
const Month & |
x, |
|
|
const Month & |
y |
|
) |
| -> bool |
|
friend |
Compare exact inequality between two Month instances.
- Parameters
-
[in] | x | First Month instance |
[in] | y | Second Month instance |
- Returns
- true is Month instances are not equal; false otherwise
Definition at line 149 of file month.hpp.
◆ operator<
constexpr auto operator< |
( |
const Month & |
x, |
|
|
const Month & |
y |
|
) |
| -> bool
|
|
friend |
Check if one Month instance is less than another.
- Parameters
-
[in] | x | First Month instance |
[in] | y | Second Month instance |
- Returns
- true is x comes before y in the calendar; false otherwise
Definition at line 159 of file month.hpp.
160 {
161 return x.month_value_ <
y.month_value_;
162 }
◆ operator<<
template<typename CharT , typename Traits >
auto operator<< |
( |
std::basic_ostream< CharT, Traits > & |
os, |
|
|
const Month & |
m |
|
) |
| -> std::basic_ostream<CharT, Traits> &
|
|
friend |
Output a string representation of Month instance to an output stream.
- Template Parameters
-
CharT | Character type of the specified stream |
Traits | Character traits of the specified stream |
- Parameters
-
[in,out] | os | Output stream being written to |
[in] | m | Month instance being written out |
- Returns
- Reference to specified output stream
Definition at line 215 of file month.hpp.
217 {
218 static constexpr std::array abbreviations{"Jan.", "Feb.", "Mar.", "Apr.", "May", "Jun.",
219 "Jul.", "Aug.", "Sep.", "Oct.", "Nov.", "Dec."};
220 if (!m.ok()) {
221 return os << static_cast<unsigned>(m) << " is not a valid month";
222 }
223
224 return os << abbreviations.at(static_cast<unsigned>(m) - 1);
225 }
◆ operator<=
constexpr auto operator<= |
( |
const Month & |
x, |
|
|
const Month & |
y |
|
) |
| -> bool
|
|
friend |
Check if one Month instance is less than or equal to another.
- Parameters
-
[in] | x | First Month instance |
[in] | y | Second Month instance |
- Returns
- true is x comes before y in the calendar or if instances are equal; false otherwise
Definition at line 172 of file month.hpp.
173 {
174 return x <
y ||
x ==
y;
175 }
◆ operator==
constexpr auto operator== |
( |
const Month & |
x, |
|
|
const Month & |
y |
|
) |
| -> bool
|
|
friend |
Compare exact equality between two Month instances.
- Parameters
-
[in] | x | First Month instance |
[in] | y | Second Month instance |
- Returns
- true is Month instances are equal; false otherwise
Definition at line 136 of file month.hpp.
137 {
138 return x.month_value_ ==
y.month_value_;
139 }
◆ operator>
constexpr auto operator> |
( |
const Month & |
x, |
|
|
const Month & |
y |
|
) |
| -> bool
|
|
friend |
Check if one Month instance is greater than another.
- Parameters
-
[in] | x | First Month instance |
[in] | y | Second Month instance |
- Returns
- true is x comes after y in the calendar; false otherwise
Definition at line 185 of file month.hpp.
186 {
187 return x.month_value_ >
y.month_value_;
188 }
◆ operator>=
constexpr auto operator>= |
( |
const Month & |
x, |
|
|
const Month & |
y |
|
) |
| -> bool
|
|
friend |
Check if one Month instance is greater than or equal to another.
- Parameters
-
[in] | x | First Month instance |
[in] | y | Second Month instance |
- Returns
- true is x comes after y in the calendar or if instances are equal; false otherwise
Definition at line 198 of file month.hpp.
199 {
200 return x >
y ||
x ==
y;
201 }
◆ month_value_
std::uint8_t carma_cooperative_perception::Month::month_value_ |
|
private |
The documentation for this class was generated from the following file:
- carma_cooperative_perception/include/carma_cooperative_perception/month.hpp