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

[FIX] Add data access for containers #1208

Merged
merged 1 commit into from
Aug 26, 2019
Merged

Conversation

eseiler
Copy link
Member

@eseiler eseiler commented Aug 12, 2019

  • Adds raw_data() for bitcompressed_vector and allows access of the underlying SDSL vector.
  • Renames data() to raw_data() in concatenated_sequences since data() implies contiguous memory locations.
  • small_vector and small_string have data() and are contiguous, ergo no changes here.

@eseiler eseiler requested review from joergi-w and svnbgnk and removed request for joergi-w August 12, 2019 13:10
@eseiler eseiler force-pushed the fix/container_data branch from 7ce3123 to 25d06a0 Compare August 14, 2019 17:19
@codecov
Copy link

codecov bot commented Aug 14, 2019

Codecov Report

Merging #1208 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1208   +/-   ##
=======================================
  Coverage   96.84%   96.84%           
=======================================
  Files         217      217           
  Lines        8616     8616           
=======================================
  Hits         8344     8344           
  Misses        272      272
Impacted Files Coverage Δ
.../seqan3/range/container/concatenated_sequences.hpp 96.85% <100%> (ø) ⬆️
...de/seqan3/range/container/bitcompressed_vector.hpp 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e5fa215...b0b8ec0. Read the comment docs.

Copy link
Contributor

@svnbgnk svnbgnk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The operators compare all the bitcompressed data from one vector to another, right?

constexpr bool operator==(bitcompressed_vector const & rhs) const noexcept
{
return raw_data() == rhs.raw_data();
}

Copy link
Contributor

@svnbgnk svnbgnk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing I noticed that did not data with raw_data() swap:

constexpr void swap(bitcompressed_vector & rhs) noexcept
{
std::swap(data, rhs.data);
}
.
Is there any reason for that?

@eseiler
Copy link
Member Author

eseiler commented Aug 20, 2019

The operators compare all the bitcompressed data from one vector to another, right?

constexpr bool operator==(bitcompressed_vector const & rhs) const noexcept
{
return raw_data() == rhs.raw_data();
}

We delegate to the compairson operator of the underlying data type (sdsl::int_vector), which then compares the content.

@eseiler
Copy link
Member Author

eseiler commented Aug 20, 2019

One thing I noticed that did not data with raw_data() swap:

constexpr void swap(bitcompressed_vector & rhs) noexcept
{
std::swap(data, rhs.data);
}

.
Is there any reason for that?

No reason, just didn't see it. I can access the private data member within the class, but I'll change it for consistency.

@eseiler eseiler force-pushed the fix/container_data branch from 25d06a0 to f5d55a3 Compare August 20, 2019 13:04
@eseiler eseiler requested a review from svnbgnk August 20, 2019 13:04
Copy link
Contributor

@svnbgnk svnbgnk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Ok everything is resolved.

@eseiler eseiler requested a review from h-2 August 21, 2019 09:32
Copy link
Member

@h-2 h-2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor stuff

CHANGELOG.md Outdated
@@ -40,6 +40,10 @@ If possible, provide tooling that performs the changes, e.g. a shell-script.
* **The `type_list` header has moved:**
If you included `<seqan3/core/type_list.hpp>` you need to change the path to `<seqan3/core/type_list/type_list.hpp>`.

### The `data()` function of `seqan3::concatenated_sequences` has been deprecated

Use `raw_data()` instead.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changelog format is now different...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we mark the functions as noapi we don't need to include it in the changelog?

@@ -518,6 +518,19 @@ class bitcompressed_vector
return (*this)[size()-1];
}

//!\brief Direct access to the underlying SDSL vector.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you should describe more clearly what the type will be as this is exposed to the API. Note that if we expose this to the API, we cannot change the internal type anymore without breakage.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it a bit. I'd like to link to a documentation of the bitvector. But there are no online docs for the sdsl3 bitvector. And the sdsl2 one looks like this.

Anyway, I noticed that in concatenated_sequences we added this sentence:
This exact representation of the data is implementation defined. Do not rely on it for API stability.
So it's basically not API and we could add \noapi for doxygen to this function?

Then we could discuss if all our container data/raw_data functions are no api.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it's basically not API and we could add \noapi for doxygen to this function?

👍

Then we could discuss if all our container data/raw_data functions are no api.

👍

@@ -964,37 +977,37 @@ class bitcompressed_vector
//!\brief Checks whether `*this` is equal to `rhs`.
constexpr bool operator==(bitcompressed_vector const & rhs) const noexcept
{
return data == rhs.data;
return raw_data() == rhs.raw_data();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these changes necessary? I don't care much ....

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mhm, I was afraid of the code coverage since I didn't want to test the data/raw_data functions.

I'll revert it and see what happens.

SEQAN3_DEPRECATED_310 std::pair<decltype(data_values) const &, decltype(data_delimiters) const &> data() const
{
return raw_data();
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@eseiler eseiler force-pushed the fix/container_data branch from f5d55a3 to 532609f Compare August 23, 2019 08:45
@eseiler eseiler force-pushed the fix/container_data branch from 532609f to b0b8ec0 Compare August 23, 2019 10:37
@eseiler eseiler requested a review from h-2 August 23, 2019 12:01
@h-2 h-2 merged commit f2cfc5b into seqan:master Aug 26, 2019
@eseiler eseiler deleted the fix/container_data branch August 26, 2019 08:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants