#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 39 of file month.hpp.
std::uint8_t month_value_
◆ 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 118 of file month.hpp.
119 {
120 constexpr auto jan_value{1U};
121 constexpr auto dec_value{12U};
122
124 }
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 46 of file month.hpp.
47 {
48 constexpr auto jan_value{1U};
49 constexpr auto dec_value{12U};
50
52
55 }
56
57 return *this;
58 }
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 67 of file month.hpp.
68 {
69 Month previous{*
this};
70 ++(*this);
71
72 return previous;
73 }
◆ 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 80 of file month.hpp.
81 {
82 constexpr auto dec_value{12U};
83
85
88 }
89
90 return *this;
91 }
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 100 of file month.hpp.
101 {
102 Month previous{*
this};
103 --(*this);
104
105 return previous;
106 }
◆ 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 147 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 157 of file month.hpp.
158 {
159 return x.month_value_ <
y.month_value_;
160 }
◆ 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 213 of file month.hpp.
215 {
216 static constexpr std::array abbreviations{"Jan.", "Feb.", "Mar.", "Apr.", "May", "Jun.",
217 "Jul.", "Aug.", "Sep.", "Oct.", "Nov.", "Dec."};
218 if (!m.ok()) {
219 return os << static_cast<unsigned>(m) << " is not a valid month";
220 }
221
222 return os << abbreviations.at(static_cast<unsigned>(m) - 1);
223 }
◆ 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 170 of file month.hpp.
171 {
172 return x <
y ||
x ==
y;
173 }
◆ 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 134 of file month.hpp.
135 {
136 return x.month_value_ ==
y.month_value_;
137 }
◆ 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 183 of file month.hpp.
184 {
185 return x.month_value_ >
y.month_value_;
186 }
◆ 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 196 of file month.hpp.
197 {
198 return x >
y ||
x ==
y;
199 }
◆ 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