diff --git a/.github/workflows/javacpp.yml b/.github/workflows/javacpp.yml index 816a94af2..c6456f0d2 100644 --- a/.github/workflows/javacpp.yml +++ b/.github/workflows/javacpp.yml @@ -26,11 +26,11 @@ jobs: steps: - uses: bytedeco/javacpp-presets/.github/actions/deploy-ubuntu@actions ios-arm64: - runs-on: macos-11 + runs-on: macos-14 steps: - uses: bytedeco/javacpp-presets/.github/actions/deploy-macosx@actions ios-x86_64: - runs-on: macos-11 + runs-on: macos-12 steps: - uses: bytedeco/javacpp-presets/.github/actions/deploy-macosx@actions # linux-armhf: @@ -56,11 +56,11 @@ jobs: steps: - uses: bytedeco/javacpp-presets/.github/actions/deploy-ubuntu@actions macosx-arm64: - runs-on: macos-11 + runs-on: macos-14 steps: - uses: bytedeco/javacpp-presets/.github/actions/deploy-macosx@actions macosx-x86_64: - runs-on: macos-11 + runs-on: macos-12 env: CI_DEPLOY_OPTIONS: "" # to not skip tests steps: diff --git a/CHANGELOG.md b/CHANGELOG.md index 908e7f6b3..63b379e77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ + * Add minimal mappings for `std::chrono` from C++11 ([pull #766](https://github.com/bytedeco/javacpp/pull/766)) * Let `Parser` annotate Java constructors with `@Deprecated` when appropriate ([pull #757](https://github.com/bytedeco/javacpp/pull/757)) * Add to `InfoMap.defaults` more names that are reserved in Java, but not in C++ ([pull #757](https://github.com/bytedeco/javacpp/pull/757)) * Bundle `libomp` from Visual Studio to fix presets using OpenMP on Windows ([pull #755](https://github.com/bytedeco/javacpp/pull/755)) diff --git a/pom.xml b/pom.xml index bb62478e9..f0204a4a6 100644 --- a/pom.xml +++ b/pom.xml @@ -461,6 +461,7 @@ Import-Package: \ -Dplatform.compiler=${javacpp.platform.compiler} org.bytedeco.javacpp.Pointer org.bytedeco.javacpp.presets.javacpp + org.bytedeco.javacpp.chrono.* -mod ${project.build.directory}/generated-sources/java9/module-info.java diff --git a/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionClock.java b/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionClock.java new file mode 100644 index 000000000..30b314ae5 --- /dev/null +++ b/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionClock.java @@ -0,0 +1,13 @@ +package org.bytedeco.javacpp.chrono; + +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.javacpp.annotation.ByVal; +import org.bytedeco.javacpp.annotation.MemberGetter; +import org.bytedeco.javacpp.annotation.Name; +import org.bytedeco.javacpp.annotation.Properties; + +@Name("std::chrono::high_resolution_clock") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) +public class HighResolutionClock extends Pointer { + static public native @ByVal HighResolutionTime now(); + static public native @MemberGetter boolean is_steady(); +} diff --git a/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionDuration.java b/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionDuration.java new file mode 100644 index 000000000..93b84a007 --- /dev/null +++ b/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionDuration.java @@ -0,0 +1,27 @@ +package org.bytedeco.javacpp.chrono; + +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.javacpp.annotation.*; + +@Name("std::chrono::high_resolution_clock::duration") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) +public class HighResolutionDuration extends Pointer { + public HighResolutionDuration() { allocate(); } + private native void allocate(); + public HighResolutionDuration(long r) { allocate(r); } + private native void allocate(long r); + + public native @Name("operator=") @ByRef HighResolutionDuration put(@Const @ByRef HighResolutionDuration other); + public native @Name("operator-") @ByVal HighResolutionDuration negate(); + public native @Name("operator++") @ByRef HighResolutionDuration increment(); + public native @Name("operator--") @ByRef HighResolutionDuration decrement(); + public native @Name("operator+=") @ByRef HighResolutionDuration addPut(@Const @ByRef HighResolutionDuration d); + public native @Name("operator-=") @ByRef HighResolutionDuration subtractPut(@Const @ByRef HighResolutionDuration d); + public native @Name("operator*=") @ByRef HighResolutionDuration multiplyPut(@Const @ByRef long rhs); + public native @Name("operator%=") @ByRef HighResolutionDuration modPut(@Const @ByRef long rhs); + public native @Name("operator%=") @ByRef HighResolutionDuration modPut(@Const @ByRef HighResolutionDuration rhs); + + public native long count(); + static public native @ByVal @Name("zero") HighResolutionDuration zero_(); + static public native @ByVal HighResolutionDuration min(); + static public native @ByVal HighResolutionDuration max(); +} diff --git a/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionTime.java b/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionTime.java new file mode 100644 index 000000000..d00eb1325 --- /dev/null +++ b/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionTime.java @@ -0,0 +1,20 @@ +package org.bytedeco.javacpp.chrono; + +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.javacpp.annotation.*; + +@Name("std::chrono::time_point") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) +public class HighResolutionTime extends Pointer { + public HighResolutionTime() { allocate(); } + private native void allocate(); + + public HighResolutionTime(HighResolutionDuration d) { allocate(d); } + private native void allocate(@Const @ByRef HighResolutionDuration d); + + public native @ByVal HighResolutionTime time_since_epoch(); + + public native @Name("operator +=") @ByRef HighResolutionTime addPut(@Const @ByRef HighResolutionDuration d); + public native @Name("operator -=") @ByRef HighResolutionTime subtractPut(@Const @ByRef HighResolutionDuration d); + static public native @ByVal HighResolutionTime min(); + static public native @ByVal HighResolutionTime max(); +} diff --git a/src/main/java/org/bytedeco/javacpp/chrono/Hours.java b/src/main/java/org/bytedeco/javacpp/chrono/Hours.java new file mode 100644 index 000000000..a269e44a8 --- /dev/null +++ b/src/main/java/org/bytedeco/javacpp/chrono/Hours.java @@ -0,0 +1,27 @@ +package org.bytedeco.javacpp.chrono; + +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.javacpp.annotation.*; + +@Name("std::chrono::hours") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) +public class Hours extends Pointer { + public Hours() { allocate(); } + private native void allocate(); + public Hours(long r) { allocate(r); } + private native void allocate(long r); + + public native @Name("operator=") @ByRef Hours put(@Const @ByRef Hours other); + public native @Name("operator-") @ByVal Hours negate(); + public native @Name("operator++") @ByRef Hours increment(); + public native @Name("operator--") @ByRef Hours decrement(); + public native @Name("operator+=") @ByRef Hours addPut(@Const @ByRef Hours d); + public native @Name("operator-=") @ByRef Hours subtractPut(@Const @ByRef Hours d); + public native @Name("operator*=") @ByRef Hours multiplyPut(@Const @ByRef int rhs); + public native @Name("operator%=") @ByRef Hours modPut(@Const @ByRef int rhs); + public native @Name("operator%=") @ByRef Hours modPut(@Const @ByRef Hours rhs); + + public native int count(); + static public native @ByVal @Name("zero") Hours zero_(); + static public native @ByVal Hours min(); + static public native @ByVal Hours max(); +} diff --git a/src/main/java/org/bytedeco/javacpp/chrono/Microseconds.java b/src/main/java/org/bytedeco/javacpp/chrono/Microseconds.java new file mode 100644 index 000000000..1fe622987 --- /dev/null +++ b/src/main/java/org/bytedeco/javacpp/chrono/Microseconds.java @@ -0,0 +1,36 @@ +package org.bytedeco.javacpp.chrono; + +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.javacpp.annotation.*; + +@Name("std::chrono::microseconds") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) +public class Microseconds extends Pointer { + public Microseconds() { allocate(); } + private native void allocate(); + public Microseconds(long r) { allocate(r); } + private native void allocate(long r); + + public Microseconds(Milliseconds d) { allocate(d); } + private native void allocate(@Const @ByRef Milliseconds d); + public Microseconds(Seconds d) { allocate(d); } + private native void allocate(@Const @ByRef Seconds d); + public Microseconds(Minutes d) { allocate(d); } + private native void allocate(@Const @ByRef Minutes d); + public Microseconds(Hours d) { allocate(d); } + private native void allocate(@Const @ByRef Hours d); + + public native @Name("operator=") @ByRef Microseconds put(@Const @ByRef Microseconds other); + public native @Name("operator-") @ByVal Microseconds negate(); + public native @Name("operator++") @ByRef Microseconds increment(); + public native @Name("operator--") @ByRef Microseconds decrement(); + public native @Name("operator+=") @ByRef Microseconds addPut(@Const @ByRef Microseconds d); + public native @Name("operator-=") @ByRef Microseconds subtractPut(@Const @ByRef Microseconds d); + public native @Name("operator*=") @ByRef Microseconds multiplyPut(@Const @ByRef long rhs); + public native @Name("operator%=") @ByRef Microseconds modPut(@Const @ByRef long rhs); + public native @Name("operator%=") @ByRef Microseconds modPut(@Const @ByRef Microseconds rhs); + + public native long count(); + static public native @ByVal @Name("zero") Microseconds zero_(); + static public native @ByVal Microseconds min(); + static public native @ByVal Microseconds max(); +} diff --git a/src/main/java/org/bytedeco/javacpp/chrono/Milliseconds.java b/src/main/java/org/bytedeco/javacpp/chrono/Milliseconds.java new file mode 100644 index 000000000..202f412ed --- /dev/null +++ b/src/main/java/org/bytedeco/javacpp/chrono/Milliseconds.java @@ -0,0 +1,33 @@ +package org.bytedeco.javacpp.chrono; + +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.javacpp.annotation.*; + +@Name("std::chrono::milliseconds") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) +public class Milliseconds extends Pointer { + public Milliseconds() { allocate(); } + private native void allocate(); + public Milliseconds(long r) { allocate(r); } + private native void allocate(long r); + public Milliseconds(Seconds d) { allocate(d); } + private native void allocate(@Const @ByRef Seconds d); + public Milliseconds(Minutes d) { allocate(d); } + private native void allocate(@Const @ByRef Minutes d); + public Milliseconds(Hours d) { allocate(d); } + private native void allocate(@Const @ByRef Hours d); + + public native @Name("operator=") @ByRef Milliseconds put(@Const @ByRef Milliseconds other); + public native @Name("operator-") @ByVal Milliseconds negate(); + public native @Name("operator++") @ByRef Milliseconds increment(); + public native @Name("operator--") @ByRef Milliseconds decrement(); + public native @Name("operator+=") @ByRef Milliseconds addPut(@Const @ByRef Milliseconds d); + public native @Name("operator-=") @ByRef Milliseconds subtractPut(@Const @ByRef Milliseconds d); + public native @Name("operator*=") @ByRef Milliseconds multiplyPut(@Const @ByRef long rhs); + public native @Name("operator%=") @ByRef Milliseconds modPut(@Const @ByRef long rhs); + public native @Name("operator%=") @ByRef Milliseconds modPut(@Const @ByRef Milliseconds rhs); + + public native long count(); + static public native @ByVal @Name("zero") Milliseconds zero_(); + static public native @ByVal Milliseconds min(); + static public native @ByVal Milliseconds max(); +} diff --git a/src/main/java/org/bytedeco/javacpp/chrono/Minutes.java b/src/main/java/org/bytedeco/javacpp/chrono/Minutes.java new file mode 100644 index 000000000..5e7c84146 --- /dev/null +++ b/src/main/java/org/bytedeco/javacpp/chrono/Minutes.java @@ -0,0 +1,29 @@ +package org.bytedeco.javacpp.chrono; + +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.javacpp.annotation.*; + +@Name("std::chrono::minutes") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) +public class Minutes extends Pointer { + public Minutes() { allocate(); } + private native void allocate(); + public Minutes(long r) { allocate(r); } + private native void allocate(long r); + public Minutes(Hours d) { allocate(d); } + private native void allocate(@Const @ByRef Hours d); + + public native @Name("operator=") @ByRef Minutes put(@Const @ByRef Minutes other); + public native @Name("operator-") @ByVal Minutes negate(); + public native @Name("operator++") @ByRef Minutes increment(); + public native @Name("operator--") @ByRef Minutes decrement(); + public native @Name("operator+=") @ByRef Minutes addPut(@Const @ByRef Minutes d); + public native @Name("operator-=") @ByRef Minutes subtractPut(@Const @ByRef Minutes d); + public native @Name("operator*=") @ByRef Minutes multiplyPut(@Const @ByRef int rhs); + public native @Name("operator%=") @ByRef Minutes modPut(@Const @ByRef int rhs); + public native @Name("operator%=") @ByRef Minutes modPut(@Const @ByRef Minutes rhs); + + public native int count(); + static public native @ByVal @Name("zero") Minutes zero_(); + static public native @ByVal Minutes min(); + static public native @ByVal Minutes max(); +} diff --git a/src/main/java/org/bytedeco/javacpp/chrono/Nanoseconds.java b/src/main/java/org/bytedeco/javacpp/chrono/Nanoseconds.java new file mode 100644 index 000000000..acae00d56 --- /dev/null +++ b/src/main/java/org/bytedeco/javacpp/chrono/Nanoseconds.java @@ -0,0 +1,43 @@ +package org.bytedeco.javacpp.chrono; + +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.javacpp.annotation.*; + +@Name("std::chrono::nanoseconds") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) +public class Nanoseconds extends Pointer { + public Nanoseconds() { allocate(); } + private native void allocate(); + public Nanoseconds(long r) { allocate(r); } + private native void allocate(long r); + public Nanoseconds(Microseconds d) { allocate(d); } + private native void allocate(@Const @ByRef Microseconds d); + public Nanoseconds(Milliseconds d) { allocate(d); } + private native void allocate(@Const @ByRef Milliseconds d); + public Nanoseconds(Seconds d) { allocate(d); } + private native void allocate(@Const @ByRef Seconds d); + public Nanoseconds(Minutes d) { allocate(d); } + private native void allocate(@Const @ByRef Minutes d); + public Nanoseconds(Hours d) { allocate(d); } + private native void allocate(@Const @ByRef Hours d); + public Nanoseconds(SystemDuration d) { super((Pointer)null); allocate(d); }; + private native void allocate(@Const @ByRef SystemDuration d); + public Nanoseconds(HighResolutionDuration d) { super((Pointer)null); allocate(d); }; + private native void allocate(@Const @ByRef HighResolutionDuration d); + public Nanoseconds(SteadyDuration d) { super((Pointer)null); allocate(d); }; + private native void allocate(@Const @ByRef SteadyDuration d); + + public native @Name("operator=") @ByRef Nanoseconds put(@Const @ByRef Nanoseconds other); + public native @Name("operator-") @ByVal Nanoseconds negate(); + public native @Name("operator++") @ByRef Nanoseconds increment(); + public native @Name("operator--") @ByRef Nanoseconds decrement(); + public native @Name("operator+=") @ByRef Nanoseconds addPut(@Const @ByRef Nanoseconds d); + public native @Name("operator-=") @ByRef Nanoseconds subtractPut(@Const @ByRef Nanoseconds d); + public native @Name("operator*=") @ByRef Nanoseconds multiplyPut(@Const @ByRef long rhs); + public native @Name("operator%=") @ByRef Nanoseconds modPut(@Const @ByRef long rhs); + public native @Name("operator%=") @ByRef Nanoseconds modPut(@Const @ByRef Nanoseconds rhs); + + public native long count(); + static public native @ByVal @Name("zero") Nanoseconds zero_(); + static public native @ByVal Nanoseconds min(); + static public native @ByVal Nanoseconds max(); +} diff --git a/src/main/java/org/bytedeco/javacpp/chrono/Seconds.java b/src/main/java/org/bytedeco/javacpp/chrono/Seconds.java new file mode 100644 index 000000000..6c3099f8d --- /dev/null +++ b/src/main/java/org/bytedeco/javacpp/chrono/Seconds.java @@ -0,0 +1,31 @@ +package org.bytedeco.javacpp.chrono; + +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.javacpp.annotation.*; + +@Name("std::chrono::seconds") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) +public class Seconds extends Pointer { + public Seconds() { allocate(); } + private native void allocate(); + public Seconds(long r) { allocate(r); } + private native void allocate(long r); + public Seconds(Minutes d) { allocate(d); } + private native void allocate(@Const @ByRef Minutes d); + public Seconds(Hours d) { allocate(d); } + private native void allocate(@Const @ByRef Hours d); + + public native @Name("operator=") @ByRef Seconds put(@Const @ByRef Seconds other); + public native @Name("operator-") @ByVal Seconds negate(); + public native @Name("operator++") @ByRef Seconds increment(); + public native @Name("operator--") @ByRef Seconds decrement(); + public native @Name("operator+=") @ByRef Seconds addPut(@Const @ByRef Seconds d); + public native @Name("operator-=") @ByRef Seconds subtractPut(@Const @ByRef Seconds d); + public native @Name("operator*=") @ByRef Seconds multiplyPut(@Const @ByRef long rhs); + public native @Name("operator%=") @ByRef Seconds modPut(@Const @ByRef long rhs); + public native @Name("operator%=") @ByRef Seconds modPut(@Const @ByRef Seconds rhs); + + public native long count(); + static public native @ByVal @Name("zero") Seconds zero_(); + static public native @ByVal Seconds min(); + static public native @ByVal Seconds max(); +} diff --git a/src/main/java/org/bytedeco/javacpp/chrono/SecondsDouble.java b/src/main/java/org/bytedeco/javacpp/chrono/SecondsDouble.java new file mode 100644 index 000000000..3f8ab9739 --- /dev/null +++ b/src/main/java/org/bytedeco/javacpp/chrono/SecondsDouble.java @@ -0,0 +1,29 @@ +package org.bytedeco.javacpp.chrono; + +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.javacpp.annotation.*; + +@Name("std::chrono::duration") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) +public class SecondsDouble extends Pointer { + public SecondsDouble() { allocate(); } + private native void allocate(); + public SecondsDouble(double r) { allocate(r); } + private native void allocate(double r); + public SecondsDouble(Nanoseconds d) { allocate(d); } + private native void allocate(@Const @ByRef Nanoseconds d); + public SecondsDouble(Seconds d) { allocate(d); } + private native void allocate(@Const @ByRef Seconds d); + + public native @Name("operator=") @ByRef SecondsDouble put(@Const @ByRef SecondsDouble other); + public native @Name("operator-") @ByVal SecondsDouble negate(); + public native @Name("operator++") @ByRef SecondsDouble increment(); + public native @Name("operator--") @ByRef SecondsDouble decrement(); + public native @Name("operator+=") @ByRef SecondsDouble addPut(@Const @ByRef SecondsDouble d); + public native @Name("operator-=") @ByRef SecondsDouble subtractPut(@Const @ByRef SecondsDouble d); + public native @Name("operator*=") @ByRef SecondsDouble multiplyPut(@Const @ByRef double rhs); + + public native double count(); + static public native @ByVal @Name("zero") SecondsDouble zero_(); + static public native @ByVal SecondsDouble min(); + static public native @ByVal SecondsDouble max(); +} diff --git a/src/main/java/org/bytedeco/javacpp/chrono/SecondsFloat.java b/src/main/java/org/bytedeco/javacpp/chrono/SecondsFloat.java new file mode 100644 index 000000000..ae1229722 --- /dev/null +++ b/src/main/java/org/bytedeco/javacpp/chrono/SecondsFloat.java @@ -0,0 +1,29 @@ +package org.bytedeco.javacpp.chrono; + +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.javacpp.annotation.*; + +@Name("std::chrono::duration") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) +public class SecondsFloat extends Pointer { + public SecondsFloat() { allocate(); } + private native void allocate(); + public SecondsFloat(float r) { allocate(r); } + private native void allocate(float r); + public SecondsFloat(Nanoseconds d) { allocate(d); } + private native void allocate(@Const @ByRef Nanoseconds d); + public SecondsFloat(Seconds d) { allocate(d); } + private native void allocate(@Const @ByRef Seconds d); + + public native @Name("operator=") @ByRef SecondsFloat put(@Const @ByRef SecondsFloat other); + public native @Name("operator-") @ByVal SecondsFloat negate(); + public native @Name("operator++") @ByRef SecondsFloat increment(); + public native @Name("operator--") @ByRef SecondsFloat decrement(); + public native @Name("operator+=") @ByRef SecondsFloat addPut(@Const @ByRef SecondsFloat d); + public native @Name("operator-=") @ByRef SecondsFloat subtractPut(@Const @ByRef SecondsFloat d); + public native @Name("operator*=") @ByRef SecondsFloat multiplyPut(@Const @ByRef float rhs); + + public native float count(); + static public native @ByVal @Name("zero") SecondsFloat zero_(); + static public native @ByVal SecondsFloat min(); + static public native @ByVal SecondsFloat max(); +} diff --git a/src/main/java/org/bytedeco/javacpp/chrono/SteadyClock.java b/src/main/java/org/bytedeco/javacpp/chrono/SteadyClock.java new file mode 100644 index 000000000..447f0cec1 --- /dev/null +++ b/src/main/java/org/bytedeco/javacpp/chrono/SteadyClock.java @@ -0,0 +1,11 @@ +package org.bytedeco.javacpp.chrono; + +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.javacpp.annotation.ByVal; +import org.bytedeco.javacpp.annotation.Name; +import org.bytedeco.javacpp.annotation.Properties; + +@Name("std::chrono::steady_clock") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) +public class SteadyClock extends Pointer { + static public native @ByVal SteadyTime now(); +} diff --git a/src/main/java/org/bytedeco/javacpp/chrono/SteadyDuration.java b/src/main/java/org/bytedeco/javacpp/chrono/SteadyDuration.java new file mode 100644 index 000000000..43adfa4e5 --- /dev/null +++ b/src/main/java/org/bytedeco/javacpp/chrono/SteadyDuration.java @@ -0,0 +1,26 @@ +package org.bytedeco.javacpp.chrono; + +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.javacpp.annotation.*; + +@Name("std::chrono::steady_clock::duration") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) +public class SteadyDuration extends Pointer { + public SteadyDuration() { allocate(); } + private native void allocate(); + public SteadyDuration(long r) { allocate(r); } + private native void allocate(long r); + + public native @Name("operator=") @ByRef SteadyDuration put(@Const @ByRef SteadyDuration other); + public native @Name("operator-") @ByVal SteadyDuration negate(); + public native @Name("operator++") @ByRef SteadyDuration increment(); + public native @Name("operator--") @ByRef SteadyDuration decrement(); + public native @Name("operator+=") @ByRef SteadyDuration addPut(@Const @ByRef SteadyDuration d); + public native @Name("operator-=") @ByRef SteadyDuration subtractPut(@Const @ByRef SteadyDuration d); + public native @Name("operator*=") @ByRef SteadyDuration multiplyPut(@Const @ByRef long rhs); + public native @Name("operator%=") @ByRef SteadyDuration modPut(@Const @ByRef long rhs); + public native @Name("operator%=") @ByRef SteadyDuration modPut(@Const @ByRef SteadyDuration rhs); + + public native long count(); + static public native @ByVal @Name("zero") SteadyDuration zero_(); + static public native @ByVal SteadyDuration min(); + static public native @ByVal SteadyDuration max();} diff --git a/src/main/java/org/bytedeco/javacpp/chrono/SteadyTime.java b/src/main/java/org/bytedeco/javacpp/chrono/SteadyTime.java new file mode 100644 index 000000000..280ae986e --- /dev/null +++ b/src/main/java/org/bytedeco/javacpp/chrono/SteadyTime.java @@ -0,0 +1,21 @@ +package org.bytedeco.javacpp.chrono; + +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.javacpp.annotation.*; + +@Name("std::chrono::time_point") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) +public class SteadyTime extends Pointer { + public SteadyTime() { allocate(); } + private native void allocate(); + + public SteadyTime(SteadyDuration d) { allocate(d); } + private native void allocate(@Const @ByRef SteadyDuration d); + + public native @ByVal SteadyDuration time_since_epoch(); + + public native @Name("operator +=") @ByRef SteadyTime addPut(@Const @ByRef SteadyDuration d); + public native @Name("operator -=") @ByRef SteadyTime subtractPut(@Const @ByRef SteadyDuration d); + static public native @ByVal SteadyTime min(); + static public native @ByVal SteadyTime max(); + +} diff --git a/src/main/java/org/bytedeco/javacpp/chrono/SystemClock.java b/src/main/java/org/bytedeco/javacpp/chrono/SystemClock.java new file mode 100644 index 000000000..a3b1c617c --- /dev/null +++ b/src/main/java/org/bytedeco/javacpp/chrono/SystemClock.java @@ -0,0 +1,11 @@ +package org.bytedeco.javacpp.chrono; + +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.javacpp.annotation.*; + +@Name("std::chrono::system_clock") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) +public class SystemClock extends Pointer { + static public native @ByVal SystemTime now(); + static public native @Cast("time_t") long to_time_t(@Const @ByRef SystemTime t); + static public native @ByVal SystemTime from_time_t(@Cast("time_t") long t); +} diff --git a/src/main/java/org/bytedeco/javacpp/chrono/SystemDuration.java b/src/main/java/org/bytedeco/javacpp/chrono/SystemDuration.java new file mode 100644 index 000000000..5c318d540 --- /dev/null +++ b/src/main/java/org/bytedeco/javacpp/chrono/SystemDuration.java @@ -0,0 +1,27 @@ +package org.bytedeco.javacpp.chrono; + +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.javacpp.annotation.*; + +@Name("std::chrono::system_clock::duration") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) +public class SystemDuration extends Pointer { + public SystemDuration() { allocate(); } + private native void allocate(); + public SystemDuration(long r) { allocate(r); } + private native void allocate(long r); + + public native @Name("operator=") @ByRef SystemDuration put(@Const @ByRef SystemDuration other); + public native @Name("operator-") @ByVal SystemDuration negate(); + public native @Name("operator++") @ByRef SystemDuration increment(); + public native @Name("operator--") @ByRef SystemDuration decrement(); + public native @Name("operator+=") @ByRef SystemDuration addPut(@Const @ByRef SystemDuration d); + public native @Name("operator-=") @ByRef SystemDuration subtractPut(@Const @ByRef SystemDuration d); + public native @Name("operator*=") @ByRef SystemDuration multiplyPut(@Const @ByRef long rhs); + public native @Name("operator%=") @ByRef SystemDuration modPut(@Const @ByRef long rhs); + public native @Name("operator%=") @ByRef SystemDuration modPut(@Const @ByRef SystemDuration rhs); + + public native long count(); + static public native @ByVal @Name("zero") SystemDuration zero_(); + static public native @ByVal SystemDuration min(); + static public native @ByVal SystemDuration max(); +} diff --git a/src/main/java/org/bytedeco/javacpp/chrono/SystemTime.java b/src/main/java/org/bytedeco/javacpp/chrono/SystemTime.java new file mode 100644 index 000000000..ecaeb3783 --- /dev/null +++ b/src/main/java/org/bytedeco/javacpp/chrono/SystemTime.java @@ -0,0 +1,20 @@ +package org.bytedeco.javacpp.chrono; + +import org.bytedeco.javacpp.Pointer; +import org.bytedeco.javacpp.annotation.*; + +@Name("std::chrono::time_point") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) +public class SystemTime extends Pointer { + public SystemTime() { allocate(); } + private native void allocate(); + + public SystemTime(SystemDuration d) { allocate(d); } + private native void allocate(@Const @ByRef SystemDuration d); + + public native @ByVal SystemDuration time_since_epoch(); + + public native @Name("operator +=") @ByRef SystemTime addPut(@Const @ByRef SystemDuration d); + public native @Name("operator -=") @ByRef SystemTime subtractPut(@Const @ByRef SystemDuration d); + static public native @ByVal SystemTime min(); + static public native @ByVal SystemTime max(); +} diff --git a/src/main/java/org/bytedeco/javacpp/global/chrono.java b/src/main/java/org/bytedeco/javacpp/global/chrono.java new file mode 100644 index 000000000..02ae14eb3 --- /dev/null +++ b/src/main/java/org/bytedeco/javacpp/global/chrono.java @@ -0,0 +1,7 @@ +package org.bytedeco.javacpp.global; + +import org.bytedeco.javacpp.annotation.Properties; + +@Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) +public class chrono { +} diff --git a/src/main/java/org/bytedeco/javacpp/presets/chrono.java b/src/main/java/org/bytedeco/javacpp/presets/chrono.java new file mode 100644 index 000000000..bcc98fe82 --- /dev/null +++ b/src/main/java/org/bytedeco/javacpp/presets/chrono.java @@ -0,0 +1,40 @@ +package org.bytedeco.javacpp.presets; + +import org.bytedeco.javacpp.annotation.Platform; +import org.bytedeco.javacpp.annotation.Properties; +import org.bytedeco.javacpp.tools.Info; +import org.bytedeco.javacpp.tools.InfoMap; +import org.bytedeco.javacpp.tools.InfoMapper; + +@Properties( + inherit = javacpp.class, + target = "org.bytedeco.javacpp.chrono", + global = "org.bytedeco.javacpp.global.chrono" +) +public class chrono implements InfoMapper { + @Override public void map(InfoMap infoMap) { + infoMap + .put(new Info("std::chrono::high_resolution_clock").pointerTypes("HighResolutionClock")) + .put(new Info("std::chrono::steady_clock").pointerTypes("SteadyClock")) + .put(new Info("std::chrono::system_clock").pointerTypes("SystemClock")) + + .put(new Info("std::chrono::time_point").pointerTypes("HighResolutionTime")) + .put(new Info("std::chrono::time_point").pointerTypes("SteadyTime")) + .put(new Info("std::chrono::time_point").pointerTypes("SystemTime")) + + .put(new Info("std::chrono::high_resolution_clock::duration").pointerTypes("HighResolutionDuration")) + .put(new Info("std::chrono::steady_clock::duration").pointerTypes("SteadyDuration")) + .put(new Info("std::chrono::system_clock::duration").pointerTypes("SystemDuration")) + + .put(new Info("std::chrono::hours").pointerTypes("Hours")) + .put(new Info("std::chrono::minutes").pointerTypes("Minutes")) + .put(new Info("std::chrono::seconds", "std::chrono::duration", "std::chrono::duration >", "std::chrono::duration >").pointerTypes("Seconds")) + .put(new Info("std::chrono::milliseconds", "std::chrono::duration", "std::chrono::duration >").pointerTypes("Milliseconds")) + .put(new Info("std::chrono::microseconds", "std::chrono::duration", "std::chrono::duration >").pointerTypes("Microseconds")) + .put(new Info("std::chrono::nanoseconds", "std::chrono::duration", "std::chrono::duration >").pointerTypes("Nanoseconds")) + + .put(new Info("std::chrono::duration", "std::chrono::duration >", "std::chrono::duration >").pointerTypes("SecondsFloat")) + .put(new Info("std::chrono::duration", "std::chrono::duration >", "std::chrono::duration >").pointerTypes("SecondsDouble")) + ; + } +} diff --git a/src/main/java/org/bytedeco/javacpp/tools/Generator.java b/src/main/java/org/bytedeco/javacpp/tools/Generator.java index 52b5ff3f9..e703ca315 100644 --- a/src/main/java/org/bytedeco/javacpp/tools/Generator.java +++ b/src/main/java/org/bytedeco/javacpp/tools/Generator.java @@ -365,6 +365,7 @@ boolean classes(boolean handleExceptions, boolean defineAdapters, boolean conver out.println("#include "); out.println("#include "); out.println("#include "); + out.println("#include "); if (baseLoadSuffix == null || baseLoadSuffix.isEmpty()) { out.println(); out.println("#if defined(NATIVE_ALLOCATOR) && defined(NATIVE_DEALLOCATOR)"); diff --git a/src/main/java/org/bytedeco/javacpp/tools/Parser.java b/src/main/java/org/bytedeco/javacpp/tools/Parser.java index eaaf3222b..7709dac42 100644 --- a/src/main/java/org/bytedeco/javacpp/tools/Parser.java +++ b/src/main/java/org/bytedeco/javacpp/tools/Parser.java @@ -3539,13 +3539,13 @@ boolean group(Context context, DeclarationList declList) throws ParserException Context ctx = new Context(context); Token[] prefixes = {Token.CLASS, Token.INTERFACE, Token.__INTERFACE, Token.STRUCT, Token.UNION}; for (Token token = tokens.get(); !token.match(Token.EOF); token = tokens.next()) { - if (token.match(prefixes)) { + if (token.match((Object[]) prefixes)) { foundGroup = true; ctx.inaccessible = token.match(Token.CLASS); break; } else if (token.match(Token.FRIEND)) { friend = true; - if (!tokens.get(1).match(prefixes)) { + if (!tokens.get(1).match((Object[]) prefixes)) { // assume group name follows foundGroup = true; break; diff --git a/src/main/java9/module-info.java b/src/main/java9/module-info.java index 50f5c8e81..2be2d574e 100644 --- a/src/main/java9/module-info.java +++ b/src/main/java9/module-info.java @@ -2,6 +2,8 @@ requires jdk.unsupported; exports org.bytedeco.javacpp; exports org.bytedeco.javacpp.annotation; + exports org.bytedeco.javacpp.chrono; + exports org.bytedeco.javacpp.global; exports org.bytedeco.javacpp.indexer; exports org.bytedeco.javacpp.tools; exports org.bytedeco.javacpp.presets;