Skip to content

Commit 2fd35c6

Browse files
authored
* Add minimal mappings for std::chrono from C++11 (pull bytedeco#766)
1 parent a506820 commit 2fd35c6

25 files changed

+491
-6
lines changed

.github/workflows/javacpp.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ jobs:
2626
steps:
2727
- uses: bytedeco/javacpp-presets/.github/actions/deploy-ubuntu@actions
2828
ios-arm64:
29-
runs-on: macos-11
29+
runs-on: macos-14
3030
steps:
3131
- uses: bytedeco/javacpp-presets/.github/actions/deploy-macosx@actions
3232
ios-x86_64:
33-
runs-on: macos-11
33+
runs-on: macos-12
3434
steps:
3535
- uses: bytedeco/javacpp-presets/.github/actions/deploy-macosx@actions
3636
# linux-armhf:
@@ -56,11 +56,11 @@ jobs:
5656
steps:
5757
- uses: bytedeco/javacpp-presets/.github/actions/deploy-ubuntu@actions
5858
macosx-arm64:
59-
runs-on: macos-11
59+
runs-on: macos-14
6060
steps:
6161
- uses: bytedeco/javacpp-presets/.github/actions/deploy-macosx@actions
6262
macosx-x86_64:
63-
runs-on: macos-11
63+
runs-on: macos-12
6464
env:
6565
CI_DEPLOY_OPTIONS: "" # to not skip tests
6666
steps:

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11

2+
* Add minimal mappings for `std::chrono` from C++11 ([pull #766](https://github.com/bytedeco/javacpp/pull/766))
23
* Let `Parser` annotate Java constructors with `@Deprecated` when appropriate ([pull #757](https://github.com/bytedeco/javacpp/pull/757))
34
* Add to `InfoMap.defaults` more names that are reserved in Java, but not in C++ ([pull #757](https://github.com/bytedeco/javacpp/pull/757))
45
* Bundle `libomp` from Visual Studio to fix presets using OpenMP on Windows ([pull #755](https://github.com/bytedeco/javacpp/pull/755))

pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,7 @@ Import-Package: \
461461
<argument>-Dplatform.compiler=${javacpp.platform.compiler}</argument>
462462
<argument>org.bytedeco.javacpp.Pointer</argument>
463463
<argument>org.bytedeco.javacpp.presets.javacpp</argument>
464+
<argument>org.bytedeco.javacpp.chrono.*</argument>
464465
<argument>-mod</argument>
465466
<argument>${project.build.directory}/generated-sources/java9/module-info.java</argument>
466467
</arguments>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package org.bytedeco.javacpp.chrono;
2+
3+
import org.bytedeco.javacpp.Pointer;
4+
import org.bytedeco.javacpp.annotation.ByVal;
5+
import org.bytedeco.javacpp.annotation.MemberGetter;
6+
import org.bytedeco.javacpp.annotation.Name;
7+
import org.bytedeco.javacpp.annotation.Properties;
8+
9+
@Name("std::chrono::high_resolution_clock") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class)
10+
public class HighResolutionClock extends Pointer {
11+
static public native @ByVal HighResolutionTime now();
12+
static public native @MemberGetter boolean is_steady();
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package org.bytedeco.javacpp.chrono;
2+
3+
import org.bytedeco.javacpp.Pointer;
4+
import org.bytedeco.javacpp.annotation.*;
5+
6+
@Name("std::chrono::high_resolution_clock::duration") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class)
7+
public class HighResolutionDuration extends Pointer {
8+
public HighResolutionDuration() { allocate(); }
9+
private native void allocate();
10+
public HighResolutionDuration(long r) { allocate(r); }
11+
private native void allocate(long r);
12+
13+
public native @Name("operator=") @ByRef HighResolutionDuration put(@Const @ByRef HighResolutionDuration other);
14+
public native @Name("operator-") @ByVal HighResolutionDuration negate();
15+
public native @Name("operator++") @ByRef HighResolutionDuration increment();
16+
public native @Name("operator--") @ByRef HighResolutionDuration decrement();
17+
public native @Name("operator+=") @ByRef HighResolutionDuration addPut(@Const @ByRef HighResolutionDuration d);
18+
public native @Name("operator-=") @ByRef HighResolutionDuration subtractPut(@Const @ByRef HighResolutionDuration d);
19+
public native @Name("operator*=") @ByRef HighResolutionDuration multiplyPut(@Const @ByRef long rhs);
20+
public native @Name("operator%=") @ByRef HighResolutionDuration modPut(@Const @ByRef long rhs);
21+
public native @Name("operator%=") @ByRef HighResolutionDuration modPut(@Const @ByRef HighResolutionDuration rhs);
22+
23+
public native long count();
24+
static public native @ByVal @Name("zero") HighResolutionDuration zero_();
25+
static public native @ByVal HighResolutionDuration min();
26+
static public native @ByVal HighResolutionDuration max();
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package org.bytedeco.javacpp.chrono;
2+
3+
import org.bytedeco.javacpp.Pointer;
4+
import org.bytedeco.javacpp.annotation.*;
5+
6+
@Name("std::chrono::time_point<std::chrono::high_resolution_clock>") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class)
7+
public class HighResolutionTime extends Pointer {
8+
public HighResolutionTime() { allocate(); }
9+
private native void allocate();
10+
11+
public HighResolutionTime(HighResolutionDuration d) { allocate(d); }
12+
private native void allocate(@Const @ByRef HighResolutionDuration d);
13+
14+
public native @ByVal HighResolutionTime time_since_epoch();
15+
16+
public native @Name("operator +=") @ByRef HighResolutionTime addPut(@Const @ByRef HighResolutionDuration d);
17+
public native @Name("operator -=") @ByRef HighResolutionTime subtractPut(@Const @ByRef HighResolutionDuration d);
18+
static public native @ByVal HighResolutionTime min();
19+
static public native @ByVal HighResolutionTime max();
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package org.bytedeco.javacpp.chrono;
2+
3+
import org.bytedeco.javacpp.Pointer;
4+
import org.bytedeco.javacpp.annotation.*;
5+
6+
@Name("std::chrono::hours") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class)
7+
public class Hours extends Pointer {
8+
public Hours() { allocate(); }
9+
private native void allocate();
10+
public Hours(long r) { allocate(r); }
11+
private native void allocate(long r);
12+
13+
public native @Name("operator=") @ByRef Hours put(@Const @ByRef Hours other);
14+
public native @Name("operator-") @ByVal Hours negate();
15+
public native @Name("operator++") @ByRef Hours increment();
16+
public native @Name("operator--") @ByRef Hours decrement();
17+
public native @Name("operator+=") @ByRef Hours addPut(@Const @ByRef Hours d);
18+
public native @Name("operator-=") @ByRef Hours subtractPut(@Const @ByRef Hours d);
19+
public native @Name("operator*=") @ByRef Hours multiplyPut(@Const @ByRef int rhs);
20+
public native @Name("operator%=") @ByRef Hours modPut(@Const @ByRef int rhs);
21+
public native @Name("operator%=") @ByRef Hours modPut(@Const @ByRef Hours rhs);
22+
23+
public native int count();
24+
static public native @ByVal @Name("zero") Hours zero_();
25+
static public native @ByVal Hours min();
26+
static public native @ByVal Hours max();
27+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package org.bytedeco.javacpp.chrono;
2+
3+
import org.bytedeco.javacpp.Pointer;
4+
import org.bytedeco.javacpp.annotation.*;
5+
6+
@Name("std::chrono::microseconds") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class)
7+
public class Microseconds extends Pointer {
8+
public Microseconds() { allocate(); }
9+
private native void allocate();
10+
public Microseconds(long r) { allocate(r); }
11+
private native void allocate(long r);
12+
13+
public Microseconds(Milliseconds d) { allocate(d); }
14+
private native void allocate(@Const @ByRef Milliseconds d);
15+
public Microseconds(Seconds d) { allocate(d); }
16+
private native void allocate(@Const @ByRef Seconds d);
17+
public Microseconds(Minutes d) { allocate(d); }
18+
private native void allocate(@Const @ByRef Minutes d);
19+
public Microseconds(Hours d) { allocate(d); }
20+
private native void allocate(@Const @ByRef Hours d);
21+
22+
public native @Name("operator=") @ByRef Microseconds put(@Const @ByRef Microseconds other);
23+
public native @Name("operator-") @ByVal Microseconds negate();
24+
public native @Name("operator++") @ByRef Microseconds increment();
25+
public native @Name("operator--") @ByRef Microseconds decrement();
26+
public native @Name("operator+=") @ByRef Microseconds addPut(@Const @ByRef Microseconds d);
27+
public native @Name("operator-=") @ByRef Microseconds subtractPut(@Const @ByRef Microseconds d);
28+
public native @Name("operator*=") @ByRef Microseconds multiplyPut(@Const @ByRef long rhs);
29+
public native @Name("operator%=") @ByRef Microseconds modPut(@Const @ByRef long rhs);
30+
public native @Name("operator%=") @ByRef Microseconds modPut(@Const @ByRef Microseconds rhs);
31+
32+
public native long count();
33+
static public native @ByVal @Name("zero") Microseconds zero_();
34+
static public native @ByVal Microseconds min();
35+
static public native @ByVal Microseconds max();
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package org.bytedeco.javacpp.chrono;
2+
3+
import org.bytedeco.javacpp.Pointer;
4+
import org.bytedeco.javacpp.annotation.*;
5+
6+
@Name("std::chrono::milliseconds") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class)
7+
public class Milliseconds extends Pointer {
8+
public Milliseconds() { allocate(); }
9+
private native void allocate();
10+
public Milliseconds(long r) { allocate(r); }
11+
private native void allocate(long r);
12+
public Milliseconds(Seconds d) { allocate(d); }
13+
private native void allocate(@Const @ByRef Seconds d);
14+
public Milliseconds(Minutes d) { allocate(d); }
15+
private native void allocate(@Const @ByRef Minutes d);
16+
public Milliseconds(Hours d) { allocate(d); }
17+
private native void allocate(@Const @ByRef Hours d);
18+
19+
public native @Name("operator=") @ByRef Milliseconds put(@Const @ByRef Milliseconds other);
20+
public native @Name("operator-") @ByVal Milliseconds negate();
21+
public native @Name("operator++") @ByRef Milliseconds increment();
22+
public native @Name("operator--") @ByRef Milliseconds decrement();
23+
public native @Name("operator+=") @ByRef Milliseconds addPut(@Const @ByRef Milliseconds d);
24+
public native @Name("operator-=") @ByRef Milliseconds subtractPut(@Const @ByRef Milliseconds d);
25+
public native @Name("operator*=") @ByRef Milliseconds multiplyPut(@Const @ByRef long rhs);
26+
public native @Name("operator%=") @ByRef Milliseconds modPut(@Const @ByRef long rhs);
27+
public native @Name("operator%=") @ByRef Milliseconds modPut(@Const @ByRef Milliseconds rhs);
28+
29+
public native long count();
30+
static public native @ByVal @Name("zero") Milliseconds zero_();
31+
static public native @ByVal Milliseconds min();
32+
static public native @ByVal Milliseconds max();
33+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package org.bytedeco.javacpp.chrono;
2+
3+
import org.bytedeco.javacpp.Pointer;
4+
import org.bytedeco.javacpp.annotation.*;
5+
6+
@Name("std::chrono::minutes") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class)
7+
public class Minutes extends Pointer {
8+
public Minutes() { allocate(); }
9+
private native void allocate();
10+
public Minutes(long r) { allocate(r); }
11+
private native void allocate(long r);
12+
public Minutes(Hours d) { allocate(d); }
13+
private native void allocate(@Const @ByRef Hours d);
14+
15+
public native @Name("operator=") @ByRef Minutes put(@Const @ByRef Minutes other);
16+
public native @Name("operator-") @ByVal Minutes negate();
17+
public native @Name("operator++") @ByRef Minutes increment();
18+
public native @Name("operator--") @ByRef Minutes decrement();
19+
public native @Name("operator+=") @ByRef Minutes addPut(@Const @ByRef Minutes d);
20+
public native @Name("operator-=") @ByRef Minutes subtractPut(@Const @ByRef Minutes d);
21+
public native @Name("operator*=") @ByRef Minutes multiplyPut(@Const @ByRef int rhs);
22+
public native @Name("operator%=") @ByRef Minutes modPut(@Const @ByRef int rhs);
23+
public native @Name("operator%=") @ByRef Minutes modPut(@Const @ByRef Minutes rhs);
24+
25+
public native int count();
26+
static public native @ByVal @Name("zero") Minutes zero_();
27+
static public native @ByVal Minutes min();
28+
static public native @ByVal Minutes max();
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package org.bytedeco.javacpp.chrono;
2+
3+
import org.bytedeco.javacpp.Pointer;
4+
import org.bytedeco.javacpp.annotation.*;
5+
6+
@Name("std::chrono::nanoseconds") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class)
7+
public class Nanoseconds extends Pointer {
8+
public Nanoseconds() { allocate(); }
9+
private native void allocate();
10+
public Nanoseconds(long r) { allocate(r); }
11+
private native void allocate(long r);
12+
public Nanoseconds(Microseconds d) { allocate(d); }
13+
private native void allocate(@Const @ByRef Microseconds d);
14+
public Nanoseconds(Milliseconds d) { allocate(d); }
15+
private native void allocate(@Const @ByRef Milliseconds d);
16+
public Nanoseconds(Seconds d) { allocate(d); }
17+
private native void allocate(@Const @ByRef Seconds d);
18+
public Nanoseconds(Minutes d) { allocate(d); }
19+
private native void allocate(@Const @ByRef Minutes d);
20+
public Nanoseconds(Hours d) { allocate(d); }
21+
private native void allocate(@Const @ByRef Hours d);
22+
public Nanoseconds(SystemDuration d) { super((Pointer)null); allocate(d); };
23+
private native void allocate(@Const @ByRef SystemDuration d);
24+
public Nanoseconds(HighResolutionDuration d) { super((Pointer)null); allocate(d); };
25+
private native void allocate(@Const @ByRef HighResolutionDuration d);
26+
public Nanoseconds(SteadyDuration d) { super((Pointer)null); allocate(d); };
27+
private native void allocate(@Const @ByRef SteadyDuration d);
28+
29+
public native @Name("operator=") @ByRef Nanoseconds put(@Const @ByRef Nanoseconds other);
30+
public native @Name("operator-") @ByVal Nanoseconds negate();
31+
public native @Name("operator++") @ByRef Nanoseconds increment();
32+
public native @Name("operator--") @ByRef Nanoseconds decrement();
33+
public native @Name("operator+=") @ByRef Nanoseconds addPut(@Const @ByRef Nanoseconds d);
34+
public native @Name("operator-=") @ByRef Nanoseconds subtractPut(@Const @ByRef Nanoseconds d);
35+
public native @Name("operator*=") @ByRef Nanoseconds multiplyPut(@Const @ByRef long rhs);
36+
public native @Name("operator%=") @ByRef Nanoseconds modPut(@Const @ByRef long rhs);
37+
public native @Name("operator%=") @ByRef Nanoseconds modPut(@Const @ByRef Nanoseconds rhs);
38+
39+
public native long count();
40+
static public native @ByVal @Name("zero") Nanoseconds zero_();
41+
static public native @ByVal Nanoseconds min();
42+
static public native @ByVal Nanoseconds max();
43+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package org.bytedeco.javacpp.chrono;
2+
3+
import org.bytedeco.javacpp.Pointer;
4+
import org.bytedeco.javacpp.annotation.*;
5+
6+
@Name("std::chrono::seconds") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class)
7+
public class Seconds extends Pointer {
8+
public Seconds() { allocate(); }
9+
private native void allocate();
10+
public Seconds(long r) { allocate(r); }
11+
private native void allocate(long r);
12+
public Seconds(Minutes d) { allocate(d); }
13+
private native void allocate(@Const @ByRef Minutes d);
14+
public Seconds(Hours d) { allocate(d); }
15+
private native void allocate(@Const @ByRef Hours d);
16+
17+
public native @Name("operator=") @ByRef Seconds put(@Const @ByRef Seconds other);
18+
public native @Name("operator-") @ByVal Seconds negate();
19+
public native @Name("operator++") @ByRef Seconds increment();
20+
public native @Name("operator--") @ByRef Seconds decrement();
21+
public native @Name("operator+=") @ByRef Seconds addPut(@Const @ByRef Seconds d);
22+
public native @Name("operator-=") @ByRef Seconds subtractPut(@Const @ByRef Seconds d);
23+
public native @Name("operator*=") @ByRef Seconds multiplyPut(@Const @ByRef long rhs);
24+
public native @Name("operator%=") @ByRef Seconds modPut(@Const @ByRef long rhs);
25+
public native @Name("operator%=") @ByRef Seconds modPut(@Const @ByRef Seconds rhs);
26+
27+
public native long count();
28+
static public native @ByVal @Name("zero") Seconds zero_();
29+
static public native @ByVal Seconds min();
30+
static public native @ByVal Seconds max();
31+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package org.bytedeco.javacpp.chrono;
2+
3+
import org.bytedeco.javacpp.Pointer;
4+
import org.bytedeco.javacpp.annotation.*;
5+
6+
@Name("std::chrono::duration<double>") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class)
7+
public class SecondsDouble extends Pointer {
8+
public SecondsDouble() { allocate(); }
9+
private native void allocate();
10+
public SecondsDouble(double r) { allocate(r); }
11+
private native void allocate(double r);
12+
public SecondsDouble(Nanoseconds d) { allocate(d); }
13+
private native void allocate(@Const @ByRef Nanoseconds d);
14+
public SecondsDouble(Seconds d) { allocate(d); }
15+
private native void allocate(@Const @ByRef Seconds d);
16+
17+
public native @Name("operator=") @ByRef SecondsDouble put(@Const @ByRef SecondsDouble other);
18+
public native @Name("operator-") @ByVal SecondsDouble negate();
19+
public native @Name("operator++") @ByRef SecondsDouble increment();
20+
public native @Name("operator--") @ByRef SecondsDouble decrement();
21+
public native @Name("operator+=") @ByRef SecondsDouble addPut(@Const @ByRef SecondsDouble d);
22+
public native @Name("operator-=") @ByRef SecondsDouble subtractPut(@Const @ByRef SecondsDouble d);
23+
public native @Name("operator*=") @ByRef SecondsDouble multiplyPut(@Const @ByRef double rhs);
24+
25+
public native double count();
26+
static public native @ByVal @Name("zero") SecondsDouble zero_();
27+
static public native @ByVal SecondsDouble min();
28+
static public native @ByVal SecondsDouble max();
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package org.bytedeco.javacpp.chrono;
2+
3+
import org.bytedeco.javacpp.Pointer;
4+
import org.bytedeco.javacpp.annotation.*;
5+
6+
@Name("std::chrono::duration<float>") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class)
7+
public class SecondsFloat extends Pointer {
8+
public SecondsFloat() { allocate(); }
9+
private native void allocate();
10+
public SecondsFloat(float r) { allocate(r); }
11+
private native void allocate(float r);
12+
public SecondsFloat(Nanoseconds d) { allocate(d); }
13+
private native void allocate(@Const @ByRef Nanoseconds d);
14+
public SecondsFloat(Seconds d) { allocate(d); }
15+
private native void allocate(@Const @ByRef Seconds d);
16+
17+
public native @Name("operator=") @ByRef SecondsFloat put(@Const @ByRef SecondsFloat other);
18+
public native @Name("operator-") @ByVal SecondsFloat negate();
19+
public native @Name("operator++") @ByRef SecondsFloat increment();
20+
public native @Name("operator--") @ByRef SecondsFloat decrement();
21+
public native @Name("operator+=") @ByRef SecondsFloat addPut(@Const @ByRef SecondsFloat d);
22+
public native @Name("operator-=") @ByRef SecondsFloat subtractPut(@Const @ByRef SecondsFloat d);
23+
public native @Name("operator*=") @ByRef SecondsFloat multiplyPut(@Const @ByRef float rhs);
24+
25+
public native float count();
26+
static public native @ByVal @Name("zero") SecondsFloat zero_();
27+
static public native @ByVal SecondsFloat min();
28+
static public native @ByVal SecondsFloat max();
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package org.bytedeco.javacpp.chrono;
2+
3+
import org.bytedeco.javacpp.Pointer;
4+
import org.bytedeco.javacpp.annotation.ByVal;
5+
import org.bytedeco.javacpp.annotation.Name;
6+
import org.bytedeco.javacpp.annotation.Properties;
7+
8+
@Name("std::chrono::steady_clock") @Properties(inherit = org.bytedeco.javacpp.presets.chrono.class)
9+
public class SteadyClock extends Pointer {
10+
static public native @ByVal SteadyTime now();
11+
}

0 commit comments

Comments
 (0)