Skip to content

Commit

Permalink
Have functions returning string_view return BytePointer instead of St…
Browse files Browse the repository at this point in the history
…ring
  • Loading branch information
HGuillemet committed Jul 26, 2023
1 parent 1aa8996 commit bee1efd
Show file tree
Hide file tree
Showing 15 changed files with 192 additions and 220 deletions.
2 changes: 1 addition & 1 deletion pytorch/src/gen/java/org/bytedeco/pytorch/Blob.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class Blob extends Pointer {
/**
* Returns a printable typename of the blob.
*/
public native @StringView @NoException(true) String TypeName();
public native @StringView @NoException(true) BytePointer TypeName();

/**
* \brief Gets the const reference of the stored object. The code checks if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class ConstantString extends Pointer {
public static native @ByVal ConstantStringPtr create(@StdString String str_);

public native @StdString BytePointer string();
public native @StringView String string_view();
public native @StringView BytePointer string_view();

public native @Const @ByRef @Name("operator const std::string&") @StdString @Override String toString();

Expand Down
2 changes: 1 addition & 1 deletion pytorch/src/gen/java/org/bytedeco/pytorch/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ public class Context extends Pointer {
// }

// Throws an error if `Context::deterministicAlgorithms()` is true
public static native void alertNotDeterministic(@StringView String caller);
public static native void alertNotDeterministic(@StringView BytePointer caller);
public static native void alertNotDeterministic(@StringView String caller);

// Throws an error if `Context::deterministicAlgorithms()` is true, CUDA
// >= 10.2, and CUBLAS_WORKSPACE_CONFIG is not set to either ":16:8" or
Expand Down
2 changes: 1 addition & 1 deletion pytorch/src/gen/java/org/bytedeco/pytorch/Function.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class Function extends Pointer {
/** Pointer cast constructor. Invokes {@link Pointer#Pointer(Pointer)}. */
public Function(Pointer p) { super(p); }

public native @StringView String doc_string();
public native @StringView BytePointer doc_string();

public native @Cast("bool") boolean isGraphFunction();

Expand Down
4 changes: 2 additions & 2 deletions pytorch/src/gen/java/org/bytedeco/pytorch/FunctionSchema.java
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ private native void allocate(
public native @Cast("bool") boolean is_aliasing(@Const @ByRef SchemaArgument argument);
public native @Cast("bool") boolean is_mutable();
public native @Cast("bool") boolean is_mutable(@Const @ByRef SchemaArgument argument);
public native @Cast("bool") boolean is_mutable(@StringView String name);
public native @Cast("bool") boolean is_mutable(@StringView BytePointer name);
public native @Cast("bool") boolean is_mutable(@StringView String name);

// Returns whether lhs and rhs may alias directly.
// This does not account for cases where lhs or rhs are a container that
Expand Down Expand Up @@ -219,8 +219,8 @@ private native void allocate(
public native @StdVector Argument getCorrectList(SchemaArgType type);
public native @StdVector Argument getCorrectList(@Cast("c10::SchemaArgType") int type);

public native @ByVal IntOptional argumentIndexWithName(@StringView String name);
public native @ByVal IntOptional argumentIndexWithName(@StringView BytePointer name);
public native @ByVal IntOptional argumentIndexWithName(@StringView String name);
public native @ByVal FunctionSchema cloneWithName(@StdString BytePointer name, @StdString BytePointer overload_name);
public native @ByVal FunctionSchema cloneWithName(@StdString String name, @StdString String overload_name);
public native @ByVal FunctionSchema cloneWithArguments(@StdVector Argument new_arguments);
Expand Down
2 changes: 1 addition & 1 deletion pytorch/src/gen/java/org/bytedeco/pytorch/IValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ public class IValue extends Pointer {
public native @ByVal @Name("toString") ConstantStringPtr toConstantString();
public native @StdString BytePointer toStringRef();
public native @ByVal @Cast("c10::optional<std::reference_wrapper<const std::string> >*") Pointer toOptionalStringRef();
public native @StringView String toStringView();
public native @StringView BytePointer toStringView();

// DoubleList
public native @Cast("bool") boolean isDoubleList();
Expand Down
4 changes: 2 additions & 2 deletions pytorch/src/gen/java/org/bytedeco/pytorch/SchemaInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ public class SchemaInfo extends Pointer {

public native @Cast("bool") boolean is_mutable(@Const @ByRef SchemaArgument argument);

public native @Cast("bool") boolean is_mutable(@StringView String name);
public native @Cast("bool") boolean is_mutable(@StringView BytePointer name);
public native @Cast("bool") boolean is_mutable(@StringView String name);

public native @Cast("bool") boolean has_argument(@StringView String name);
public native @Cast("bool") boolean has_argument(@StringView BytePointer name);
public native @Cast("bool") boolean has_argument(@StringView String name);

public native @Cast("bool") boolean is_nondeterministic();

Expand Down
16 changes: 8 additions & 8 deletions pytorch/src/gen/java/org/bytedeco/pytorch/Source.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,37 +41,37 @@ public enum CopiesString { COPIES_STRING(0), DONT_COPY(1);
}

public Source(
@StringView String text_view,
@StringView BytePointer text_view,
@ByVal(nullValue = "c10::optional<std::string>(c10::nullopt)") StringOptional filename,
@Cast("size_t") long starting_line_no/*=0*/,
@SharedPtr SourceRangeUnpickler gen_ranges/*=nullptr*/,
CopiesString copies_str/*=torch::jit::Source::COPIES_STRING*/) { super((Pointer)null); allocate(text_view, filename, starting_line_no, gen_ranges, copies_str); }
private native void allocate(
@StringView String text_view,
@StringView BytePointer text_view,
@ByVal(nullValue = "c10::optional<std::string>(c10::nullopt)") StringOptional filename,
@Cast("size_t") long starting_line_no/*=0*/,
@SharedPtr SourceRangeUnpickler gen_ranges/*=nullptr*/,
CopiesString copies_str/*=torch::jit::Source::COPIES_STRING*/);
public Source(
@StringView String text_view) { super((Pointer)null); allocate(text_view); }
@StringView BytePointer text_view) { super((Pointer)null); allocate(text_view); }
private native void allocate(
@StringView String text_view);
@StringView BytePointer text_view);
public Source(
@StringView BytePointer text_view,
@StringView String text_view,
@ByVal(nullValue = "c10::optional<std::string>(c10::nullopt)") StringOptional filename,
@Cast("size_t") long starting_line_no/*=0*/,
@SharedPtr SourceRangeUnpickler gen_ranges/*=nullptr*/,
@Cast("torch::jit::Source::CopiesString") int copies_str/*=torch::jit::Source::COPIES_STRING*/) { super((Pointer)null); allocate(text_view, filename, starting_line_no, gen_ranges, copies_str); }
private native void allocate(
@StringView BytePointer text_view,
@StringView String text_view,
@ByVal(nullValue = "c10::optional<std::string>(c10::nullopt)") StringOptional filename,
@Cast("size_t") long starting_line_no/*=0*/,
@SharedPtr SourceRangeUnpickler gen_ranges/*=nullptr*/,
@Cast("torch::jit::Source::CopiesString") int copies_str/*=torch::jit::Source::COPIES_STRING*/);
public Source(
@StringView BytePointer text_view) { super((Pointer)null); allocate(text_view); }
@StringView String text_view) { super((Pointer)null); allocate(text_view); }
private native void allocate(
@StringView BytePointer text_view);
@StringView String text_view);

public Source(
@ByVal StringCordView str,
Expand Down
2 changes: 1 addition & 1 deletion pytorch/src/gen/java/org/bytedeco/pytorch/SourceRange.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ private native void allocate(
@ByVal StringCordView.Iterator start_iter,
@Cast("size_t") long end_);

public native @StringView String token_text();
public native @StringView BytePointer token_text();

public native @Const @ByVal StringCordView text();
public native @Cast("size_t") long size();
Expand Down
4 changes: 2 additions & 2 deletions pytorch/src/gen/java/org/bytedeco/pytorch/StringCordView.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private native void allocate(

public native @Cast("bool") @Name("operator ==") boolean equals(@Const @ByRef StringCordView rhs);

public native @StringView String piece(@Cast("size_t") long index);
public native @StringView BytePointer piece(@Cast("size_t") long index);

@NoOffset public static class Iterator extends Pointer {
static { Loader.load(); }
Expand Down Expand Up @@ -116,7 +116,7 @@ private native void allocate(
public native @Cast("char") @Name("operator *") byte multiply();

// returns rest of the line of the current iterator
public native @StringView String rest_line();
public native @StringView BytePointer rest_line();

public native @Cast("size_t") long pos();
}
Expand Down
Loading

0 comments on commit bee1efd

Please sign in to comment.