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

wiki: document concepts as doxygen interfaces #72

Closed
h-2 opened this issue May 22, 2017 · 3 comments
Closed

wiki: document concepts as doxygen interfaces #72

h-2 opened this issue May 22, 2017 · 3 comments
Labels
good first issue assumes no knowledge over the library

Comments

@h-2
Copy link
Member

h-2 commented May 22, 2017

I good workaround for doxygen not supporting concepts seems to be excluding them from the documentation build via \cond and \nocond and then just defining them via the interface command. It is also possible to define the required functions on this concept as members or related functions of that concept.

Then we can also mark other types as \implements concept_name and have concepts that refine other concept specify \extends other_concept. This should provide for really nice documentation!

Here is an example of the alphabet_concept:

/*!\interface seqan3::alphabet_concept <>
 * \brief The generic alphabet concept that covers most data types used in ranges.
 * \ingroup alphabet
 *
 * The requirements for this concept are given as related functions and metafunctions.
 * Types that satisfy this concept are shown as "implementing this interface".
 */
/*!\fn auto seqan3::to_char(alphabet_concept const c)
 * \brief Returns the alphabet letter's value in character representation.
 * \relates seqan3::alphabet_concept
 * \param c The alphabet letter that you wish to convert to char.
 * \returns The letter's value in the alphabet's char type (seqan3::underlying_char).
 * ...
 */
//!\cond
template <typename t>
concept bool alphabet_concept = requires (t t1, t t2)
{
    // StL concepts
    requires std::is_pod_v<t> == true;
    requires std::is_swappable_v<t> == true;

    // static data members
    alphabet_size<t>::value;

    // conversion to char and rank
    { to_char(t1) } -> underlying_char_t<t>;
    { to_rank(t1) } -> underlying_rank_t<t>;
    { std::cout << t1 };

    // assignment from char and rank
    { assign_char(t1,  0) } -> t &;
    { assign_rank(t1,  0) } -> t &;
    { assign_char(t{}, 0) } -> t &&;
    { assign_rank(t{}, 0) } -> t &&;

    // required comparison operators
    { t1 == t2 } -> bool;
    { t1 != t2 } -> bool;
    { t1 <  t2 } -> bool;
    { t1 >  t2 } -> bool;
    { t1 <= t2 } -> bool;
    { t1 >= t2 } -> bool;
};
//!\endcond

@xenigmax can you do this for the existing concept definitions (alphabet, nucleotide...)? For the general concepts (range, core...) there doesn't need to be any function or requirement definition, but the correct inheritance/extension would be nice.

@marehr
Copy link
Member

marehr commented Mar 5, 2018

@h-2 Can this be closed?

@h-2
Copy link
Member Author

h-2 commented Jul 30, 2018

Can someone transfer this as instructions to the wiki?

@h-2 h-2 changed the title document concepts as doxygen interfaces wiki: document concepts as doxygen interfaces Jul 30, 2018
@h-2 h-2 added the good first issue assumes no knowledge over the library label Jul 30, 2018
@marehr
Copy link
Member

marehr commented Sep 19, 2018

@marehr marehr closed this as completed Sep 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue assumes no knowledge over the library
Projects
None yet
Development

No branches or pull requests

3 participants