2019-12-15 01:25:00 +08:00
|
|
|
/*
|
|
|
|
* _TimeDelta.cpp
|
|
|
|
*
|
|
|
|
* Copyright (C) 2019 hikyuu.org
|
|
|
|
*
|
|
|
|
* Created on: 2019-12-14
|
|
|
|
* Author: fasiondog
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <boost/python.hpp>
|
|
|
|
#include <hikyuu/serialization/TimeDelta_serialization.h>
|
|
|
|
#include "pickle_support.h"
|
|
|
|
|
|
|
|
using namespace boost::python;
|
|
|
|
using namespace hku;
|
|
|
|
|
|
|
|
void export_TimeDelta() {
|
|
|
|
class_<TimeDelta>("TimeDelta", init<>())
|
|
|
|
.def(init<int64_t>())
|
|
|
|
.def(init<int64_t, int64_t>())
|
|
|
|
.def(init<int64_t, int64_t, int64_t>())
|
|
|
|
.def(init<int64_t, int64_t, int64_t, int64_t>())
|
2019-12-16 02:09:43 +08:00
|
|
|
.def(init<int64_t, int64_t, int64_t, int64_t, int64_t>())
|
|
|
|
.def(init<int64_t, int64_t, int64_t, int64_t, int64_t, int64_t>())
|
2019-12-15 01:25:00 +08:00
|
|
|
.def(self_ns::str(self))
|
2019-12-18 02:04:54 +08:00
|
|
|
.add_property("days", &TimeDelta::days)
|
|
|
|
.add_property("hours", &TimeDelta::hours)
|
|
|
|
.add_property("minutes", &TimeDelta::minutes)
|
|
|
|
.add_property("seconds", &TimeDelta::seconds)
|
|
|
|
.add_property("milliseconds", &TimeDelta::milliseconds)
|
|
|
|
.add_property("microseconds", &TimeDelta::microseconds)
|
|
|
|
.add_property("ticks", &TimeDelta::ticks)
|
|
|
|
.def("max", &TimeDelta::max)
|
2019-12-19 02:32:06 +08:00
|
|
|
.staticmethod("max")
|
2019-12-18 02:04:54 +08:00
|
|
|
.def("min", &TimeDelta::min)
|
2019-12-19 02:32:06 +08:00
|
|
|
.staticmethod("min")
|
2019-12-18 02:04:54 +08:00
|
|
|
.def("resolution", &TimeDelta::resolution)
|
2019-12-19 02:32:06 +08:00
|
|
|
.staticmethod("resolution")
|
2019-12-21 03:01:33 +08:00
|
|
|
.def("maxTicks", &TimeDelta::maxTicks)
|
|
|
|
.staticmethod("maxTicks")
|
|
|
|
.def("minTicks", &TimeDelta::minTicks)
|
|
|
|
.staticmethod("minTicks")
|
|
|
|
.def("fromTicks", &TimeDelta::fromTicks)
|
|
|
|
.staticmethod("fromTicks")
|
2019-12-19 02:32:06 +08:00
|
|
|
|
|
|
|
.def("__eq__", &TimeDelta::operator==)
|
|
|
|
.def("__ne__", &TimeDelta::operator!=)
|
|
|
|
.def("__gt__", &TimeDelta::operator>)
|
|
|
|
.def("__lt__", &TimeDelta::operator<)
|
|
|
|
.def("__ge__", &TimeDelta::operator>=)
|
|
|
|
.def("__le__", &TimeDelta::operator>=)
|
|
|
|
|
|
|
|
.def("__add__", &TimeDelta::operator+)
|
|
|
|
.def("__sub__", &TimeDelta::operator-)
|
2019-12-18 02:04:54 +08:00
|
|
|
|
2019-12-15 01:25:00 +08:00
|
|
|
#if HKU_PYTHON_SUPPORT_PICKLE
|
|
|
|
.def_pickle(normal_pickle_suite<TimeDelta>())
|
|
|
|
#endif
|
|
|
|
;
|
|
|
|
}
|