Skip to content

Commit

Permalink
pw_rpc: Rename shadowed methods
Browse files Browse the repository at this point in the history
Rename the Nanopb and pwpb versions of set_on_next_locked() and
set_on_completed_locked() to avoid confusion.

Change-Id: I2a288af3024b4f2d51feeef9b3318cd0d49a6fb8
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/126458
Pigweed-Auto-Submit: Wyatt Hepler <[email protected]>
Commit-Queue: Auto-Submit <[email protected]>
Reviewed-by: Ted Pudlik <[email protected]>
  • Loading branch information
255 authored and CQ Bot Account committed Jan 12, 2023
1 parent ee5be33 commit 1b813ef
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 22 deletions.
17 changes: 9 additions & 8 deletions pw_rpc/nanopb/public/pw_rpc/nanopb/client_reader_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class NanopbUnaryResponseClientCall : public UnaryResponseClientCall {
CallType call(
client.ClaimLocked(), channel_id, service_id, method_id, serde);

call.set_on_completed_locked(std::move(on_completed));
call.set_nanopb_on_completed_locked(std::move(on_completed));
call.set_on_error_locked(std::move(on_error));

if constexpr (sizeof...(Request) == 0u) {
Expand Down Expand Up @@ -78,15 +78,15 @@ class NanopbUnaryResponseClientCall : public UnaryResponseClientCall {
LockGuard lock(rpc_lock());
MoveUnaryResponseClientCallFrom(other);
serde_ = other.serde_;
set_on_completed_locked(std::move(other.nanopb_on_completed_));
set_nanopb_on_completed_locked(std::move(other.nanopb_on_completed_));
return *this;
}

void set_on_completed(
Function<void(const Response& response, Status)>&& on_completed)
PW_LOCKS_EXCLUDED(rpc_lock()) {
LockGuard lock(rpc_lock());
set_on_completed_locked(std::move(on_completed));
set_nanopb_on_completed_locked(std::move(on_completed));
}

Status SendClientStream(const void* payload) PW_LOCKS_EXCLUDED(rpc_lock()) {
Expand All @@ -95,7 +95,7 @@ class NanopbUnaryResponseClientCall : public UnaryResponseClientCall {
}

private:
void set_on_completed_locked(
void set_nanopb_on_completed_locked(
Function<void(const Response& response, Status)>&& on_completed)
PW_EXCLUSIVE_LOCKS_REQUIRED(rpc_lock()) {
nanopb_on_completed_ = std::move(on_completed);
Expand Down Expand Up @@ -142,7 +142,7 @@ class NanopbStreamResponseClientCall : public StreamResponseClientCall {
CallType call(
client.ClaimLocked(), channel_id, service_id, method_id, serde);

call.set_on_next_locked(std::move(on_next));
call.set_nanopb_on_next_locked(std::move(on_next));
call.set_on_completed_locked(std::move(on_completed));
call.set_on_error_locked(std::move(on_error));

Expand All @@ -167,7 +167,7 @@ class NanopbStreamResponseClientCall : public StreamResponseClientCall {
LockGuard lock(rpc_lock());
MoveStreamResponseClientCallFrom(other);
serde_ = other.serde_;
set_on_next_locked(std::move(other.nanopb_on_next_));
set_nanopb_on_next_locked(std::move(other.nanopb_on_next_));
return *this;
}

Expand All @@ -190,11 +190,12 @@ class NanopbStreamResponseClientCall : public StreamResponseClientCall {
void set_on_next(Function<void(const Response& response)>&& on_next)
PW_LOCKS_EXCLUDED(rpc_lock()) {
LockGuard lock(rpc_lock());
set_on_next_locked(std::move(on_next));
set_nanopb_on_next_locked(std::move(on_next));
}

private:
void set_on_next_locked(Function<void(const Response& response)>&& on_next)
void set_nanopb_on_next_locked(
Function<void(const Response& response)>&& on_next)
PW_EXCLUSIVE_LOCKS_REQUIRED(rpc_lock()) {
nanopb_on_next_ = std::move(on_next);

Expand Down
7 changes: 4 additions & 3 deletions pw_rpc/nanopb/public/pw_rpc/nanopb/server_reader_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,19 @@ class BaseNanopbServerReader : public NanopbServerCall {
PW_LOCKS_EXCLUDED(rpc_lock()) {
internal::LockGuard lock(internal::rpc_lock());
MoveNanopbServerCallFrom(other);
set_on_next_locked(std::move(other.nanopb_on_next_));
set_nanopb_on_next_locked(std::move(other.nanopb_on_next_));
return *this;
}

void set_on_next(Function<void(const Request& request)>&& on_next)
PW_LOCKS_EXCLUDED(rpc_lock()) {
internal::LockGuard lock(internal::rpc_lock());
set_on_next_locked(std::move(on_next));
set_nanopb_on_next_locked(std::move(on_next));
}

private:
void set_on_next_locked(Function<void(const Request& request)>&& on_next)
void set_nanopb_on_next_locked(
Function<void(const Request& request)>&& on_next)
PW_EXCLUSIVE_LOCKS_REQUIRED(rpc_lock()) {
nanopb_on_next_ = std::move(on_next);

Expand Down
17 changes: 9 additions & 8 deletions pw_rpc/pwpb/public/pw_rpc/pwpb/client_reader_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class PwpbUnaryResponseClientCall : public UnaryResponseClientCall {
CallType call(
client.ClaimLocked(), channel_id, service_id, method_id, serde);

call.set_on_completed_locked(std::move(on_completed));
call.set_pwpb_on_completed_locked(std::move(on_completed));
call.set_on_error_locked(std::move(on_error));

if constexpr (sizeof...(Request) == 0u) {
Expand Down Expand Up @@ -95,14 +95,14 @@ class PwpbUnaryResponseClientCall : public UnaryResponseClientCall {
PW_EXCLUSIVE_LOCKS_REQUIRED(rpc_lock()) {
MoveUnaryResponseClientCallFrom(other);
serde_ = other.serde_;
set_on_completed_locked(std::move(other.pwpb_on_completed_));
set_pwpb_on_completed_locked(std::move(other.pwpb_on_completed_));
}

void set_on_completed(
Function<void(const Response& response, Status)>&& on_completed)
PW_LOCKS_EXCLUDED(rpc_lock()) {
LockGuard lock(rpc_lock());
set_on_completed_locked(std::move(on_completed));
set_pwpb_on_completed_locked(std::move(on_completed));
}

// Sends a streamed request.
Expand All @@ -122,7 +122,7 @@ class PwpbUnaryResponseClientCall : public UnaryResponseClientCall {
}

private:
void set_on_completed_locked(
void set_pwpb_on_completed_locked(
Function<void(const Response& response, Status)>&& on_completed)
PW_EXCLUSIVE_LOCKS_REQUIRED(rpc_lock()) {
pwpb_on_completed_ = std::move(on_completed);
Expand Down Expand Up @@ -175,7 +175,7 @@ class PwpbStreamResponseClientCall : public StreamResponseClientCall {
CallType call(
client.ClaimLocked(), channel_id, service_id, method_id, serde);

call.set_on_next_locked(std::move(on_next));
call.set_pwpb_on_next_locked(std::move(on_next));
call.set_on_completed_locked(std::move(on_completed));
call.set_on_error_locked(std::move(on_error));

Expand Down Expand Up @@ -222,13 +222,13 @@ class PwpbStreamResponseClientCall : public StreamResponseClientCall {
PW_EXCLUSIVE_LOCKS_REQUIRED(rpc_lock()) {
MoveStreamResponseClientCallFrom(other);
serde_ = other.serde_;
set_on_next_locked(std::move(other.pwpb_on_next_));
set_pwpb_on_next_locked(std::move(other.pwpb_on_next_));
}

void set_on_next(Function<void(const Response& response)>&& on_next)
PW_LOCKS_EXCLUDED(rpc_lock()) {
LockGuard lock(rpc_lock());
set_on_next_locked(std::move(on_next));
set_pwpb_on_next_locked(std::move(on_next));
}

// Sends a streamed request.
Expand All @@ -248,7 +248,8 @@ class PwpbStreamResponseClientCall : public StreamResponseClientCall {
}

private:
void set_on_next_locked(Function<void(const Response& response)>&& on_next)
void set_pwpb_on_next_locked(
Function<void(const Response& response)>&& on_next)
PW_EXCLUSIVE_LOCKS_REQUIRED(rpc_lock()) {
pwpb_on_next_ = std::move(on_next);

Expand Down
6 changes: 3 additions & 3 deletions pw_rpc/pwpb/public/pw_rpc/pwpb/server_reader_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,17 +155,17 @@ class BasePwpbServerReader : public PwpbServerCall {
void MoveBasePwpbServerReaderFrom(BasePwpbServerReader& other)
PW_EXCLUSIVE_LOCKS_REQUIRED(rpc_lock()) {
MovePwpbServerCallFrom(other);
set_on_next_locked(std::move(other.pwpb_on_next_));
set_pwpb_on_next_locked(std::move(other.pwpb_on_next_));
}

void set_on_next(Function<void(const Request& request)>&& on_next)
PW_LOCKS_EXCLUDED(rpc_lock()) {
LockGuard lock(rpc_lock());
set_on_next_locked(std::move(on_next));
set_pwpb_on_next_locked(std::move(on_next));
}

private:
void set_on_next_locked(Function<void(const Request& request)>&& on_next)
void set_pwpb_on_next_locked(Function<void(const Request& request)>&& on_next)
PW_EXCLUSIVE_LOCKS_REQUIRED(rpc_lock()) {
pwpb_on_next_ = std::move(on_next);

Expand Down

0 comments on commit 1b813ef

Please sign in to comment.