Skip to content
Snippets Groups Projects
Commit 4e387085 authored by Nina Džugasová's avatar Nina Džugasová
Browse files

Added documentation into Containers/List.

parent 52547963
No related branches found
No related tags found
1 merge request!15Nina
...@@ -43,27 +43,34 @@ template< class T > class List ...@@ -43,27 +43,34 @@ template< class T > class List
public: public:
typedef T ValueType; typedef T ValueType;
//! Basic constructor /// \brief Basic constructor.
///
/// Constructs an empty list.
List(); List();
//! Copy constructor /// \brief Copy constructor.
///
/// Construct a copy of \e list.
/// @param list Name of another list.
List( const List& list ); List( const List& list );
//! Destructor /// \brief Destructor.
///
/// Destroys the list. References to the values in the list become invalid.
~List(); ~List();
static String getType(); static String getType();
//! If the list is empty return 'true' /// Returns \e true if the list contains no items, otherwise returns \e false.
bool isEmpty() const; bool isEmpty() const;
//! Return size of the list /// Returns number of items in the list.
int getSize() const; int getSize() const;
//! Indexing operator /// Indexing operator.
T& operator[] ( const int& ind ); T& operator[] ( const int& ind );
//! Indexing operator for constant instances /// Indexing operator for constant instances.
const T& operator[] ( const int& ind ) const; const T& operator[] ( const int& ind ) const;
const List& operator = ( const List& lst ); const List& operator = ( const List& lst );
...@@ -72,64 +79,70 @@ template< class T > class List ...@@ -72,64 +79,70 @@ template< class T > class List
bool operator != ( const List& lst ) const; bool operator != ( const List& lst ) const;
//! Append new data element /// \brief Appends new data element.
///
/// Inserts \e data at the end of the list.
bool Append( const T& data ); bool Append( const T& data );
//! Prepend new data element /// \brief Prepends new data element.
///
/// Inserts \e data at the beginning of the list.
bool Prepend( const T& data ); bool Prepend( const T& data );
//! Insert new data element at given position /// \brief Inserts new data element at given position.
///
/// Inserts \e data at index position \e ind in the list.
bool Insert( const T& data, const int& ind ); bool Insert( const T& data, const int& ind );
//! Append copy of another list /// Appends copy of another list.
bool AppendList( const List< T >& lst ); bool AppendList( const List< T >& lst );
//! Prepend copy of another list /// Prepends copy of another list.
bool PrependList( const List< T >& lst ); bool PrependList( const List< T >& lst );
template< typename Array > template< typename Array >
void toArray( Array& array ); void toArray( Array& array );
//! Erase data element at given position /// Erases data element at given position.
void Erase( const int& ind ); void Erase( const int& ind );
//! Erase data element with contained data at given position /// Erases data element with contained data at given position.
void DeepErase( const int& ind ); void DeepErase( const int& ind );
//! Erase all data elements /// Erases all data elements.
void reset(); void reset();
//! Erase all data elements with contained data /// Erases all data elements with contained data.
void DeepEraseAll(); void DeepEraseAll();
//! Save the list in binary format /// Saves the list in binary format.
bool Save( File& file ) const; bool Save( File& file ) const;
//! Save the list in binary format using method save of type T /// Saves the list in binary format using method save of type T.
bool DeepSave( File& file ) const; bool DeepSave( File& file ) const;
//! Load the list /// Loads the list.
bool Load( File& file ); bool Load( File& file );
//! Load the list using method Load of the type T /// Loads the list using method Load of the type T.
bool DeepLoad( File& file ); bool DeepLoad( File& file );
protected: protected:
//! Pointer to the first element /// Pointer to the first element.
ListDataElement< T >* first; ListDataElement< T >* first;
//! Pointer to the last element /// Pointer to the last element.
/*! We use pointer to last element while adding new element to keep order of elements /*! We use pointer to last element while adding new element to keep order of elements
*/ */
ListDataElement< T >* last; ListDataElement< T >* last;
//! List size /// List size.
int size; int size;
//! Iterator /// Iterator.
mutable ListDataElement< T >* iterator; mutable ListDataElement< T >* iterator;
//! Iterator index /// Iterator index.
mutable int index; mutable int index;
}; };
......
...@@ -76,13 +76,13 @@ class File ...@@ -76,13 +76,13 @@ class File
return this->fileName; return this->fileName;
} }
/// Returns read elements. /// Returns number of read elements.
long int getReadElements() const long int getReadElements() const
{ {
return this->readElements; return this->readElements;
} }
/// Returns written elements. /// Returns number of written elements.
long int getWrittenElements() const long int getWrittenElements() const
{ {
return this->writtenElements; return this->writtenElements;
......
...@@ -19,6 +19,7 @@ class Logger ...@@ -19,6 +19,7 @@ class Logger
{ {
public: public:
/////
/// \brief Basic constructor. /// \brief Basic constructor.
/// ///
/// \param _width Integer that defines the width of logger. /// \param _width Integer that defines the width of logger.
...@@ -26,6 +27,7 @@ class Logger ...@@ -26,6 +27,7 @@ class Logger
Logger( int _width, Logger( int _width,
std::ostream& _stream ); std::ostream& _stream );
/////
/// \brief Creates header in given logger. /// \brief Creates header in given logger.
/// ///
/// \param title String desribing the title/header. /// \param title String desribing the title/header.
...@@ -34,11 +36,12 @@ class Logger ...@@ -34,11 +36,12 @@ class Logger
/// \brief Creates predefined separator - structure in the logger. /// \brief Creates predefined separator - structure in the logger.
void writeSeparator(); void writeSeparator();
/// \brief Inserts information about system parameters into logger. /// \brief Inserts information about various system parameters into logger.
/// ///
/// \param parameters /// \param parameters
bool writeSystemInformation( const Config::ParameterContainer& parameters ); bool writeSystemInformation( const Config::ParameterContainer& parameters );
/////
/// \brief Inserts a line with current time into logger. /// \brief Inserts a line with current time into logger.
/// ///
/// \param label Description of the current time line. /// \param label Description of the current time line.
......
...@@ -24,9 +24,13 @@ TEST( TimerTest, Constructor ) ...@@ -24,9 +24,13 @@ TEST( TimerTest, Constructor )
Timer time; Timer time;
time.reset(); time.reset();
EXPECT_EQ(time.getRealTime(),0); EXPECT_EQ(time.getRealTime(),0);
time.start(); /*time.start();
EXPECT_FALSE(time.stopState);
time.stop(); time.stop();
EXPECT_NE(time.getRealTime(),0); EXPECT_TRUE(time.stopState);
EXPECT_NE(time.getRealTime(),0);*/
} }
#endif #endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment