Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NP_TMcode
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Giacomo Mulas
NP_TMcode
Commits
e5ebe973
Commit
e5ebe973
authored
1 year ago
by
Giovanni La Mura
Browse files
Options
Downloads
Patches
Plain Diff
Parse List docstrings according to doxygen syntax
parent
d85d31ee
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/include/List.h
+19
-18
19 additions, 18 deletions
src/include/List.h
with
19 additions
and
18 deletions
src/include/List.h
+
19
−
18
View file @
e5ebe973
...
...
@@ -8,15 +8,15 @@
#include
<string>
/**
* \brief Exception for out of bounds
l
ist requests.
* \brief Exception for out of bounds
L
ist requests.
*/
class
ListOutOfBoundsException
:
public
std
::
exception
{
protected:
//! \brief Minimum index defined in the
l
ist.
//! \brief Minimum index defined in the
L
ist.
int
min_index
;
//! \brief Maximum index defined in the
l
ist.
//! \brief Maximum index defined in the
L
ist.
int
max_index
;
//! \brief
I
ndex requested by user.
//! \brief
List i
ndex requested by user.
int
requested_index
;
public:
...
...
@@ -58,7 +58,7 @@ public:
*
* For this reason, the best use of List objects is to collect all the
* desired members and then, once the element number is known, to convert
* the List to C array, by calling List.to_array(). This function returns
* the List to C array, by calling
`
List.to_array()
`
. This function returns
* a contiguous array of type T[SIZE] that can be used for indexed access.
*/
template
<
class
T
>
class
List
{
...
...
@@ -75,18 +75,19 @@ template<class T> class List {
public
:
/*! \brief List constructor.
*
* Use the constructor List<T>([int length]) to create a new list with a given
* Use the constructor
`
List<T>([int length])
`
to create a new list with a given
* size. If the required size is not known in advance, it is recommended
* to create a List with SIZE=1 (this is the default behavior) and then
* to append the elements dynamically, using List.append(ELEMENT) (where
* to append the elements dynamically, using
`
List.append(ELEMENT)
`
(where
* ELEMENT needs to be a value of type T, corresponding to the class
* template specialization). Note that, due to the default behavior, the
* following calls are equivalent and they both produce an integer List
* with size equal to 1:
*
* a = List<int>(1);
*
* b = List<int>();
* \code{.cpp}
* List<int> a = List<int>(1);
* List<int> b = List<int>();
* \endcode
*
* \param length: `int` The size of the list to be constructed [OPTIONAL, default=1].
*/
...
...
@@ -116,14 +117,14 @@ template<class T> class List {
}
}
/*! \brief Append an element at the end of the
l
ist.
/*! \brief Append an element at the end of the
L
ist.
*
* To dynamically create a list whose size is not known in advance,
* elements can be appended in an iterative way. Note that element
* manipulation is much more effective in a C array than in a List
* object. For this reason, after the List has been created, it is
* strongly advised to convert it to a C array by calling the function
* List.to_array().
*
`
List.to_array()
`
.
*
* \param value: `T` The value of the element to be appended.
*/
...
...
@@ -143,7 +144,7 @@ template<class T> class List {
*
* \param index: `int` The index of the element to be retrieved. 0 for first.
* \return value `T` The value of the element at the requested position.
* \throws L
IST_OUT_OF_BOUNDS_EXCEPTION
: Raised if the index is out of bounds.
* \throws L
istOutOfBoundsException
: Raised if the index is out of bounds.
*/
T
get
(
int
index
)
{
if
(
index
<
0
||
index
>
size
-
1
)
{
...
...
@@ -154,11 +155,11 @@ template<class T> class List {
return
current
->
value
;
}
/*! \brief Get the number of elements in the
l
ist.
/*! \brief Get the number of elements in the
L
ist.
*
* Get the number of elements currently stored in the
l
ist.
* Get the number of elements currently stored in the
L
ist.
*
* \return size `int` The size of the
l
ist.
* \return size `int` The size of the
L
ist.
*/
int
length
()
{
return
size
;
...
...
@@ -171,7 +172,7 @@ template<class T> class List {
*
* \param index: `int` The index of the element to be set. 0 for first.
* \param value: `int` The value to store in the pointed element.
* \throws L
IST_OUT_OF_BOUNDS_EXCEPTION
: Raised if the index is out of bounds.
* \throws L
istOutOfBoundsException
: Raised if the index is out of bounds.
*/
void
set
(
int
index
,
T
value
)
{
if
(
index
<
0
||
index
>
size
-
1
)
{
...
...
@@ -189,7 +190,7 @@ template<class T> class List {
* resulting object is not contiguosly stored in memory. As a result,
* access to specific elements in the middle of the list is not very
* effective, because the list needs to be walked every time up to
* the desired position. In order to avoid this, List.to_array() makes
* the desired position. In order to avoid this,
`
List.to_array()
`
makes
* a conversion from List to C array, returning a contiguous object,
* where indexed access can be used.
*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment