From 1243cb834e83c350dbee887d096e551406ec31e2 Mon Sep 17 00:00:00 2001 From: manuel Date: Sat, 13 Jun 2009 22:20:39 +0200 Subject: adding documentation --- ue5/mean_mark.hpp | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) (limited to 'ue5/mean_mark.hpp') diff --git a/ue5/mean_mark.hpp b/ue5/mean_mark.hpp index e07aedc..614a671 100644 --- a/ue5/mean_mark.hpp +++ b/ue5/mean_mark.hpp @@ -1,3 +1,10 @@ +/** + * @module mean_mark + * @author Guenther Neuwirth (0626638), Manuel Mausz (0728348) + * @brief Templates for mean_mark, mean_mark_student, remove_greater + * @date 13.06.2009 + */ + #ifndef MEAN_MARK_H #define MEAN_MARK_H @@ -9,7 +16,18 @@ namespace Ti { - + /** + * @method mean_mark + * @brief computes mean mark in the range [first,last) + * @param first forward iterator to the initial positions in a sequence + * @param last forward iterator to the final positions in a sequence + * @return computed mean mark + * @globalvars none + * @exception none + * @pre all objects in the sequence must have a method mark returning a type + * convertible to double + * @post none + */ template double mean_mark(Iter first, Iter last) { @@ -23,6 +41,19 @@ namespace Ti return (count == 0) ? 0 : result / count; } + /** + * @method mean_mark_student + * @brief computes mean mark of objects of type Student in the range [first,last) + * (using RTTI) + * @param first forward iterator to the initial positions in a sequence + * @param last forward iterator to the final positions in a sequence + * @return computed mean mark of objects of type Student + * @globalvars none + * @exception none + * @pre All objects in the sequence must have a method mark returning a type + * convertible to double. And type Stundent must exist + * @post none + */ template double mean_mark_student(Iter first, Iter last) { @@ -41,6 +72,23 @@ namespace Ti return (count == 0) ? 0 : result / count; } + /** + * @method remove_greater + * @brief Removes from the range [first,last) the elements with a mark greater + * than mark and returns an iterator to the new end of the range, + * which now includes only elements with a mark less than mark. + * @param first forward iterator to the initial positions in a sequence + * @param last forward iterator to the final positions in a sequence + * @param mark maximal value for mark to keep + * @return A forward iterator pointing to the new end of the sequence, + * which now includes all the elements with a mark less than mark. + * @globalvars none + * @exception none + * @pre All objects in the sequence must have a method mark returning a type + * convertible to double. + * @post This function does not alter the elements past the new end, + * which keep their old values and are still accessible. + */ template ForwardIterator remove_greater (ForwardIterator first, ForwardIterator last, int mark) { @@ -55,7 +103,6 @@ namespace Ti } return result; } - } #endif -- cgit v1.2.3