Example #1
0
dynd::busdate_type::busdate_type(busdate_roll_t roll, const bool *weekmask, const nd::array& holidays)
    : base_type(busdate_type_id, datetime_kind, 4, 4, type_flag_scalar, 0, 0), m_roll(roll)
{
    memcpy(m_workweek, weekmask, sizeof(m_workweek));
    m_busdays_in_weekmask = 0;
    for (int i = 0; i < 7; ++i) {
        m_busdays_in_weekmask += weekmask[i] ? 1 : 0;
    }
    if (!holidays.is_empty()) {
        nd::array hol = holidays.ucast(ndt::make_date()).eval_immutable();
        // TODO: Make sure hol is contiguous and one-dimensional
        m_holidays = hol;
    }
}