Skip to content

Commit

Permalink
Implement user_datasource_wrapper is_empty() and is_device_read_prefe…
Browse files Browse the repository at this point in the history
…rred(). (#14357)

These two routines are missing from the current `user_datasource_wrapper` impl.

Authors:
  - Trent Nelson (https://github.com/tpn)
  - Vukasin Milovanovic (https://github.com/vuule)

Approvers:
  - Mike Wilson (https://github.com/hyperbolic2346)
  - Vukasin Milovanovic (https://github.com/vuule)

URL: #14357
  • Loading branch information
tpn authored Nov 17, 2023
1 parent ba5ec40 commit 6c2e972
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cpp/src/io/utilities/datasource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,11 @@ class user_datasource_wrapper : public datasource {
return source->supports_device_read();
}

[[nodiscard]] bool is_device_read_preferred(size_t size) const override
{
return source->is_device_read_preferred(size);
}

size_t device_read(size_t offset,
size_t size,
uint8_t* dst,
Expand All @@ -385,6 +390,8 @@ class user_datasource_wrapper : public datasource {

[[nodiscard]] size_t size() const override { return source->size(); }

[[nodiscard]] bool is_empty() const override { return source->is_empty(); }

private:
datasource* const source; ///< A non-owning pointer to the user-implemented datasource
};
Expand Down

0 comments on commit 6c2e972

Please sign in to comment.