Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply the rule of 3/5/0 to JByteArrayCritical et al. #395

Merged
merged 2 commits into from
Aug 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions csrc/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,14 @@ class JByteArrayCritical {
~JByteArrayCritical();
unsigned char* get();

#ifdef HAVE_CPP11
// deleting copy & move operations to satisfy rule of five
JByteArrayCritical(const JByteArrayCritical&) = delete;
JByteArrayCritical& operator=(const JByteArrayCritical&) = delete;
JByteArrayCritical(JByteArrayCritical&&) = delete;
JByteArrayCritical& operator=(JByteArrayCritical&&) = delete;
#endif
geedo0 marked this conversation as resolved.
Show resolved Hide resolved

private:
void* ptr_;
JNIEnv* env_;
Expand All @@ -610,6 +618,14 @@ class SimpleBuffer {
~SimpleBuffer();
uint8_t* get_buffer();

#ifdef HAVE_CPP11
// deleting copy & move operations to satisfy rule of five
SimpleBuffer(const SimpleBuffer&) = delete;
SimpleBuffer& operator=(const SimpleBuffer&) = delete;
SimpleBuffer(SimpleBuffer&&) = delete;
SimpleBuffer& operator=(SimpleBuffer&&) = delete;
#endif

private:
uint8_t* buffer_;
};
Expand All @@ -623,6 +639,14 @@ class JBinaryBlob {
~JBinaryBlob();
uint8_t* get();

#ifdef HAVE_CPP11
// deleting copy & move operations to satisfy rule of five
JBinaryBlob(const JBinaryBlob&) = delete;
JBinaryBlob& operator=(const JBinaryBlob&) = delete;
JBinaryBlob(JBinaryBlob&&) = delete;
JBinaryBlob& operator=(JBinaryBlob&&) = delete;
#endif

private:
// The native pointer that is either backed by a direct ByteBuffer or a byte array.
uint8_t* ptr_;
Expand All @@ -649,6 +673,14 @@ class JIOBlobs {
uint8_t* get_input();
uint8_t* get_output();

#ifdef HAVE_CPP11
// deleting copy & move operations to satisfy rule of five
JIOBlobs(const JIOBlobs&) = delete;
JIOBlobs& operator=(const JIOBlobs&) = delete;
JIOBlobs(JIOBlobs&&) = delete;
JIOBlobs& operator=(JIOBlobs&&) = delete;
#endif

private:
// The native pointers that are either backed by a direct ByteBuffer or a byte array.
uint8_t* input_ptr_;
Expand Down
Loading