5 #include <hilti/ast/builder/type.h> 6 #include <hilti/ast/operators/common.h> 7 #include <hilti/ast/types/integer.h> 8 #include <hilti/ast/types/interval.h> 9 #include <hilti/ast/types/real.h> 14 STANDARD_OPERATOR_2(interval, Equal, type::Bool(), type::Interval(), type::Interval(),
"Compares two interval values.")
15 STANDARD_OPERATOR_2(interval, Unequal, type::Bool(), type::Interval(), type::Interval(),
16 "Compares two interval values.")
17 STANDARD_OPERATOR_2(interval, Sum, type::Interval(), type::Interval(), type::Interval(),
18 "Returns the sum of the intervals.");
19 STANDARD_OPERATOR_2(interval, Difference, type::Interval(), type::Interval(), type::Interval(),
20 "Returns the difference of the intervals.");
21 STANDARD_OPERATOR_2(interval, Greater, type::Bool(), type::Interval(), type::Interval(), "Compares the intervals.");
22 STANDARD_OPERATOR_2(interval, GreaterEqual, type::Bool(), type::Interval(), type::Interval(),
23 "Compares the intervals.");
24 STANDARD_OPERATOR_2(interval, Lower, type::Bool(), type::Interval(), type::Interval(), "Compares the intervals.");
25 STANDARD_OPERATOR_2(interval, LowerEqual, type::Bool(), type::Interval(), type::Interval(), "Compares the intervals.");
26 STANDARD_OPERATOR_2x(interval, MultipleUnsignedInteger, Multiple, type::Interval(), type::Interval(),
27 type::UnsignedInteger(64), "Multiples the interval with the given factor.");
28 STANDARD_OPERATOR_2x(interval, MultipleReal, Multiple, type::Interval(), type::Interval(), type::Real(),
29 "Multiplies the interval with the given factor.");
31 BEGIN_METHOD(interval, Seconds)
32 auto signature()
const {
33 return Signature{.self = type::Interval(), .result = type::Real(), .id =
"seconds", .args = {}, .doc = R
"( 34 Returns the interval as a real value representing seconds. 39 BEGIN_METHOD(interval, Nanoseconds) 40 auto signature()
const {
41 return Signature{.self = type::Interval(),
42 .result = type::SignedInteger(64),
46 Returns the interval as an integer value representing nanoseconds.