double PeriodDayCountUtil::yearsDiff(
                                 const bdlt::Date&              beginDate,
                                 const bdlt::Date&              endDate,
                                 const bsl::vector<bdlt::Date>& periodDate,
                                 double                         periodYearDiff,
                                 DayCountConvention::Enum       convention)
{
    BSLS_ASSERT(periodDate.size() >= 2);
    BSLS_ASSERT(periodDate.front() <= beginDate);
    BSLS_ASSERT(                      beginDate <= periodDate.back());
    BSLS_ASSERT(periodDate.front() <= endDate);
    BSLS_ASSERT(                      endDate   <= periodDate.back());

    BSLS_ASSERT_SAFE(isSortedAndUnique(periodDate.begin(), periodDate.end()));

    double numYears;

    switch (convention) {
      case DayCountConvention::e_PERIOD_ICMA_ACTUAL_ACTUAL: {
        numYears = bbldc::PeriodIcmaActualActual::yearsDiff(beginDate,
                                                            endDate,
                                                            periodDate,
                                                            periodYearDiff);
      } break;
      default: {
        BSLS_ASSERT_OPT(0 && "Unrecognized convention");
        numYears = 0.0;
      } break;
    }

    return numYears;
}
示例#2
0
 inline
 int my_RecordBuffer::pushFront(
                      const bsl::shared_ptr<ball::Record>& handle)
 {
     bslmt::LockGuard<bslmt::RecursiveMutex> guard(&d_mutex);
     d_buffer.insert(d_buffer.begin(), handle);
     return 0;
 }
示例#3
0
 inline
 void my_RecordBuffer::popFront()
 {
     bslmt::LockGuard<bslmt::RecursiveMutex> guard(&d_mutex);
     d_buffer.erase(d_buffer.begin());
 }