From 59d4907223c7e9fd82e0503f82c5517aa941ec99 Mon Sep 17 00:00:00 2001 From: Roland Jax Date: Sat, 22 Nov 2014 19:07:38 +0100 Subject: [PATCH] missing documentation added. --- src/lib/ebus/configfile.h | 10 +++---- src/lib/ebus/port.h | 6 ++--- src/lib/utils/appl.h | 57 +++++++++++++++++++++++++++++++-------- src/lib/utils/logger.h | 16 +++++------ 4 files changed, 62 insertions(+), 27 deletions(-) diff --git a/src/lib/ebus/configfile.h b/src/lib/ebus/configfile.h index 1ace119d..b5160fc3 100644 --- a/src/lib/ebus/configfile.h +++ b/src/lib/ebus/configfile.h @@ -26,7 +26,7 @@ /** available file endings / types. */ enum FileType { - ft_csv + ft_csv // CSV }; /** @@ -51,7 +51,7 @@ public: }; /** - * @brief class for CSV config files. + * @brief derived class for CSV config files. */ class ConfigFileCSV : public ConfigFile { @@ -72,7 +72,7 @@ public: }; /** - * @brief class for class device. + * @brief class to parse configuration files and store into commands instance. */ class ConfigCommands { @@ -81,7 +81,7 @@ public: /** * @brief set file type and add recursive files from given path. * @param path to configuration files. - * @param filetype to parse. + * @param type to parse. */ ConfigCommands(const std::string path, const FileType type); @@ -92,7 +92,7 @@ public: /** * @brief setter for file type. - * @param filetype of files. + * @param type of files. */ void setType(const FileType type); diff --git a/src/lib/ebus/port.h b/src/lib/ebus/port.h index 793d97d1..13deb6a7 100644 --- a/src/lib/ebus/port.h +++ b/src/lib/ebus/port.h @@ -27,8 +27,8 @@ /** available device types. */ enum DeviceType { - dt_serial, - dt_network, + dt_serial, // serial device + dt_network // network device }; /** max bytes write to bus. */ @@ -83,7 +83,7 @@ public: /** * @brief recvBytes read bytes from opened file descriptor. - * @param timeoutmax time for new input data [usec]. + * @param timeout time for new input data [usec]. * @param maxCount max size of receive buffer. * @return number of read bytes or -1 if an error has occured. */ diff --git a/src/lib/utils/appl.h b/src/lib/utils/appl.h index 2a04bb11..186164cd 100644 --- a/src/lib/utils/appl.h +++ b/src/lib/utils/appl.h @@ -27,43 +27,78 @@ /** the available data types. */ enum DataType { - dt_none, // default value - dt_bool, // - dt_int, // - dt_long, // - dt_float, // - dt_string, // + dt_none, // default for __text_only__ + dt_bool, // boolean + dt_int, // integer + dt_long, // long + dt_float, // float + dt_string // string }; /** option types. */ enum OptionType { - ot_none, // default value - ot_optional, // a value is optional - ot_mandatory, // a value is mandatory + ot_none, // no option type is needed + ot_optional, // a value is optional + ot_mandatory // a value is mandatory }; /** structure for defining application options */ -typedef struct opt { +typedef struct { + /** long option name */ const char* name; + /** short option name */ const char* shortname; + /** description for this option */ const char* description; + /** data type for this option */ DataType datatype; + /** indicates whether an option takes an argument */ OptionType optiontype; } opt_t; -/** union for option values */ +/** + * @brief union for option values + */ union OptVal { + /** boolean */ bool b; + /** integer */ int i; + /** long */ long l; + /** float */ float f; + /** string */ const char* c; + /** + * @brief clear memory + */ OptVal() { memset(this, 0, sizeof(OptVal)); } + /** + * @brief create boolean type + * @param _b the boolean + */ OptVal(bool _b) : b(_b) {} + /** + * @brief create integer type + * @param _i the integer + */ OptVal(int _i) : i(_i) {} + /** + * @brief create long type + * @param _l the long + */ OptVal(long _l) : l(_l) {} + /** + * @brief create float type + * @param _f the float + */ OptVal(float _f) : f(_f) {} + /** + * @brief create string type + * @param _c the string + */ OptVal(const char* _c) : c(_c) {} }; diff --git a/src/lib/utils/logger.h b/src/lib/utils/logger.h index d9c84abe..9d17c50f 100644 --- a/src/lib/utils/logger.h +++ b/src/lib/utils/logger.h @@ -35,16 +35,16 @@ enum AreasType { bus=4, // ebus cyc=8, // cycle all=15, // type for all subsystems - Size_of_Areas=4, // number of possible areas + Size_of_Areas=4 // number of possible areas }; /** available logging levels */ enum LevelType { - error=0, // - event, // - trace, // - debug, // - Size_of_Level, // number of possible levels + error=0, // silent run, only errors will be printed + event, // only interesting message for normal use + trace, // most of the information for normal use + debug, // print internal states too + Size_of_Level // number of possible levels }; /** global function to get calculate logging areas */ @@ -260,14 +260,14 @@ public: /** * @brief adds a logging sink and returns the reference to logger. - * @param pointer of logging sink. + * @param sink the used logging sink. * @return the reference to logger. */ Logger& operator+=(LogSink* sink); /** * @brief removes a logging sink and returns the reference to logger. - * @param pointer of logging sink. + * @param sink the used logging sink. * @return the reference to logger. */ Logger& operator-=(const LogSink* sink);