From c8bf6e07789b85209bc3dc0f6e0d3529369e9313 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Guillemet?= Date: Tue, 2 Jul 2024 14:27:29 +0200 Subject: [PATCH 01/11] Add mapping for `std::chrono` --- pom.xml | 1 + .../javacpp/chrono/HighResolutionClock.java | 13 +++++++ .../chrono/HighResolutionDuration.java | 27 ++++++++++++++ .../javacpp/chrono/HighResolutionTime.java | 20 ++++++++++ .../org/bytedeco/javacpp/chrono/Hours.java | 27 ++++++++++++++ .../bytedeco/javacpp/chrono/Microseconds.java | 36 ++++++++++++++++++ .../bytedeco/javacpp/chrono/Milliseconds.java | 33 +++++++++++++++++ .../org/bytedeco/javacpp/chrono/Minutes.java | 29 +++++++++++++++ .../bytedeco/javacpp/chrono/Nanoseconds.java | 37 +++++++++++++++++++ .../org/bytedeco/javacpp/chrono/Seconds.java | 31 ++++++++++++++++ .../javacpp/chrono/SecondsDouble.java | 29 +++++++++++++++ .../bytedeco/javacpp/chrono/SecondsFloat.java | 29 +++++++++++++++ .../bytedeco/javacpp/chrono/SteadyClock.java | 11 ++++++ .../javacpp/chrono/SteadyDuration.java | 26 +++++++++++++ .../bytedeco/javacpp/chrono/SteadyTime.java | 21 +++++++++++ .../bytedeco/javacpp/chrono/SystemClock.java | 11 ++++++ .../javacpp/chrono/SystemDuration.java | 27 ++++++++++++++ .../bytedeco/javacpp/chrono/SystemTime.java | 20 ++++++++++ .../org/bytedeco/javacpp/tools/Generator.java | 1 + 19 files changed, 429 insertions(+) create mode 100644 src/main/java/org/bytedeco/javacpp/chrono/HighResolutionClock.java create mode 100644 src/main/java/org/bytedeco/javacpp/chrono/HighResolutionDuration.java create mode 100644 src/main/java/org/bytedeco/javacpp/chrono/HighResolutionTime.java create mode 100644 src/main/java/org/bytedeco/javacpp/chrono/Hours.java create mode 100644 src/main/java/org/bytedeco/javacpp/chrono/Microseconds.java create mode 100644 src/main/java/org/bytedeco/javacpp/chrono/Milliseconds.java create mode 100644 src/main/java/org/bytedeco/javacpp/chrono/Minutes.java create mode 100644 src/main/java/org/bytedeco/javacpp/chrono/Nanoseconds.java create mode 100644 src/main/java/org/bytedeco/javacpp/chrono/Seconds.java create mode 100644 src/main/java/org/bytedeco/javacpp/chrono/SecondsDouble.java create mode 100644 src/main/java/org/bytedeco/javacpp/chrono/SecondsFloat.java create mode 100644 src/main/java/org/bytedeco/javacpp/chrono/SteadyClock.java create mode 100644 src/main/java/org/bytedeco/javacpp/chrono/SteadyDuration.java create mode 100644 src/main/java/org/bytedeco/javacpp/chrono/SteadyTime.java create mode 100644 src/main/java/org/bytedeco/javacpp/chrono/SystemClock.java create mode 100644 src/main/java/org/bytedeco/javacpp/chrono/SystemDuration.java create mode 100644 src/main/java/org/bytedeco/javacpp/chrono/SystemTime.java diff --git a/pom.xml b/pom.xml index bb62478e..f0204a4a 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 00000000..4e8c021c --- /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.javacpp.class) +public class HighResolutionClock extends Pointer { + static public native @ByVal SystemTime 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 00000000..d880dbd9 --- /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.javacpp.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 00000000..9dcdc79a --- /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.javacpp.class) +public class HighResolutionTime extends Pointer { + public HighResolutionTime() { allocate(); } + private native void allocate(); + + public HighResolutionTime(SystemDuration d) { allocate(d); } + private native void allocate(@Const @ByRef SystemDuration 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 00000000..f8b35bda --- /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.javacpp.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 00000000..7cf3bb2e --- /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.javacpp.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 00000000..31ddc372 --- /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.javacpp.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 00000000..3ec9caba --- /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.javacpp.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 00000000..534cbd0e --- /dev/null +++ b/src/main/java/org/bytedeco/javacpp/chrono/Nanoseconds.java @@ -0,0 +1,37 @@ +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.javacpp.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 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 00000000..8c5666cd --- /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.javacpp.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 00000000..912d2575 --- /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.javacpp.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 00000000..bdf19178 --- /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.javacpp.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 00000000..e2a8502c --- /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.javacpp.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 00000000..a95abe15 --- /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.javacpp.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 00000000..b2ec2c24 --- /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.javacpp.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 00000000..63c0a3ac --- /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.javacpp.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 00000000..e3b1508e --- /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.javacpp.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 00000000..4b388da8 --- /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.javacpp.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/tools/Generator.java b/src/main/java/org/bytedeco/javacpp/tools/Generator.java index 52b5ff3f..e703ca31 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)"); From adaa60d9ba78ea4bdfc81eb5c7dad5633c00de49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Guillemet?= Date: Tue, 2 Jul 2024 17:04:02 +0200 Subject: [PATCH 02/11] Fix HighResolutionClock.now return type --- .../java/org/bytedeco/javacpp/chrono/HighResolutionClock.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionClock.java b/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionClock.java index 4e8c021c..c8f44d0f 100644 --- a/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionClock.java +++ b/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionClock.java @@ -8,6 +8,6 @@ @Name("std::chrono::high_resolution_clock") @Properties(inherit = org.bytedeco.javacpp.presets.javacpp.class) public class HighResolutionClock extends Pointer { - static public native @ByVal SystemTime now(); + static public native @ByVal HighResolutionTime now(); static public native @MemberGetter boolean is_steady(); } From eab2f689388c8ea1254b663d63c9d341d5e9d4ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Guillemet?= Date: Tue, 2 Jul 2024 17:04:28 +0200 Subject: [PATCH 03/11] Add Nanoseconds constructors for system durations --- src/main/java/org/bytedeco/javacpp/chrono/Nanoseconds.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/org/bytedeco/javacpp/chrono/Nanoseconds.java b/src/main/java/org/bytedeco/javacpp/chrono/Nanoseconds.java index 534cbd0e..462a23e8 100644 --- a/src/main/java/org/bytedeco/javacpp/chrono/Nanoseconds.java +++ b/src/main/java/org/bytedeco/javacpp/chrono/Nanoseconds.java @@ -19,6 +19,12 @@ public class Nanoseconds extends Pointer { 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(); From 84958c0298ca9c320edc5d65e1e28d0a9eec8b60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Guillemet?= Date: Tue, 9 Jul 2024 08:10:14 +0200 Subject: [PATCH 04/11] Fix HighResolutionTime constructors --- .../java/org/bytedeco/javacpp/chrono/HighResolutionTime.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionTime.java b/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionTime.java index 9dcdc79a..b21658d2 100644 --- a/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionTime.java +++ b/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionTime.java @@ -8,8 +8,8 @@ public class HighResolutionTime extends Pointer { public HighResolutionTime() { allocate(); } private native void allocate(); - public HighResolutionTime(SystemDuration d) { allocate(d); } - private native void allocate(@Const @ByRef SystemDuration d); + public HighResolutionTime(HighResolutionDuration d) { allocate(d); } + private native void allocate(@Const @ByRef HighResolutionDuration d); public native @ByVal HighResolutionTime time_since_epoch(); From 1df34fb53ed5d098f035b5990057363cf5594c74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Guillemet?= Date: Thu, 1 Aug 2024 14:51:58 +0200 Subject: [PATCH 05/11] Update macos github runners --- .github/workflows/javacpp.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/javacpp.yml b/.github/workflows/javacpp.yml index 816a94af..c6456f0d 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: From 68059f084a9caa979bc7d543d0c39f12cbbf3cbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Guillemet?= Date: Fri, 2 Aug 2024 09:15:04 +0200 Subject: [PATCH 06/11] Add chrono presets --- src/main/java/org/bytedeco/javacpp/chrono/Chrono.java | 4 ++++ src/main/java/org/bytedeco/javacpp/presets/chrono.java | 10 ++++++++++ src/main/java/org/bytedeco/javacpp/tools/Parser.java | 4 ++-- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 src/main/java/org/bytedeco/javacpp/chrono/Chrono.java create mode 100644 src/main/java/org/bytedeco/javacpp/presets/chrono.java diff --git a/src/main/java/org/bytedeco/javacpp/chrono/Chrono.java b/src/main/java/org/bytedeco/javacpp/chrono/Chrono.java new file mode 100644 index 00000000..0d522845 --- /dev/null +++ b/src/main/java/org/bytedeco/javacpp/chrono/Chrono.java @@ -0,0 +1,4 @@ +package org.bytedeco.javacpp.chrono; + +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 00000000..49642fd3 --- /dev/null +++ b/src/main/java/org/bytedeco/javacpp/presets/chrono.java @@ -0,0 +1,10 @@ +package org.bytedeco.javacpp.presets; + +import org.bytedeco.javacpp.annotation.Properties; + +@Properties( + target = "org.bytedeco.javacpp.chrono", + global = "org.bytedeco.javacpp.chrono.Chrono" +) +public class chrono { +} diff --git a/src/main/java/org/bytedeco/javacpp/tools/Parser.java b/src/main/java/org/bytedeco/javacpp/tools/Parser.java index eaaf3222..7709dac4 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; From 1e2bf0858dde8534aef5dc8ce9c4f463bc211cd6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Guillemet?= Date: Fri, 2 Aug 2024 12:37:47 +0200 Subject: [PATCH 07/11] Make all chrono classes properties inherit from chrono presets --- src/main/java/org/bytedeco/javacpp/chrono/Chrono.java | 3 +++ .../java/org/bytedeco/javacpp/chrono/HighResolutionClock.java | 2 +- .../org/bytedeco/javacpp/chrono/HighResolutionDuration.java | 2 +- .../java/org/bytedeco/javacpp/chrono/HighResolutionTime.java | 2 +- src/main/java/org/bytedeco/javacpp/chrono/Hours.java | 2 +- src/main/java/org/bytedeco/javacpp/chrono/Microseconds.java | 2 +- src/main/java/org/bytedeco/javacpp/chrono/Milliseconds.java | 2 +- src/main/java/org/bytedeco/javacpp/chrono/Minutes.java | 2 +- src/main/java/org/bytedeco/javacpp/chrono/Nanoseconds.java | 2 +- src/main/java/org/bytedeco/javacpp/chrono/Seconds.java | 2 +- src/main/java/org/bytedeco/javacpp/chrono/SecondsDouble.java | 2 +- src/main/java/org/bytedeco/javacpp/chrono/SecondsFloat.java | 2 +- src/main/java/org/bytedeco/javacpp/chrono/SteadyClock.java | 2 +- src/main/java/org/bytedeco/javacpp/chrono/SteadyDuration.java | 2 +- src/main/java/org/bytedeco/javacpp/chrono/SteadyTime.java | 2 +- src/main/java/org/bytedeco/javacpp/chrono/SystemClock.java | 2 +- src/main/java/org/bytedeco/javacpp/chrono/SystemDuration.java | 2 +- src/main/java/org/bytedeco/javacpp/chrono/SystemTime.java | 2 +- src/main/java/org/bytedeco/javacpp/presets/chrono.java | 1 + 19 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/main/java/org/bytedeco/javacpp/chrono/Chrono.java b/src/main/java/org/bytedeco/javacpp/chrono/Chrono.java index 0d522845..c2eb2304 100644 --- a/src/main/java/org/bytedeco/javacpp/chrono/Chrono.java +++ b/src/main/java/org/bytedeco/javacpp/chrono/Chrono.java @@ -1,4 +1,7 @@ package org.bytedeco.javacpp.chrono; +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/chrono/HighResolutionClock.java b/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionClock.java index c8f44d0f..30b314ae 100644 --- a/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionClock.java +++ b/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionClock.java @@ -6,7 +6,7 @@ import org.bytedeco.javacpp.annotation.Name; import org.bytedeco.javacpp.annotation.Properties; -@Name("std::chrono::high_resolution_clock") @Properties(inherit = org.bytedeco.javacpp.presets.javacpp.class) +@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 index d880dbd9..93b84a00 100644 --- a/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionDuration.java +++ b/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionDuration.java @@ -3,7 +3,7 @@ import org.bytedeco.javacpp.Pointer; import org.bytedeco.javacpp.annotation.*; -@Name("std::chrono::high_resolution_clock::duration") @Properties(inherit = org.bytedeco.javacpp.presets.javacpp.class) +@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(); diff --git a/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionTime.java b/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionTime.java index b21658d2..d00eb132 100644 --- a/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionTime.java +++ b/src/main/java/org/bytedeco/javacpp/chrono/HighResolutionTime.java @@ -3,7 +3,7 @@ import org.bytedeco.javacpp.Pointer; import org.bytedeco.javacpp.annotation.*; -@Name("std::chrono::time_point") @Properties(inherit = org.bytedeco.javacpp.presets.javacpp.class) +@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(); diff --git a/src/main/java/org/bytedeco/javacpp/chrono/Hours.java b/src/main/java/org/bytedeco/javacpp/chrono/Hours.java index f8b35bda..a269e44a 100644 --- a/src/main/java/org/bytedeco/javacpp/chrono/Hours.java +++ b/src/main/java/org/bytedeco/javacpp/chrono/Hours.java @@ -3,7 +3,7 @@ import org.bytedeco.javacpp.Pointer; import org.bytedeco.javacpp.annotation.*; -@Name("std::chrono::hours") @Properties(inherit = org.bytedeco.javacpp.presets.javacpp.class) +@Name("std::chrono::hours") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) public class Hours extends Pointer { public Hours() { allocate(); } private native void allocate(); diff --git a/src/main/java/org/bytedeco/javacpp/chrono/Microseconds.java b/src/main/java/org/bytedeco/javacpp/chrono/Microseconds.java index 7cf3bb2e..1fe62298 100644 --- a/src/main/java/org/bytedeco/javacpp/chrono/Microseconds.java +++ b/src/main/java/org/bytedeco/javacpp/chrono/Microseconds.java @@ -3,7 +3,7 @@ import org.bytedeco.javacpp.Pointer; import org.bytedeco.javacpp.annotation.*; -@Name("std::chrono::microseconds") @Properties(inherit = org.bytedeco.javacpp.presets.javacpp.class) +@Name("std::chrono::microseconds") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) public class Microseconds extends Pointer { public Microseconds() { allocate(); } private native void allocate(); diff --git a/src/main/java/org/bytedeco/javacpp/chrono/Milliseconds.java b/src/main/java/org/bytedeco/javacpp/chrono/Milliseconds.java index 31ddc372..202f412e 100644 --- a/src/main/java/org/bytedeco/javacpp/chrono/Milliseconds.java +++ b/src/main/java/org/bytedeco/javacpp/chrono/Milliseconds.java @@ -3,7 +3,7 @@ import org.bytedeco.javacpp.Pointer; import org.bytedeco.javacpp.annotation.*; -@Name("std::chrono::milliseconds") @Properties(inherit = org.bytedeco.javacpp.presets.javacpp.class) +@Name("std::chrono::milliseconds") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) public class Milliseconds extends Pointer { public Milliseconds() { allocate(); } private native void allocate(); diff --git a/src/main/java/org/bytedeco/javacpp/chrono/Minutes.java b/src/main/java/org/bytedeco/javacpp/chrono/Minutes.java index 3ec9caba..5e7c8414 100644 --- a/src/main/java/org/bytedeco/javacpp/chrono/Minutes.java +++ b/src/main/java/org/bytedeco/javacpp/chrono/Minutes.java @@ -3,7 +3,7 @@ import org.bytedeco.javacpp.Pointer; import org.bytedeco.javacpp.annotation.*; -@Name("std::chrono::minutes") @Properties(inherit = org.bytedeco.javacpp.presets.javacpp.class) +@Name("std::chrono::minutes") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) public class Minutes extends Pointer { public Minutes() { allocate(); } private native void allocate(); diff --git a/src/main/java/org/bytedeco/javacpp/chrono/Nanoseconds.java b/src/main/java/org/bytedeco/javacpp/chrono/Nanoseconds.java index 462a23e8..acae00d5 100644 --- a/src/main/java/org/bytedeco/javacpp/chrono/Nanoseconds.java +++ b/src/main/java/org/bytedeco/javacpp/chrono/Nanoseconds.java @@ -3,7 +3,7 @@ import org.bytedeco.javacpp.Pointer; import org.bytedeco.javacpp.annotation.*; -@Name("std::chrono::nanoseconds") @Properties(inherit = org.bytedeco.javacpp.presets.javacpp.class) +@Name("std::chrono::nanoseconds") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) public class Nanoseconds extends Pointer { public Nanoseconds() { allocate(); } private native void allocate(); diff --git a/src/main/java/org/bytedeco/javacpp/chrono/Seconds.java b/src/main/java/org/bytedeco/javacpp/chrono/Seconds.java index 8c5666cd..6c3099f8 100644 --- a/src/main/java/org/bytedeco/javacpp/chrono/Seconds.java +++ b/src/main/java/org/bytedeco/javacpp/chrono/Seconds.java @@ -3,7 +3,7 @@ import org.bytedeco.javacpp.Pointer; import org.bytedeco.javacpp.annotation.*; -@Name("std::chrono::seconds") @Properties(inherit = org.bytedeco.javacpp.presets.javacpp.class) +@Name("std::chrono::seconds") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) public class Seconds extends Pointer { public Seconds() { allocate(); } private native void allocate(); diff --git a/src/main/java/org/bytedeco/javacpp/chrono/SecondsDouble.java b/src/main/java/org/bytedeco/javacpp/chrono/SecondsDouble.java index 912d2575..3f8ab973 100644 --- a/src/main/java/org/bytedeco/javacpp/chrono/SecondsDouble.java +++ b/src/main/java/org/bytedeco/javacpp/chrono/SecondsDouble.java @@ -3,7 +3,7 @@ import org.bytedeco.javacpp.Pointer; import org.bytedeco.javacpp.annotation.*; -@Name("std::chrono::duration") @Properties(inherit = org.bytedeco.javacpp.presets.javacpp.class) +@Name("std::chrono::duration") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) public class SecondsDouble extends Pointer { public SecondsDouble() { allocate(); } private native void allocate(); diff --git a/src/main/java/org/bytedeco/javacpp/chrono/SecondsFloat.java b/src/main/java/org/bytedeco/javacpp/chrono/SecondsFloat.java index bdf19178..ae122972 100644 --- a/src/main/java/org/bytedeco/javacpp/chrono/SecondsFloat.java +++ b/src/main/java/org/bytedeco/javacpp/chrono/SecondsFloat.java @@ -3,7 +3,7 @@ import org.bytedeco.javacpp.Pointer; import org.bytedeco.javacpp.annotation.*; -@Name("std::chrono::duration") @Properties(inherit = org.bytedeco.javacpp.presets.javacpp.class) +@Name("std::chrono::duration") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) public class SecondsFloat extends Pointer { public SecondsFloat() { allocate(); } private native void allocate(); diff --git a/src/main/java/org/bytedeco/javacpp/chrono/SteadyClock.java b/src/main/java/org/bytedeco/javacpp/chrono/SteadyClock.java index e2a8502c..447f0cec 100644 --- a/src/main/java/org/bytedeco/javacpp/chrono/SteadyClock.java +++ b/src/main/java/org/bytedeco/javacpp/chrono/SteadyClock.java @@ -5,7 +5,7 @@ import org.bytedeco.javacpp.annotation.Name; import org.bytedeco.javacpp.annotation.Properties; -@Name("std::chrono::steady_clock") @Properties(inherit = org.bytedeco.javacpp.presets.javacpp.class) +@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 index a95abe15..43adfa4e 100644 --- a/src/main/java/org/bytedeco/javacpp/chrono/SteadyDuration.java +++ b/src/main/java/org/bytedeco/javacpp/chrono/SteadyDuration.java @@ -3,7 +3,7 @@ import org.bytedeco.javacpp.Pointer; import org.bytedeco.javacpp.annotation.*; -@Name("std::chrono::steady_clock::duration") @Properties(inherit = org.bytedeco.javacpp.presets.javacpp.class) +@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(); diff --git a/src/main/java/org/bytedeco/javacpp/chrono/SteadyTime.java b/src/main/java/org/bytedeco/javacpp/chrono/SteadyTime.java index b2ec2c24..280ae986 100644 --- a/src/main/java/org/bytedeco/javacpp/chrono/SteadyTime.java +++ b/src/main/java/org/bytedeco/javacpp/chrono/SteadyTime.java @@ -3,7 +3,7 @@ import org.bytedeco.javacpp.Pointer; import org.bytedeco.javacpp.annotation.*; -@Name("std::chrono::time_point") @Properties(inherit = org.bytedeco.javacpp.presets.javacpp.class) +@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(); diff --git a/src/main/java/org/bytedeco/javacpp/chrono/SystemClock.java b/src/main/java/org/bytedeco/javacpp/chrono/SystemClock.java index 63c0a3ac..a3b1c617 100644 --- a/src/main/java/org/bytedeco/javacpp/chrono/SystemClock.java +++ b/src/main/java/org/bytedeco/javacpp/chrono/SystemClock.java @@ -3,7 +3,7 @@ import org.bytedeco.javacpp.Pointer; import org.bytedeco.javacpp.annotation.*; -@Name("std::chrono::system_clock") @Properties(inherit = org.bytedeco.javacpp.presets.javacpp.class) +@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); diff --git a/src/main/java/org/bytedeco/javacpp/chrono/SystemDuration.java b/src/main/java/org/bytedeco/javacpp/chrono/SystemDuration.java index e3b1508e..5c318d54 100644 --- a/src/main/java/org/bytedeco/javacpp/chrono/SystemDuration.java +++ b/src/main/java/org/bytedeco/javacpp/chrono/SystemDuration.java @@ -3,7 +3,7 @@ import org.bytedeco.javacpp.Pointer; import org.bytedeco.javacpp.annotation.*; -@Name("std::chrono::system_clock::duration") @Properties(inherit = org.bytedeco.javacpp.presets.javacpp.class) +@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(); diff --git a/src/main/java/org/bytedeco/javacpp/chrono/SystemTime.java b/src/main/java/org/bytedeco/javacpp/chrono/SystemTime.java index 4b388da8..ecaeb378 100644 --- a/src/main/java/org/bytedeco/javacpp/chrono/SystemTime.java +++ b/src/main/java/org/bytedeco/javacpp/chrono/SystemTime.java @@ -3,7 +3,7 @@ import org.bytedeco.javacpp.Pointer; import org.bytedeco.javacpp.annotation.*; -@Name("std::chrono::time_point") @Properties(inherit = org.bytedeco.javacpp.presets.javacpp.class) +@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(); diff --git a/src/main/java/org/bytedeco/javacpp/presets/chrono.java b/src/main/java/org/bytedeco/javacpp/presets/chrono.java index 49642fd3..db01d334 100644 --- a/src/main/java/org/bytedeco/javacpp/presets/chrono.java +++ b/src/main/java/org/bytedeco/javacpp/presets/chrono.java @@ -3,6 +3,7 @@ import org.bytedeco.javacpp.annotation.Properties; @Properties( + inherit = javacpp.class, target = "org.bytedeco.javacpp.chrono", global = "org.bytedeco.javacpp.chrono.Chrono" ) From 2f6b900835ebeddff4eb3ae9bc58e7d9cb7ed2c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Guillemet?= Date: Fri, 2 Aug 2024 15:19:30 +0200 Subject: [PATCH 08/11] Add info maps for chrono --- .../org/bytedeco/javacpp/presets/chrono.java | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bytedeco/javacpp/presets/chrono.java b/src/main/java/org/bytedeco/javacpp/presets/chrono.java index db01d334..70ff5687 100644 --- a/src/main/java/org/bytedeco/javacpp/presets/chrono.java +++ b/src/main/java/org/bytedeco/javacpp/presets/chrono.java @@ -1,11 +1,39 @@ package org.bytedeco.javacpp.presets; 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.chrono.Chrono" ) -public class 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")) + ; + } } From 34ee30e653141687832692ab9954b1365d4439bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Guillemet?= Date: Sat, 3 Aug 2024 08:42:23 +0200 Subject: [PATCH 09/11] Add chrono to `module-info.java` --- src/main/java9/module-info.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java9/module-info.java b/src/main/java9/module-info.java index 50f5c8e8..0000ac8f 100644 --- a/src/main/java9/module-info.java +++ b/src/main/java9/module-info.java @@ -2,6 +2,7 @@ requires jdk.unsupported; exports org.bytedeco.javacpp; exports org.bytedeco.javacpp.annotation; + exports org.bytedeco.javacpp.chrono; exports org.bytedeco.javacpp.indexer; exports org.bytedeco.javacpp.tools; exports org.bytedeco.javacpp.presets; From 09e6f5f030c7e5db1eec7f8be13cb560b3ee5799 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Guillemet?= Date: Sat, 3 Aug 2024 12:13:37 +0200 Subject: [PATCH 10/11] Rename chrono.Chrono to global.chrono --- .../javacpp/{chrono/Chrono.java => global/chrono.java} | 4 ++-- src/main/java/org/bytedeco/javacpp/presets/chrono.java | 3 ++- src/main/java9/module-info.java | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) rename src/main/java/org/bytedeco/javacpp/{chrono/Chrono.java => global/chrono.java} (67%) diff --git a/src/main/java/org/bytedeco/javacpp/chrono/Chrono.java b/src/main/java/org/bytedeco/javacpp/global/chrono.java similarity index 67% rename from src/main/java/org/bytedeco/javacpp/chrono/Chrono.java rename to src/main/java/org/bytedeco/javacpp/global/chrono.java index c2eb2304..02ae14eb 100644 --- a/src/main/java/org/bytedeco/javacpp/chrono/Chrono.java +++ b/src/main/java/org/bytedeco/javacpp/global/chrono.java @@ -1,7 +1,7 @@ -package org.bytedeco.javacpp.chrono; +package org.bytedeco.javacpp.global; import org.bytedeco.javacpp.annotation.Properties; @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class) -public class Chrono { +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 index 70ff5687..bcc98fe8 100644 --- a/src/main/java/org/bytedeco/javacpp/presets/chrono.java +++ b/src/main/java/org/bytedeco/javacpp/presets/chrono.java @@ -1,5 +1,6 @@ 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; @@ -8,7 +9,7 @@ @Properties( inherit = javacpp.class, target = "org.bytedeco.javacpp.chrono", - global = "org.bytedeco.javacpp.chrono.Chrono" + global = "org.bytedeco.javacpp.global.chrono" ) public class chrono implements InfoMapper { @Override public void map(InfoMap infoMap) { diff --git a/src/main/java9/module-info.java b/src/main/java9/module-info.java index 0000ac8f..2be2d574 100644 --- a/src/main/java9/module-info.java +++ b/src/main/java9/module-info.java @@ -3,6 +3,7 @@ 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; From c5498749347778da68591969c00e220bb9a76950 Mon Sep 17 00:00:00 2001 From: Samuel Audet Date: Sun, 4 Aug 2024 09:16:30 +0900 Subject: [PATCH 11/11] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 908e7f6b..63b379e7 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))