Period Functors
-
namespace details
-
struct MakeDiff
- #include <period_functor.hh>
Functor making the difference of two (capa) periods.
Public Functions
-
std::optional<time_period> operator()(std::optional<time_period> const &p1, std::optional<time_period> const &p2, boost::posix_time::ptime const &from, boost::posix_time::ptime const &to) const
Compute the difference between two optional periods on a given period.
- Parameters:
p1 – the first period
p2 – the second period
from – the starting ptime of the period to consider
to – the ending ptime of the period to consider
- Returns:
the resulting time_period
-
std::optional<time_period> operator()(std::optional<time_period> const &p1, std::optional<ratio_period> const &p2, boost::posix_time::ptime const &from, boost::posix_time::ptime const &to) const
Compute the difference between an optional time_period and an optional ratio_period on a given period.
- Parameters:
p1 – the time_period
p2 – the ratio_period
from – the starting ptime of the period to consider
to – the ending ptime of the period to consider
- Returns:
the resulting time_period
-
std::optional<time_period> operator()(std::optional<time_period> const &p1, std::optional<capa_period> const &p2, boost::posix_time::ptime const &from, boost::posix_time::ptime const &to) const
Compute the difference between an optional time_period and an optional capa_period on a given period.
- Parameters:
p1 – the time_period
p2 – the capa_period
from – the starting ptime of the period to consider
to – the ending ptime of the period to consider
- Returns:
the resulting time_period
-
std::optional<capa_period> operator()(std::optional<capa_period> const &p1, std::optional<capa_period> const &p2, boost::posix_time::ptime const &from, boost::posix_time::ptime const &to) const
Compute the difference between two optional capa_periods on a given period.
- Parameters:
p1 – the first capa_period
p2 – the second capa_period
from – the starting ptime of the period to consider
to – the ending ptime of the period to consider
- Returns:
a capacity period with the difference between the first capa and the second one (default value being 0)
-
std::optional<capa_period> operator()(std::optional<capa_period> const &p1, std::optional<time_period> const &p2, boost::posix_time::ptime const &from, boost::posix_time::ptime const &to) const
Compute the difference between an optional capa_period and an optional time_period on a given period.
- Parameters:
p1 – the first period
p2 – the second period
from – the starting ptime of the period to consider
to – the ending ptime of the period to consider
- Returns:
a capa_period with the capacity of p1 if p2 is not defined
-
std::optional<ratio_period> operator()(std::optional<ratio_period> const &p1, std::optional<time_period> const &p2, boost::posix_time::ptime const &from, boost::posix_time::ptime const &to) const
Compute the difference between an optional ratio_period and an optional time_period on a given period.
- Parameters:
p1 – the first period
p2 – the second period
from – the starting ptime of the period to consider
to – the ending ptime of the period to consider
- Returns:
a ratio_period with the ratio of p1 if p2 is not defined
-
std::optional<time_period> operator()(std::optional<time_period> const &p1, std::optional<time_period> const &p2, boost::posix_time::ptime const &from, boost::posix_time::ptime const &to) const
-
struct MakeInter
- #include <period_functor.hh>
Functor making the intersection of two (capa) periods.
Public Functions
-
inline explicit MakeInter(bool keep_empty)
Constructor.
- Parameters:
keep_empty – Should we keep the period with only one time stamp
-
std::optional<time_period> operator()(std::optional<time_period> const &p1, std::optional<time_period> const &p2, boost::posix_time::ptime const &from, boost::posix_time::ptime const &to) const
Compute the intersection between two optional periods on a given period.
- Parameters:
p1 – the first period
p2 – the second period
from – the starting ptime of the period to consider
to – the ending ptime of the period to consider
- Returns:
the resulting time_period
-
std::optional<time_period> operator()(std::optional<time_period> const &p1, std::optional<capa_period> const &p2, boost::posix_time::ptime const &from, boost::posix_time::ptime const &to) const
Compute the intersection between an optional time_period and an optional capa_period on a given period.
- Parameters:
p1 – the time_period
p2 – the capa_period
from – the starting ptime of the period to consider
to – the ending ptime of the period to consider
- Returns:
the resulting time_period
-
std::optional<time_period> operator()(std::optional<time_period> const &p1, std::optional<ratio_period> const &p2, boost::posix_time::ptime const &from, boost::posix_time::ptime const &to) const
Compute the intersection between an optional time_period and an optional ratio_period on a given period.
- Parameters:
p1 – the time_period
p2 – the ratio_period
from – the starting ptime of the period to consider
to – the ending ptime of the period to consider
- Returns:
the resulting time_period
-
std::optional<capa_period> operator()(std::optional<capa_period> const &p1, std::optional<capa_period> const &p2, boost::posix_time::ptime const &from, boost::posix_time::ptime const &to) const
Compute the intersection between two optional capa_periods on a given period.
- Parameters:
p1 – the first capa_period
p2 – the second capa_period
from – the starting ptime of the period to consider
to – the ending ptime of the period to consider
- Returns:
a capa_period with the minimal capacity (default value being 0)
-
std::optional<ratio_period> operator()(std::optional<ratio_period> const &p1, std::optional<ratio_period> const &p2, boost::posix_time::ptime const &from, boost::posix_time::ptime const &to) const
Compute the intersection between two optional ratio_periods on a given period.
- Parameters:
p1 – the first ratio_period
p2 – the second ratio_period
from – the starting ptime of the period to consider
to – the ending ptime of the period to consider
- Returns:
a ratio period with the minimal ratio (default value being 0.)
-
std::optional<capa_period> operator()(std::optional<capa_period> const &p1, std::optional<time_period> const &p2, boost::posix_time::ptime const &from, boost::posix_time::ptime const &to) const
Compute the intersection between an optional capa_period and an optional time_period on a given period.
- Parameters:
p1 – the first period
p2 – the second period
from – the starting ptime of the period to consider
to – the ending ptime of the period to consider
- Returns:
a capa period with the capacity of p1 if p2 is defined, nullopt otherwise
-
std::optional<ratio_period> operator()(std::optional<ratio_period> const &p1, std::optional<time_period> const &p2, boost::posix_time::ptime const &from, boost::posix_time::ptime const &to) const
Compute the intersection between an optional ratio_period and an optional time_period on a given period.
- Parameters:
p1 – the ratio_period
p2 – the time_period
from – the starting ptime of the period to consider
to – the ending ptime of the period to consider
- Returns:
a ratio period with the ratio of p1 if p2 is defined, nullopt otherwise
Public Members
-
bool _keep_empty
Should we keep the period with only one time stamp.
-
inline explicit MakeInter(bool keep_empty)
-
struct MakeUnion
- #include <period_functor.hh>
Functor making the union of two (capa) periods.
Public Functions
-
time_period operator()(std::optional<time_period> const &p1, std::optional<time_period> const &p2, boost::posix_time::ptime const &from, boost::posix_time::ptime const &to) const
Compute the union between two optional periods on a given period.
- Parameters:
p1 – the first period
p2 – the second period
from – the starting ptime of the period to consider
to – the ending ptime of the period to consider
- Returns:
the resulting time_period
-
std::optional<time_period> operator()(std::optional<time_period> const &p1, std::optional<capa_period> const &p2, boost::posix_time::ptime const &from, boost::posix_time::ptime const &to) const
Compute the union between an optional time_period and an optional capa_period on a given period.
- Parameters:
p1 – the time_period
p2 – the capa_period
from – the starting ptime of the period to consider
to – the ending ptime of the period to consider
- Returns:
the resulting time_period
-
std::optional<time_period> operator()(std::optional<time_period> const &p1, std::optional<ratio_period> const &p2, boost::posix_time::ptime const &from, boost::posix_time::ptime const &to) const
Compute the union between an optional time_period and an optional capa_period on a given period.
- Parameters:
p1 – the time_period
p2 – the capa_period
from – the starting ptime of the period to consider
to – the ending ptime of the period to consider
- Returns:
the resulting time_period
-
std::optional<capa_period> operator()(std::optional<capa_period> const &p1, std::optional<capa_period> const &p2, boost::posix_time::ptime const &from, boost::posix_time::ptime const &to) const
Compute the union between two optional capa_periods on a given period.
- Parameters:
p1 – the first capa_period
p2 – the second capa_period
from – the starting ptime of the period to consider
to – the ending ptime of the period to consider
- Returns:
a capa_period with the sum of the capacity (default value being 0)
-
std::optional<ratio_period> operator()(std::optional<ratio_period> const &p1, std::optional<ratio_period> const &p2, boost::posix_time::ptime const &from, boost::posix_time::ptime const &to) const
Compute the union between two optional ratio_periods on a given period.
- Parameters:
p1 – the first ratio_period
p2 – the second ratio_period
from – the starting ptime of the period to consider
to – the ending ptime of the period to consider
- Returns:
a ratio_period with the sum of the ratios (the default value being 0.)
-
std::optional<ratio_period> operator()(std::optional<ratio_period> const &p1, std::optional<time_period> const &p2, boost::posix_time::ptime const &from, boost::posix_time::ptime const &to) const
Compute the union between an optional ratio_period and an optional time_period on a given period.
- Parameters:
p1 – the first ratio_period
p2 – the second time_period
from – the starting ptime of the period to consider
to – the ending ptime of the period to consider
- Returns:
a ratio_period with the ratio of p1 if defined, a ratio_period with ratio 1. if p2 is defined, else nothing
-
time_period operator()(std::optional<time_period> const &p1, std::optional<time_period> const &p2, boost::posix_time::ptime const &from, boost::posix_time::ptime const &to) const
-
struct MakeDiff