47 #ifndef _MIRA_TIMEHUMANREADABLE_H_ 48 #define _MIRA_TIMEHUMANREADABLE_H_ 79 namespace HumanReadableSerialization {
86 template<
bool AsString = true>
91 #if !defined(DATE_TIME_NO_DEFAULT_CONSTRUCTOR) 109 template<
typename Reflector>
112 std::string s = to_iso_extended_string(date);
116 template<
typename Reflector>
119 DateSerializedAsYMD::ymd_type ymd = date.year_month_day();
127 r.roproperty(
"Weekday", boost::lexical_cast<std::string>(date.day_of_week()),
131 template<
typename Reflector>
136 date = boost::gregorian::from_string(s);
139 template<
typename Reflector>
143 r.member(
"Year", y,
"");
144 r.member(
"Month", m,
"");
145 r.member(
"Day", d,
"");
151 namespace HumanReadableSerialization {
158 template<
bool AsString = true>
162 #if !defined(DATE_TIME_NO_DEFAULT_CONSTRUCTOR) 170 template<
typename Reflector>
173 if constexpr (AsString) {
174 std::string s = to_simple_string(*
this);
186 r.member(
"MilliSeconds", ms,
"Milliseconds 0..999 (optional, default=0)",
188 r.member(
"MicroSeconds", us,
"Microseconds 0..999 (optional, default=0)",
193 template<
typename Reflector>
196 if constexpr (AsString) {
199 *
this =
Base(boost::posix_time::duration_from_string(s));
201 int64 h, m, s, ms, us;
202 r.member(
"Hours", h,
"Hours 0..23");
203 r.member(
"Minutes", m,
"Minutes 0..59");
204 r.member(
"Seconds", s,
"Seconds 0..59");
205 r.member(
"MilliSeconds", ms,
"Milliseconds 0..999 (optional, default=0)", 0);
206 r.member(
"MicroSeconds", us,
"Microseconds 0..999 (optional, default=0)", 0);
221 namespace HumanReadableSerialization {
228 template<
bool AsString = true>
232 #if !defined(DATE_TIME_NO_DEFAULT_CONSTRUCTOR) 240 template<
typename Reflector>
243 if constexpr (AsString) {
244 std::string s = to_iso_extended_string(*
this);
253 template<
typename Reflector>
256 if constexpr (AsString) {
259 #if BOOST_VERSION >= 107300 260 *
this =
Base(boost::posix_time::from_iso_extended_string(s));
262 *
this =
Base(boost::date_time::parse_delimited_time<Base>(s,
'T'));
271 *
this =
Base(date, timeOfDay);
292 template<
typename SerializerTag>
295 template<
typename SerializerTag>
298 template<
typename SerializerTag>
MIRA_SPLIT_REFLECT_MEMBER void reflectRead(Reflector &r)
Definition: TimeHumanReadable.h:171
void reflectWrite(Reflector &r)
Definition: TimeHumanReadable.h:194
void reflectWrite(Reflector &r, Buffer< T, Allocator > &c)
Specialization of the non-intrusive reflect for Buffer.
Definition: Buffer.h:581
Type trait that indicates whether a type should be serialized "transparently", i.e.
Definition: IsTransparentSerializable.h:81
tick_type milliseconds() const
Returns normalized number of milliseconds (0..999)
Definition: Time.h:283
#define MIRA_SPLIT_REFLECT(Type)
Macro that inserts a reflect() method consisting of just a call to splitReflect() (splitting to refle...
Definition: SplitReflect.h:150
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
Duration()
Default constructor constructs to Duration of 0 length.
Definition: Time.h:204
#define MIRA_SPLIT_REFLECT_MEMBER
Macro that insert a class member reflect() method just splitting reflection into a reflectRead() and ...
Definition: SplitReflect.h:209
Time and Duration wrapper class.
Holds a boost::function object to a special setter function that must meet the signature "void method...
Definition: GetterSetter.h:395
mira::Date Base
Definition: TimeHumanReadable.h:89
Contains internal accessor class that abstracts from the underlying getter and setter classes or dire...
Derivation of mira::Date with human-readable serialization.
Definition: TimeHumanReadable.h:87
boost::posix_time::ptime Base
Definition: Time.h:420
Wrapper class for boost::posix_time::ptime for adding more functionality to it.
Definition: Time.h:416
MIRA_SPLIT_REFLECT_MEMBER void reflectRead(Reflector &r)
Definition: TimeHumanReadable.h:241
Flags controlling reflector behaviour.
Derivation of mira::Duration with human-readable serialization.
Definition: TimeHumanReadable.h:159
Time()
Default constructor constructs to not_a_date_time.
Definition: Time.h:449
boost::posix_time::time_duration Base
Definition: Time.h:108
min_type minutes() const
Returns normalized number of minutes (0..59)
Definition: Time.h:273
sec_type seconds() const
Returns normalized number of seconds (0..59)
Definition: Time.h:278
Use this class to represent time durations.
Definition: Time.h:104
boost::gregorian::date Date
Typedef for the boost Gregorian calendar date.
Definition: Time.h:68
hour_type hours() const
Returns number of hours in the duration.
Definition: Time.h:268
Setter< DateSerializedAsIsoString > humanReadableSetter(Date &date)
Setter for Date using DateSerializedAsIsoString proxy.
tick_type microseconds() const
Returns normalized number of microseconds (0..999)
Definition: Time.h:288
Date()
Definition: TimeHumanReadable.h:92
mira::Time Base
Definition: TimeHumanReadable.h:231
The Accessor class is used as an adapter to reduce the code bloat within the reflection and serializa...
Definition: Accessor.h:244
void reflectWrite(Reflector &r)
Definition: TimeHumanReadable.h:254
Holds a boost::function object to a special getter function that must meet the signature "T method()"...
Definition: GetterSetter.h:87
void reflectRead(Reflector &r, Buffer< T, Allocator > &c)
Specialization of the non-intrusive reflect for Buffer.
Definition: Buffer.h:565
Time()
Definition: TimeHumanReadable.h:233
Date(const Base &date)
Definition: TimeHumanReadable.h:94
TimeTypesSerializedAsElements()=default
Getter< DateSerializedAsIsoString > humanReadableGetter(const Date &date)
In addition to classes which can replace Date/Duration/Time, there are getters/setters/accessors for ...
Accessor< Getter< DateSerializedAsIsoString >, Setter< DateSerializedAsIsoString > > humanReadableAccessor(Date &date)
Accessor for Date using DateSerializedAsIsoString proxy.
Duration(const Base &date)
Definition: TimeHumanReadable.h:165
mira::Duration Base
Definition: TimeHumanReadable.h:161
HumanReadableSerialization::Duration< false > DurationSerializedAsHMS
Derivation of mira::Duration with serialization as hours/minutes/seconds/milli-/microseconds members...
Definition: TimeHumanReadable.h:219
Time(const Base &date)
Definition: TimeHumanReadable.h:235
When this flag is used in calls to Reflector::member(), that member is also reflected as read-only pr...
Definition: ReflectControlFlags.h:103
Derivation of mira::Time with human-readable serialization.
Definition: TimeHumanReadable.h:229
Duration()
Definition: TimeHumanReadable.h:163
A tag type used as parameter type in humanReadableGetter, humanReadableSetter, humanReadableAccessor ...
Definition: TimeHumanReadable.h:307