Commit 0cbf9462 authored by Mathias Goldau's avatar Mathias Goldau
Browse files

[DOC #183] some improvements on doxygen errors

parent 8c4b3ab1
......@@ -25,9 +25,9 @@
#ifndef WCOLOR_H
#define WCOLOR_H
#include <cassert>
#include <istream>
#include <ostream>
#include <cassert>
#include <string>
#include <vector>
......@@ -104,13 +104,20 @@ public:
protected:
private:
float m_red;
float m_green;
float m_blue;
float m_alpha;
float m_red; //!< Red channel
float m_green; //!< Green channel
float m_blue; //!< Blue channel
float m_alpha; //!< Alpha channel
};
/**
* Write a color in string represensation to the given output stream.
*/
std::ostream& operator<<( std::ostream& out, const WColor& c );
/**
* Write a color in string represensation to the given input stream.
*/
std::istream& operator>>( std::istream& in, WColor& c );
#endif // WCOLOR_H
......@@ -216,155 +216,155 @@ private:
*/
namespace wlog
{
/**
* Resource class for streamed logging.
*/
class WStreamedLogger
{
public:
/**
* Resource class for streamed logging.
*/
class WStreamedLogger
{
public:
/**
* Creates new streamed logger instance. Logging is deferred until
* destruction of this instance.
*
* \param source Source from which the log message originates
* \param level The LogLevel of the message
*/
WStreamedLogger( const std::string& source, LogLevel level );
/**
* Appends something loggable (to std::string castable) to the log.
*/
template< typename T > WStreamedLogger operator<<( const T& loggable );
// alias for std::endl etc. type
typedef std::basic_ostream< char, std::char_traits< char > > OutStreamType;
typedef OutStreamType& ( *StreamManipulatorFunctor )( OutStreamType& );
/**
* This is totally crazy man! Don't get dizzy on that, watch out and
* ask a C++ guru next to your side, which is probably named Christian
* or have a look on that: http://stackoverflow.com/questions/1134388/stdendl-is-of-unknown-type-when-overloading-operator
*
* Allow std::endl to be streamed into log messages.
*
* \param manip Function pointer e.g. std::endl, std::flush, std::ends
*/
WStreamedLogger operator<<( StreamManipulatorFunctor manip );
protected:
private:
/**
* Actually implementing the streaming functionality.
*/
class Buffer
{
public:
/**
* Constructs a new stream for logging.
*
* \param source String identifying the source of the message
* \param level LogLevel of the message
*/
Buffer( const std::string& source, LogLevel level );
/**
* Commits the logging expression to our WLogger
*/
virtual ~Buffer();
std::ostringstream m_logString; //!< queuing up parts of the log message
LogLevel m_level; //!< Default logging level for this stream
std::string m_source; //!< The source of the logging message
};
/**
* Forbid assignment
*/
WStreamedLogger& operator=( const WStreamedLogger& rhs );
boost::shared_ptr< Buffer > m_buffer; //!< Collects the message parts.
};
inline WStreamedLogger::WStreamedLogger( const std::string& source, LogLevel level )
: m_buffer( new Buffer( source, level ) )
{
}
template< typename T > inline WStreamedLogger WStreamedLogger::operator<<( const T& loggable )
{
m_buffer->m_logString << loggable;
return *this;
}
inline WStreamedLogger WStreamedLogger::operator<<( StreamManipulatorFunctor manip )
{
manip( m_buffer->m_logString );
return *this;
}
inline WStreamedLogger::Buffer::~Buffer()
{
WLogger::getLogger()->addLogMessage( m_logString.str(), m_source, m_level );
}
inline WStreamedLogger::Buffer::Buffer( const std::string& source, LogLevel level )
: m_logString(),
m_level( level ),
m_source( source )
{
}
/**
* Convinient function for logging messages to our WLogger but not for
* public use outside of this module.
* Creates new streamed logger instance. Logging is deferred until
* destruction of this instance.
*
* \param source Indicate the source where this log message origins.
* \param level The LogLevel of this message
* \param source Source from which the log message originates
* \param level The LogLevel of the message
*/
inline WStreamedLogger _wlog( const std::string& source, LogLevel level )
{
return WStreamedLogger( source, level );
}
WStreamedLogger( const std::string& source, LogLevel level );
/**
* Logging an error message.
*
* \param source Indicate the source where this log message origins.
* Appends something loggable (to std::string castable) to the log.
*/
inline WStreamedLogger error( const std::string& source )
{
return _wlog( source, LL_ERROR );
}
template< typename T > WStreamedLogger operator<<( const T& loggable );
// alias for std::endl etc. type
typedef std::basic_ostream< char, std::char_traits< char > > OutStreamType;
typedef OutStreamType& ( *StreamManipulatorFunctor )( OutStreamType& );
/**
* Loggin a warning message.
* This is totally crazy man! Don't get dizzy on that, watch out and
* ask a C++ guru next to your side, which is probably named Christian
* or have a look on that: http://stackoverflow.com/questions/1134388/stdendl-is-of-unknown-type-when-overloading-operator
*
* Allow std::endl to be streamed into log messages.
*
* \param source Indicate the source where this log message origins.
* \param manip Function pointer e.g. std::endl, std::flush, std::ends
*/
inline WStreamedLogger warn( const std::string& source )
{
return _wlog( source, LL_WARNING );
}
WStreamedLogger operator<<( StreamManipulatorFunctor manip );
protected:
private:
/**
* Loggin an information message.
*
* \param source Indicate the source where this log message origins.
* Actually implementing the streaming functionality.
*/
inline WStreamedLogger info( const std::string& source )
class Buffer
{
return _wlog( source, LL_INFO );
}
public: // NOLINT inner classes may have also lables
/**
* Constructs a new stream for logging.
*
* \param source String identifying the source of the message
* \param level LogLevel of the message
*/
Buffer( const std::string& source, LogLevel level );
/**
* Commits the logging expression to our WLogger
*/
virtual ~Buffer();
std::ostringstream m_logString; //!< queuing up parts of the log message
LogLevel m_level; //!< Default logging level for this stream
std::string m_source; //!< The source of the logging message
};
/**
* Loggin a debug message.
*
* \param source Indicate the source where this log message origins.
* Forbid assignment
*/
inline WStreamedLogger debug( const std::string& source )
{
return _wlog( source, LL_DEBUG );
}
WStreamedLogger& operator=( const WStreamedLogger& rhs );
boost::shared_ptr< Buffer > m_buffer; //!< Collects the message parts.
};
inline WStreamedLogger::WStreamedLogger( const std::string& source, LogLevel level )
: m_buffer( new Buffer( source, level ) )
{
}
template< typename T > inline WStreamedLogger WStreamedLogger::operator<<( const T& loggable )
{
m_buffer->m_logString << loggable;
return *this;
}
inline WStreamedLogger WStreamedLogger::operator<<( StreamManipulatorFunctor manip )
{
manip( m_buffer->m_logString );
return *this;
}
inline WStreamedLogger::Buffer::~Buffer()
{
WLogger::getLogger()->addLogMessage( m_logString.str(), m_source, m_level );
}
inline WStreamedLogger::Buffer::Buffer( const std::string& source, LogLevel level )
: m_logString(),
m_level( level ),
m_source( source )
{
}
/**
* Convinient function for logging messages to our WLogger but not for
* public use outside of this module.
*
* \param source Indicate the source where this log message origins.
* \param level The LogLevel of this message
*/
inline WStreamedLogger _wlog( const std::string& source, LogLevel level )
{
return WStreamedLogger( source, level );
}
/**
* Logging an error message.
*
* \param source Indicate the source where this log message origins.
*/
inline WStreamedLogger error( const std::string& source )
{
return _wlog( source, LL_ERROR );
}
/**
* Loggin a warning message.
*
* \param source Indicate the source where this log message origins.
*/
inline WStreamedLogger warn( const std::string& source )
{
return _wlog( source, LL_WARNING );
}
/**
* Loggin an information message.
*
* \param source Indicate the source where this log message origins.
*/
inline WStreamedLogger info( const std::string& source )
{
return _wlog( source, LL_INFO );
}
/**
* Loggin a debug message.
*
* \param source Indicate the source where this log message origins.
*/
inline WStreamedLogger debug( const std::string& source )
{
return _wlog( source, LL_DEBUG );
}
} // end of namespace log
#endif // WLOGGER_H
......@@ -38,6 +38,8 @@ public:
/**
* Constructs a new status reporter with the number of total steps
* which it should reach to reach the 100 percent.
*
* \param totalSteps Number of total steps which symbolize 100 percent.
*/
explicit WStatusReport( unsigned int totalSteps );
......@@ -65,14 +67,16 @@ public:
/**
* Increments the finished work by the number of the given steps.
*
* \param numSteps Number of steps to increment
* \return The progress()
*/
double operator+=( unsigned int numSteps );
/**
* Generates a string which represents the progress in terms of
* characters. When reaching 100 percent finally finalNumOfSymbols are
* returned.
* Generates a string which represents the progress as bar of chars.
*
* \param symbol The char used for the progressbar indication
* \param finalNumOfSymbols How many symbols represent the 100 percent
*/
std::string stringBar( char symbol = '#', unsigned int finalNumOfSymbols = 50 ) const;
......@@ -82,5 +86,4 @@ private:
unsigned int m_finishedSteps; //!< indicates the work done so far
};
#endif // WSTATUSREPORT_H
......@@ -77,6 +77,10 @@ namespace wiotools
/**
* Transform a whole array of elements (of type T and size of sizeof(T))
* into opposite byte order.
*
* \param array Array containing the data
* \param arraySize The number of elements which is not the number of
* bytes but e.g. the number of floats
*/
template< class T > void switchByteOrderOfArray( T *array, const size_t arraySize )
{
......@@ -87,6 +91,7 @@ namespace wiotools
}
/**
* \param name File name to get the extension or suffix from.
* \return filename suffix
*/
inline std::string getSuffix( std::string name )
......@@ -96,17 +101,23 @@ namespace wiotools
/**
* Checks if a given path already exists or not
*
* \param path Path to be checked on existence
*/
inline bool fileExists( std::string path )
{
return boost::filesystem::exists( boost::filesystem::path( path ) );
}
/**
* Generate a file name with full path for a temp file. Watch out on all
* platforms!
*/
inline std::string tempFileName()
{
// REGARDING THE COMPILER WARNING
// 1. mkstemp is only available for POSIX systems
// 2. the warning generated here is due to a race condition
// 2. reason: the warning generated here is due to a race condition
// while tmpnam invents the fileName it may be created by another process
// 3. file names like "/tmp/pansen" or "C:\pansen" are platform dependent
return std::string( std::tmpnam( NULL ) );
......
......@@ -47,6 +47,7 @@ public:
/**
* Reset the file name and checks if it exists.
*
* \param fname file name
* \throws WDHNoSuchFile
*/
void setFileName( std::string fname ) throw( WDHNoSuchFile );
......
......@@ -41,11 +41,15 @@ public:
/**
* Creates a reader object for look up tables. On parameter documention
* take a look into the WReader base class.
*
* \param fname file name
*/
explicit WReaderLookUpTableVTK( std::string fname );
/**
* Perform reading from the file.
*
* \param table vector where to place the elements of the table
*/
void readTable( boost::shared_ptr< std::vector< double > > table ) const;
......
......@@ -309,7 +309,7 @@ protected:
wlog::WStreamedLogger logWarn() const;
wlog::WStreamedLogger logError() const;
// **************************************************************************************************************************
//
// Members
......
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