Template Class BoundedSchedule

Inheritance Relationships

Base Type

  • public std::map< std::pair< boost::posix_time::ptime, boost::posix_time::ptime >, T >

Class Documentation

template<typename T>
class BoundedSchedule : public std::map<std::pair<boost::posix_time::ptime, boost::posix_time::ptime>, T>

A schedule that maps bounded time intervals to values of type T.

Template Parameters:

T – The type of values stored in the schedule.

Public Functions

inline std::vector<std::shared_ptr<BoundedSchedule<T>>> split(const std::vector<boost::posix_time::ptime> &splitters) const

Splits the schedule at given splitter times, generating multiple possible schedules.

Parameters:

splitters – A vector of times to split the schedule.

Returns:

A vector of shared pointers to new BoundedSchedule instances.

inline bool add_with_bounds(const std::pair<boost::posix_time::ptime, boost::posix_time::ptime> &bounds, const T &value)

Adds an entry to the schedule using an explicit start and end time.

Parameters:
  • bounds – A pair representing the start and end time of the entry.

  • value – The value associated with the time range.

Returns:

True if the insertion was successful, false otherwise.

inline bool add_centered_on(const boost::posix_time::ptime &reference_time, int business_days, const T &value)

Adds an entry to the schedule using a center reference time and a symmetric business-day window.

Parameters:
  • reference_time – The reference time.

  • business_days – The number of business days before and after the reference time.

  • value – The value associated with the time range.

Returns:

True if the insertion was successful, false otherwise.

inline std::vector<std::tuple<double, double, T>> diff(const boost::posix_time::ptime &reference_time, const TenorCalculator &time_calculator) const

Computes the time difference of schedule entries relative to a reference time.

Parameters:
  • reference_time – The reference time.

  • time_calculator – A TimeCalculator instance used to compute year fractions.

Returns:

A vector of tuples containing the start time difference, end time difference, and value.

inline std::map<std::pair<boost::posix_time::ptime, boost::posix_time::ptime>, T> to_map()

Converts the object to a map.

Returns:

A std::map mapping pairs of boost::posix_time::ptime to values of type T. Each key is a (start_time, end_time) pair associated with a corresponding value.