-
Notifications
You must be signed in to change notification settings - Fork 7
WIP on map_io #14
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
Open
smehringer
wants to merge
3
commits into
biocpp:main
Choose a base branch
from
smehringer:map_io
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
WIP on map_io #14
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
// ----------------------------------------------------------------------------------------------------- | ||
// Copyright (c) 2006-2021, Knut Reinert & Freie Universität Berlin | ||
// Copyright (c) 2016-2021, Knut Reinert & MPI für molekulare Genetik | ||
// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License | ||
// shipped with this file and also available at: https://github.com/seqan/b.i.o./blob/master/LICENSE.md | ||
// ----------------------------------------------------------------------------------------------------- | ||
|
||
/*!\file | ||
* \brief Provides bio::add_enum_bitwise_operators. | ||
* \author Svenja Mehringer <svenja.mehringer AT fu-berlin.de> | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <type_traits> | ||
|
||
#include <bio/platform.hpp> | ||
|
||
namespace bio::map_io | ||
{ | ||
/*!\interface bio::enum_bitwise_operators | ||
* \brief You can expect these functions on all types that overload bio::add_enum_bitwise_operators. | ||
*/ | ||
/*!\name Requirements for bio::enum_bitwise_operators | ||
* \relates bio::enum_bitwise_operators | ||
* \brief You can expect these member functions. | ||
* \{ | ||
* \fn operator&(t lhs, t rhs) | ||
* \brief Returns the binary `&` operator of lhs and rhs. | ||
* \param lhs First enum. | ||
* \param rhs Second enum. | ||
* | ||
* \returns the binary conjunction of `lhs` and `rhs`. | ||
* | ||
* \fn operator|(t lhs, t rhs) | ||
* \brief Returns the binary `|` operator of lhs and rhs. | ||
* \param lhs First enum. | ||
* \param rhs Second enum. | ||
* | ||
* \returns the binary disjunction of `lhs` and `rhs`. | ||
* | ||
* \fn operator^(t lhs, t rhs) | ||
* \brief Returns the binary `^` operator of lhs and rhs. | ||
* \param lhs First enum. | ||
* \param rhs Second enum. | ||
* | ||
* \returns the binary XOR operation on `lhs` and `rhs`. | ||
* | ||
* \fn operator~(t lhs) | ||
* \brief Returns the binary `~` operator of lhs. | ||
* \param lhs First enum. | ||
* | ||
* \returns the binary NOT operation on `lhs`. | ||
* | ||
* \fn operator&=(t & lhs, t rhs) | ||
* \brief Returns the binary `&=` operator of lhs and rhs. | ||
* \param lhs First enum. | ||
* \param rhs Second enum. | ||
* | ||
* \returns the binary AND assigment on `lhs`. | ||
* | ||
* \fn operator|=(t & lhs, t rhs) | ||
* \brief Returns the binary `|=` operator of lhs and rhs. | ||
* \param lhs First enum. | ||
* \param rhs Second enum. | ||
* | ||
* \returns the binary OR assignment on `lhs`. | ||
* | ||
* \fn operator^=(t & lhs, t rhs) | ||
* \brief Returns the binary `^=` operator of lhs and rhs. | ||
* \param lhs First enum. | ||
* \param rhs Second enum. | ||
* | ||
* \returns the binary XOR assignment on `lhs`. | ||
* \} | ||
*/ | ||
|
||
//!\cond DEV | ||
/*!\brief Set to true for a scoped enum to have binary operators overloaded. | ||
* \ingroup core | ||
* | ||
* \details | ||
* | ||
* If this type trait is specialised for an enum, the binary operators `&`, `|`, `^`, `~`, `&=`, `|=`, `^=` will be | ||
* added and behave just like for ints or unscoped enums. | ||
* | ||
* ### Example | ||
* | ||
* \include test/snippet/core/add_enum_bitwise_operators.cpp | ||
*/ | ||
template <typename t> | ||
constexpr bool add_enum_bitwise_operators = false; | ||
|
||
/*!\name Binary operators for scoped enums | ||
* \brief Perform binary operations like on ints or weak enums. These overloads are available if | ||
* bio::add_enum_bitwise_operators is defined for your type. | ||
* \ingroup core | ||
* | ||
* \details | ||
* | ||
* \see bio::add_enum_bitwise_operators | ||
* \{ | ||
*/ | ||
template <typename t> | ||
constexpr t operator&(t lhs, t rhs) noexcept requires std::is_enum_v<t> && add_enum_bitwise_operators<t> | ||
{ | ||
return static_cast<t>(static_cast<std::underlying_type_t<t>>(lhs) & static_cast<std::underlying_type_t<t>>(rhs)); | ||
} | ||
|
||
template <typename t> | ||
constexpr t operator|(t lhs, t rhs) noexcept requires std::is_enum_v<t> && add_enum_bitwise_operators<t> | ||
{ | ||
return static_cast<t>(static_cast<std::underlying_type_t<t>>(lhs) | static_cast<std::underlying_type_t<t>>(rhs)); | ||
} | ||
|
||
template <typename t> | ||
constexpr t operator^(t lhs, t rhs) noexcept requires std::is_enum_v<t> && add_enum_bitwise_operators<t> | ||
{ | ||
return static_cast<t>(static_cast<std::underlying_type_t<t>>(lhs) ^ static_cast<std::underlying_type_t<t>>(rhs)); | ||
} | ||
|
||
template <typename t> | ||
constexpr t operator~(t lhs) noexcept requires std::is_enum_v<t> && add_enum_bitwise_operators<t> | ||
{ | ||
return static_cast<t>(~static_cast<std::underlying_type_t<t>>(lhs)); | ||
} | ||
|
||
template <typename t> | ||
constexpr t & operator&=(t & lhs, t rhs) noexcept requires std::is_enum_v<t> && add_enum_bitwise_operators<t> | ||
{ | ||
lhs = lhs & rhs; | ||
return lhs; | ||
} | ||
|
||
template <typename t> | ||
constexpr t & operator|=(t & lhs, t rhs) noexcept requires std::is_enum_v<t> && add_enum_bitwise_operators<t> | ||
{ | ||
lhs = lhs | rhs; | ||
return lhs; | ||
} | ||
|
||
template <typename t> | ||
constexpr t & operator^=(t & lhs, t rhs) noexcept requires std::is_enum_v<t> && add_enum_bitwise_operators<t> | ||
{ | ||
lhs = lhs ^ rhs; | ||
return lhs; | ||
} | ||
//!\} | ||
//!\endcond | ||
|
||
} // namespace bio::map_io |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// ----------------------------------------------------------------------------------------------------- | ||
// Copyright (c) 2006-2022, Knut Reinert & Freie Universität Berlin | ||
// Copyright (c) 2016-2021, Knut Reinert & MPI für molekulare Genetik | ||
// Copyright (c) 2020-2021, deCODE Genetics | ||
// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License | ||
// shipped with this file and also available at: https://github.com/seqan/b.i.o./blob/master/LICENSE.md | ||
// ----------------------------------------------------------------------------------------------------- | ||
|
||
/*!\file | ||
* brief Provides the bio::format_sam. | ||
* \author Svenja Mehringer <svenja.mehringer AT fu-berlin.de> | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <string> | ||
#include <vector> | ||
|
||
#include <bio/platform.hpp> | ||
|
||
namespace bio | ||
{ | ||
|
||
/*!\brief The sam format. | ||
* \ingroup format | ||
* | ||
* \details | ||
* | ||
* This is the sam format tag. If you want to read sam files, use bio::map_io::reader, and if you want | ||
* to write sam files, use bio::map_io::writer. | ||
* | ||
* ### Introduction | ||
* | ||
* sam is the de-facto-standard for mapping storage in bionformatics. See the | ||
* [article on wikipedia](todo) for a an in-depth description of the format. | ||
* | ||
* ### Fields | ||
* | ||
* todo | ||
* | ||
* ### Implementation notes | ||
* | ||
* todo | ||
* | ||
*/ | ||
struct sam | ||
{ | ||
//!\brief The valid file extensions for this format; note that you can modify this value. | ||
static inline std::vector<std::string> file_extensions{{"sam"}}; | ||
}; | ||
|
||
} // namespace bio |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.