Commit dc1da5b8 authored by GILLES Sebastien's avatar GILLES Sebastien

#1470 - #1469 Update Doxygen comments.

parent 35c1f9ad
......@@ -38,31 +38,57 @@ namespace MoReFEM
{
/*!
* \brief Print the content of a non associative container (list, vector, deque, array, etc...)
* \brief Print the content of a container (that might be associative or not - see \a PrintPolicyT).
*
* \tparam StreamT Type of output stream considered
* \tparam ContainerT Type of the container to be displayed. This might be a container of std::variant!
*
* \param[in,out] stream Output stream in which container will be displayed
* \param[in] container Container displayed
* \param[in] separator Separator between two entries of the contained
* \param[in] opener Prefix used while displaying the container
* \param[in] closer Suffix used while displaying the container
*
* In most cases templates parameters can be determined implicitly at compile time:
* \code
* std::vector<double> foo { 1., 2., 3., 10., 42. };
* std::ostringstream oconv;
* PrintContainer(foo, oconv, " ", "---", "---")
* \endcode
* This code yields:
* ---1. 2. 3. 10. 42.---
* \tparam PrintPolicyT A policy which determines how the printing of the element of the container behaves.
* Several policies are proposed in Utilities/Containers/PrintPolicy directory:
* - 'Normal': which prints a non-associative container which elements may be displayed directory with
* operator<<.
* - 'Variant': same as Normal, except that if type is std::variant a visitor is used to print it properly.
* - 'Pointer': for a non-associative container of (smart) pointers; the element is dereferenced before being
* printed.
* - 'Associative': for an associative container; each key/value is printed under format (key, value) (i.e.
* parenthesis as open/close and ", " as separator).
* - 'Key': prints only the keys of an associative containers.
*/
template<class PrintPolicyT = PrintPolicyNS::Normal>
struct PrintContainer
{
/*!
* \class doxygen_hide_print_container_common_arg
*
* \tparam StreamT Type of output stream considered
* \tparam ContainerT Type of the container to be displayed (also see class template parameter
* \a PrintPolicyT for more details).
*
* \param[in,out] stream Output stream in which container will be displayed
* \param[in] container Container displayed
* \param[in] separator Separator between two entries of the contained
* \param[in] opener Prefix used while displaying the container
* \param[in] closer Suffix used while displaying the container
*/
/*!
* \brief Function to actually print the content of a container.
*
* \internal I am using struct/static method only to deal more finely with default template parameters:
* we want the container type to be inferred automatically but the policy to use to be customizable.
*
* \copydoc doxygen_hide_print_container_common_arg
*
* In most cases templates parameters can be determined implicitly at compile time:
* \code
* std::vector<double> foo { 1., 2., 3., 10., 42. };
* std::ostringstream oconv;
* PrintContainer<>::Do(foo, oconv, " ", "---", "---")
* \endcode
* This code yields:
* ---1. 2. 3. 10. 42.---
*/
template
<
class ContainerT,
......@@ -77,6 +103,13 @@ namespace MoReFEM
StringT3&& closer = "]\n");
/*!
* \brief Function to print the \a N first elements of a container (or the whole container if N is greater
* than its size).
*
* \copydoc doxygen_hide_print_container_common_arg
* \tparam N Maximum number of elements to display.
*/
template
<
std::size_t N,
......@@ -88,8 +121,8 @@ namespace MoReFEM
>
static void Nelt(const ContainerT& container, StreamT& stream = std::cout,
StringT1&& separator = ", ",
StringT2&& opener = "[",
StringT3&& closer = "]\n");
StringT2&& opener = "[",
StringT3&& closer = "]\n");
};
......
......@@ -19,11 +19,22 @@ namespace MoReFEM::Utilities::PrintPolicyNS
{
/*!
* \brief Policy to handle the an associative container.
*
* Currently it is not customizable: the format is (key, value), i.e.:
* - Opening by '('
* - Closing by ')'
* - Separation by ", ".
*
* Of course if need be it is easy to extend this class, but no need currently.
*/
struct Associative
{
public:
//! \copydoc doxygen_hide_print_policy_do
template<class ElementTypeT>
static void Do(std::ostream& stream, ElementTypeT&& element);
......
......@@ -19,11 +19,16 @@ namespace MoReFEM::Utilities::PrintPolicyNS
{
/*!
* \brief Policy to print only the keys of an associative container.
*
*/
struct Key
{
public:
//! \copydoc doxygen_hide_print_policy_do
template<class ElementTypeT>
static void Do(std::ostream& stream, ElementTypeT&& element);
......
......@@ -18,11 +18,29 @@ namespace MoReFEM::Utilities::PrintPolicyNS
{
/*!
* \brief Policy to handle the 'normal' case, i.e. when elements inside the container are directly displayable
* with operator <<.
*
* This policy assumes the container is not associative.
*/
struct Normal
{
public:
/*!
* \class doxygen_hide_print_policy_do
*
* \brief Static method in charge of the actual work.
*
* \param[in,out] stream The stream onto which the container is printed.
* \param[in] element Element of the container which is to be displayed.
*
* \tparam Type of the element to be displayed.
*/
//! \copydoc doxygen_hide_print_policy_do
template<class ElementTypeT>
static void Do(std::ostream& stream, ElementTypeT&& element);
......
......@@ -19,11 +19,19 @@ namespace MoReFEM::Utilities::PrintPolicyNS
{
/*!
* \brief Policy to handle the content of a container of (eventually smart) pointers.
*
* Pointers are dereferenced before printing.
*
* This policy assumes the container is not associative.
*/
struct Pointer
{
public:
//! \copydoc doxygen_hide_print_policy_do
template<class ElementTypeT>
static void Do(std::ostream& stream, ElementTypeT&& element);
......
......@@ -21,11 +21,19 @@ namespace MoReFEM::Utilities::PrintPolicyNS
{
/*!
* \brief Policy to handle the case a container element might be a std::variant.
*
* If so, a visitor is used to print it (so it does assume all types within the std::variant are directly printable).
*
* This policy assumes the container is not associative.
*/
struct Variant
{
public:
//! \copydoc doxygen_hide_print_policy_do
template<class ElementTypeT>
static void Do(std::ostream& stream, ElementTypeT&& element);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment