23 #ifndef NDN_SCHEDULE_HPP
24 #define NDN_SCHEDULE_HPP
27 #include <ndn-cpp/c/errors.h>
28 #include <ndn-cpp/util/blob.hpp>
29 #include "repetitive-interval.hpp"
49 this->isPositive = isPositive;
50 this->interval = interval;
77 sortedSetAdd(whiteIntervalList_, repetitiveInterval);
91 sortedSetAdd(blackIntervalList_, repetitiveInterval);
122 wireDecode(
const uint8_t *input,
size_t inputLength);
145 fromIsoString(
const std::string& dateString);
159 (std::vector<ptr_lib::shared_ptr<RepetitiveInterval> >& list,
160 const ptr_lib::shared_ptr<RepetitiveInterval>& element);
171 encodeRepetitiveIntervalValue(
const void *context,
ndn_TlvEncoder *encoder);
182 encodeRepetitiveIntervalListValue(
const void *context,
ndn_TlvEncoder *encoder);
192 encodeScheduleValue(
const void *context,
ndn_TlvEncoder *encoder);
200 static ptr_lib::shared_ptr<RepetitiveInterval>
213 calculateIntervalResult
214 (
const std::vector<ptr_lib::shared_ptr<RepetitiveInterval> >& list,
218 std::vector<ptr_lib::shared_ptr<RepetitiveInterval> > whiteIntervalList_;
219 std::vector<ptr_lib::shared_ptr<RepetitiveInterval> > blackIntervalList_;
220 static const uint64_t MILLISECONDS_IN_DAY = 24 * 3600 * 1000;
Schedule()
Create a Schedule with empty whiteIntervalList and blackIntervalList.
Definition: schedule.hpp:60
Blob wireEncode() const
Encode this Schedule.
Definition: schedule.cpp:80
An Interval defines a time duration which contains a start timestamp and an end timestamp.
Definition: interval.hpp:36
Copyright (C) 2013-2016 Regents of the University of California.
Definition: common.hpp:36
void wireDecode(const std::vector< uint8_t > &input)
Decode the input and update this Schedule.
Definition: schedule.hpp:129
Schedule is used to manage the times when a member can access data using two sets of RepetitiveInterv...
Definition: schedule.hpp:43
Schedule & addBlackInterval(const ptr_lib::shared_ptr< RepetitiveInterval > &repetitiveInterval)
Add the repetitiveInterval to the blackIntervalList.
Definition: schedule.hpp:88
void wireDecode(const uint8_t *input, size_t inputLength)
Decode the input and update this Schedule.
Definition: schedule.cpp:94
Copyright (C) 2014-2016 Regents of the University of California.
Definition: tlv-encoder.h:39
A Blob holds a pointer to an immutable byte array implemented as const std::vector.
Definition: blob.hpp:42
const uint8_t * buf() const
Return a const pointer to the first byte of the immutable byte array, or 0 if the pointer is null...
Definition: blob.hpp:159
Definition: schedule.hpp:45
size_t size() const
Return the length of the immutable byte array.
Definition: blob.hpp:147
Result getCoveringInterval(MillisecondsSince1970 timeStamp) const
Get the interval that covers the time stamp.
Definition: schedule.cpp:36
double MillisecondsSince1970
The calendar time represented as the number of milliseconds since 1/1/1970.
Definition: common.hpp:117
void wireDecode(const Blob &input)
Decode the input and update this Schedule.
Definition: schedule.hpp:139
Copyright (C) 2014-2016 Regents of the University of California.
Definition: tlv-decoder.h:34
Schedule & addWhiteInterval(const ptr_lib::shared_ptr< RepetitiveInterval > &repetitiveInterval)
Add the repetitiveInterval to the whiteIntervalList.
Definition: schedule.hpp:74