switched to autobrief

This commit is contained in:
john30
2015-01-18 12:40:54 +01:00
parent fb99ac55a1
commit 44957a6566
20 changed files with 335 additions and 335 deletions
+2 -2
View File
@@ -167,7 +167,7 @@ SHORT_NAMES = NO
# description.)
# The default value is: NO.
JAVADOC_AUTOBRIEF = NO
JAVADOC_AUTOBRIEF = YES
# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
# line (until the first dot) of a Qt-style comment as the brief description. If
@@ -175,7 +175,7 @@ JAVADOC_AUTOBRIEF = NO
# requiring an explicit \brief command for a brief description.)
# The default value is: NO.
QT_AUTOBRIEF = NO
QT_AUTOBRIEF = YES
# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
+11 -11
View File
@@ -28,7 +28,7 @@
using namespace std;
/** @brief possible client commands */
/** possible client commands */
enum CommandType {
ct_read, //!< read ebus values
ct_write, //!< write ebus values
@@ -44,41 +44,41 @@ enum CommandType {
};
/**
* @brief class baseloop which handle client messages.
* class baseloop which handle client messages.
*/
class BaseLoop
{
public:
/**
* @brief Construct the base loop and create messaging, network and bus handling subsystems.
* Construct the base loop and create messaging, network and bus handling subsystems.
*/
BaseLoop();
/**
* @brief Destructor.
* Destructor.
*/
~BaseLoop();
/**
* @brief Load the message definitions.
* Load the message definitions.
* @return the result code.
*/
result_t loadMessages();
/**
* @brief start baseloop instance.
* start baseloop instance.
*/
void start();
/**
* @brief add a new network message to internal message queue.
* add a new network message to internal message queue.
* @param message the network message.
*/
void addMessage(NetMessage* message) { m_netQueue.add(message); }
/**
* @brief Create a log message for a received/sent raw data byte.
* Create a log message for a received/sent raw data byte.
* @param byte the raw data byte.
* @param received true if the byte was received, false if it was sent.
*/
@@ -111,7 +111,7 @@ private:
WQueue<NetMessage*> m_netQueue;
/**
* @brief compare client command with defined.
* compare client command with defined.
* @param item the client command to compare.
* @return the founded client command type.
*/
@@ -133,7 +133,7 @@ private:
}
/**
* @brief Decode and execute client message.
* Decode and execute client message.
* @param data the data string to decode (may be empty).
* @param listening set to true when the client is in listening mode.
* @return result string to send back to client.
@@ -141,7 +141,7 @@ private:
string decodeMessage(const string& data, bool& listening);
/**
* @brief Get the updates received since the specified time.
* Get the updates received since the specified time.
* @param since the start time from which to add updates (inclusive).
* @param until the end time to which to add updates (exclusive).
* @return result string to send back to client.
+1 -1
View File
@@ -39,7 +39,7 @@ extern Logger& L;
#define LOG(area, level, ...) (L.hasSink(area, level) == true) ? L.log(area, level, __VA_ARGS__) : void(0)
/**
* @brief Return the string corresponding to the @a BusState.
* Return the string corresponding to the @a BusState.
* @param state the @a BusState.
* @return the string corresponding to the @a BusState.
*/
+31 -31
View File
@@ -39,19 +39,19 @@ using namespace std;
/* the maximum allowed time [us] for retrieving a symbol from an addressed slave. */
//#define SLAVE_RECV_TIMEOUT 10000
/** @brief the maximum allowed time [us] for retrieving the AUTO-SYN symbol (45ms + 2*1,2% + 1 Symbol). */
/** the maximum allowed time [us] for retrieving the AUTO-SYN symbol (45ms + 2*1,2% + 1 Symbol). */
#define SYN_TIMEOUT 50800
/** @brief the time [us] for determining bus signal availability (AUTO-SYN timeout * 5). */
/** the time [us] for determining bus signal availability (AUTO-SYN timeout * 5). */
#define SIGNAL_TIMEOUT 250000
/** @brief the maximum duration [us] of a single symbol (Start+8Bit+Stop+Extra @ 2400Bd-2*1,2%). */
/** the maximum duration [us] of a single symbol (Start+8Bit+Stop+Extra @ 2400Bd-2*1,2%). */
#define SYMBOL_DURATION 4700
/** @brief the maximum allowed time [us] for retrieving back a sent symbol (2x symbol duration). */
/** the maximum allowed time [us] for retrieving back a sent symbol (2x symbol duration). */
#define SEND_TIMEOUT (2*SYMBOL_DURATION)
/** @brief the possible bus states. */
/** the possible bus states. */
enum BusState {
bs_noSignal, //!< no signal on the bus
bs_skip, //!< skip all symbols until next @a SYN
@@ -70,7 +70,7 @@ enum BusState {
class BusHandler;
/**
* @brief Generic request for sending to and receiving from the bus.
* Generic request for sending to and receiving from the bus.
*/
class BusRequest
{
@@ -78,7 +78,7 @@ class BusRequest
public:
/**
* @brief Constructor.
* Constructor.
* @param master the master data @a SymbolString to send.
* @param deleteOnFinish whether to automatically delete this @a BusRequest when finished.
*/
@@ -87,12 +87,12 @@ public:
m_deleteOnFinish(deleteOnFinish) {}
/**
* @brief Destructor.
* Destructor.
*/
virtual ~BusRequest() {}
/**
* @brief Notify the request of the specified result.
* Notify the request of the specified result.
* @param result the result of the request.
* @param slave the slave data @a SymbolString received.
* @return true if the request needs to be restarted.
@@ -114,7 +114,7 @@ protected:
/**
* @brief A poll @a BusRequest handled by @a BusHandler itself.
* A poll @a BusRequest handled by @a BusHandler itself.
*/
class PollRequest : public BusRequest
{
@@ -122,19 +122,19 @@ class PollRequest : public BusRequest
public:
/**
* @brief Constructor.
* Constructor.
* @param message the associated @a Message.
*/
PollRequest(Message* message)
: BusRequest(m_master, true), m_message(message) {}
/**
* @brief Destructor.
* Destructor.
*/
virtual ~PollRequest() {}
/**
* @brief Prepare the master data.
* Prepare the master data.
* @param masterAddress the master bus address to use.
* @return the result code.
*/
@@ -155,7 +155,7 @@ private:
/**
* @brief A scan @a BusRequest handled by @a BusHandler itself.
* A scan @a BusRequest handled by @a BusHandler itself.
*/
class ScanRequest : public BusRequest
{
@@ -163,7 +163,7 @@ class ScanRequest : public BusRequest
public:
/**
* @brief Constructor.
* Constructor.
* @param message the primary query @a Message.
* @param messages the optional secondary query @a Message instances (to be queried only when the primary was successful).
* @param scanResults the map in which to store the formatted scan result by slave address.
@@ -174,12 +174,12 @@ public:
m_scanResults(scanResults) {}
/**
* @brief Destructor.
* Destructor.
*/
virtual ~ScanRequest() {}
/**
* @brief Prepare the master data.
* Prepare the master data.
* @param masterAddress the master bus address to use.
* @param dstAddress the destination address to set.
* @return the result code.
@@ -207,7 +207,7 @@ private:
/**
* @brief An active @a BusRequest that can be waited for.
* An active @a BusRequest that can be waited for.
*/
class ActiveBusRequest : public BusRequest
{
@@ -215,7 +215,7 @@ class ActiveBusRequest : public BusRequest
public:
/**
* @brief Constructor.
* Constructor.
* @param master reference to the master data @a SymbolString to send.
* @param slave reference to @a SymbolString for filling in the received slave data.
*/
@@ -223,7 +223,7 @@ public:
: BusRequest(master, false), m_result(RESULT_SYN), m_slave(slave) {}
/**
* @brief Destructor.
* Destructor.
*/
virtual ~ActiveBusRequest() {}
@@ -242,14 +242,14 @@ private:
/**
* @brief Handles input from and output to the bus with respect to the ebus protocol.
* Handles input from and output to the bus with respect to the ebus protocol.
*/
class BusHandler : public Thread
{
public:
/**
* @brief Construct a new instance.
* Construct a new instance.
* @param port the @a Port instance for accessing the bus.
* @param messages the @a MessageMap instance with all known @a Message instances.
* @param ownAddress the own master address.
@@ -280,7 +280,7 @@ public:
}
/**
* @brief Destructor.
* Destructor.
*/
virtual ~BusHandler() {
if (m_scanMessage != NULL)
@@ -288,7 +288,7 @@ public:
}
/**
* @brief Send a message on the bus and wait for the answer.
* Send a message on the bus and wait for the answer.
* @param master the @a SymbolString with the master data to send.
* @param slave the @a SymbolString that will be filled with retrieved slave data.
* @return the result code.
@@ -296,26 +296,26 @@ public:
result_t sendAndWait(SymbolString& master, SymbolString& slave);
/**
* @brief Main thread entry.
* Main thread entry.
*/
virtual void run();
/**
* @brief Get the last received data for the @a Message.
* Get the last received data for the @a Message.
* @param message the @a Message instance.
* @return the last received data for the @a Message, or the empty string if not available.
*/
string getReceivedData(Message* message);
/**
* @brief Initiate a scan of the slave addresses.
* Initiate a scan of the slave addresses.
* @param full true for a full scan (all slaves), false for scanning only already seen slaves.
* @return the result code.
*/
result_t startScan(bool full=false);
/**
* @brief Format the scan result to the @a ostringstream.
* Format the scan result to the @a ostringstream.
* @param output the @a ostringstream to format the scan result to.
*/
void formatScanResult(ostringstream& output);
@@ -323,13 +323,13 @@ public:
private:
/**
* @brief Handle the next symbol on the bus.
* Handle the next symbol on the bus.
* @return RESULT_OK on success, or an error code.
*/
result_t handleSymbol();
/**
* @brief Set a new @a BusState and add a log message if necessary.
* Set a new @a BusState and add a log message if necessary.
* @param state the new @a BusState.
* @param result the result code.
* @param firstRepetition true if the first repetition of a message part is being started.
@@ -338,7 +338,7 @@ private:
result_t setState(BusState state, result_t result, bool firstRepetition=false);
/**
* @brief Called when a passive reception was successfully completed.
* Called when a passive reception was successfully completed.
*/
void receiveCompleted();
+2 -2
View File
@@ -158,7 +158,7 @@ void signal_handler(int sig)
}
/**
* @brief Read the configuration files from the specified path.
* Read the configuration files from the specified path.
* @param path the path from which to read the files.
* @param extension the filename extension of the files to read.
* @param logFunc the function to call for logging, or @a NULL to be silent.
@@ -207,7 +207,7 @@ static result_t readConfigFiles(const string path, const string extension, DataF
};
/**
* @brief Load the message definitions from the configuration files.
* Load the message definitions from the configuration files.
* @param templates the @a DataFieldTemplates to load the templates into.
* @param messages the @a MessageMap to load the messages into.
* @param verbose whether to verbosely log problems.
+19 -19
View File
@@ -34,14 +34,14 @@ using namespace std;
class Connection;
/**
* @brief class for data/message transfer between connection and baseloop.
* class for data/message transfer between connection and baseloop.
*/
class NetMessage
{
public:
/**
* @brief constructs a new instance with data received from the client.
* constructs a new instance with data received from the client.
* @param data from client.
* @param listening whether the client is in listening mode.
* @param listenSince start timestamp of listening update.
@@ -54,7 +54,7 @@ public:
}
/**
* @brief destructor.
* destructor.
*/
~NetMessage()
{
@@ -64,7 +64,7 @@ public:
private:
/**
* @brief Hidden copy constructor.
* Hidden copy constructor.
* @param src the object to copy from.
*/
NetMessage(const NetMessage& src);
@@ -72,13 +72,13 @@ private:
public:
/**
* @brief get the data string.
* get the data string.
* @return the data string.
*/
string getData() const { return m_data; }
/**
* @brief Wait for the result being set and return the result string.
* Wait for the result being set and return the result string.
* @return the result string.
*/
string getResult() {
@@ -93,7 +93,7 @@ public:
}
/**
* @brief Set the result string and notify the waiting thread.
* Set the result string and notify the waiting thread.
* @param result the result string.
* @param listening whether the client is in listening mode.
* @param listenUntil the end time to which to updates were added (exclusive).
@@ -110,7 +110,7 @@ public:
}
/**
* @brief Return whether the client is in listening mode.
* Return whether the client is in listening mode.
* @param listenSince set to the start time from which to add updates (inclusive).
* @return whether the client is in listening mode.
*/
@@ -141,14 +141,14 @@ private:
};
/**
* @brief class connection which handle client and baseloop communication.
* class connection which handle client and baseloop communication.
*/
class Connection : public Thread
{
public:
/**
* @brief create a new connection instance.
* create a new connection instance.
* @param socket the tcp socket for communication.
* @param netQueue the remote queue for network messages.
*/
@@ -158,17 +158,17 @@ public:
virtual ~Connection() { delete m_socket; }
/**
* @brief endless loop for connection instance.
* endless loop for connection instance.
*/
virtual void run();
/**
* @brief close active connection.
* close active connection.
*/
virtual void stop() { m_notify.notify(); Thread::stop(); }
/**
* @brief return own connection id.
* return own connection id.
* @return id of current connection.
*/
int getID() { return m_id; }
@@ -195,14 +195,14 @@ private:
};
/**
* @brief class network which listening on tcp socket for incoming connections.
* class network which listening on tcp socket for incoming connections.
*/
class Network : public Thread
{
public:
/**
* @brief create a network instance and listening for incoming connections.
* create a network instance and listening for incoming connections.
* @param local true to accept connections only for local host.
* @param port the tcp port to listening.
* @param netQueue the remote queue for network messages.
@@ -210,17 +210,17 @@ public:
Network(const bool local, const int port, WQueue<NetMessage*>* netQueue);
/**
* @brief destructor.
* destructor.
*/
~Network();
/**
* @brief endless loop for network instance.
* endless loop for network instance.
*/
virtual void run();
/**
* @brief shutdown network subsystem.
* shutdown network subsystem.
*/
void stop() const { m_notify.notify(); usleep(100000); }
@@ -241,7 +241,7 @@ private:
bool m_listening;
/**
* @brief clean inactive connections from container.
* clean inactive connections from container.
*/
void cleanConnections();
+56 -56
View File
@@ -34,26 +34,26 @@
using namespace std;
/** @brief the separator character used between multiple values (in CSV only). */
/** the separator character used between multiple values (in CSV only). */
#define VALUE_SEPARATOR ';'
/** @brief the separator character used between base type name and length (in CSV only). */
/** the separator character used between base type name and length (in CSV only). */
#define LENGTH_SEPARATOR ':'
/** @brief the replacement string for undefined values (in UI and CSV). */
/** the replacement string for undefined values (in UI and CSV). */
#define NULL_VALUE "-"
/** @brief the separator character used between fields (in UI only). */
/** the separator character used between fields (in UI only). */
#define UI_FIELD_SEPARATOR ';'
/** @brief the message part in which a data field is stored. */
/** the message part in which a data field is stored. */
enum PartType {
pt_any, //!< stored in any data (master or slave)
pt_masterData, //!< stored in master data
pt_slaveData, //!< stored in slave data
};
/** @brief the available base data types. */
/** the available base data types. */
enum BaseType {
bt_str, //!< text string in a @a StringDataField
bt_hexstr, //!< hex digit string in a @a StringDataField
@@ -73,7 +73,7 @@ static const unsigned int IGN = 0x40; //!< ignore value during read and write
static const unsigned int FIX = 0x80; //!< fixed width formatting
static const unsigned int REQ = 0x100;//!< value may not be NULL
/** @brief The structure for defining field types with their properties. */
/** The structure for defining field types with their properties. */
typedef struct {
const char* name; //!< field identifier
//todo rename to bitCount
@@ -87,7 +87,7 @@ typedef struct {
} dataType_t;
/**
* @brief Parse an unsigned int value.
* Parse an unsigned int value.
* @param str the string to parse.
* @param base the numerical base.
* @param minValue the minimum resulting value.
@@ -99,7 +99,7 @@ typedef struct {
unsigned int parseInt(const char* str, int base, const unsigned int minValue, const unsigned int maxValue, result_t& result, unsigned int* length=NULL);
/**
* @brief Print the error position of the iterator to stdout.
* Print the error position of the iterator to stdout.
* @param begin the iterator to the beginning of the items.
* @param end the iterator to the end of the items.
* @param pos the iterator with the erroneous position.
@@ -114,14 +114,14 @@ class DataFieldTemplates;
class SingleDataField;
/**
* @brief Base class for all kinds of data fields.
* Base class for all kinds of data fields.
*/
class DataField
{
public:
/**
* @brief Constructs a new instance.
* Constructs a new instance.
* @param name the field name.
* @param comment the field comment.
*/
@@ -129,12 +129,12 @@ public:
: m_name(name), m_comment(comment) {}
/**
* @brief Destructor.
* Destructor.
*/
virtual ~DataField() {}
/**
* @brief Factory method for creating new instances.
* Factory method for creating new instances.
* @param it the iterator to traverse for the definition parts.
* @param end the iterator pointing to the end of the definition parts.
* @param templates the @a DataFieldTemplates to be referenced by name, or NULL.
@@ -149,14 +149,14 @@ public:
const bool isWriteMessage=false, const unsigned char dstAddress=SYN);
/**
* @brief Returns the length of this field (or contained fields) in bytes.
* Returns the length of this field (or contained fields) in bytes.
* @param partType the message part of the contained fields to limit the length calculation to.
* @return the length of this field (or contained fields) in bytes.
*/
virtual unsigned char getLength(PartType partType) = 0;
/**
* @brief Derives a new DataField from this field.
* Derives a new DataField from this field.
* @param name the field name.
* @param comment the field comment, or empty to use this fields comment.
* @param unit the value unit, or empty to use this fields unit (if applicable).
@@ -172,25 +172,25 @@ public:
vector<SingleDataField*>& fields) = 0;
/**
* @brief Get the field name.
* Get the field name.
* @return the field name.
*/
string getName() const { return m_name; }
/**
* @brief Get the field comment.
* Get the field comment.
* @return the field comment.
*/
string getComment() const { return m_comment; }
/**
* @brief Dump the field settings to the output.
* Dump the field settings to the output.
* @param output the @a ostream to dump to.
*/
virtual void dump(ostream& output) = 0;
/**
* @brief Reads the value from the @a SymbolString.
* Reads the value from the @a SymbolString.
* @param partType the @a PartType of the data.
* @param data the unescaped data @a SymbolString for reading binary data.
* @param offset the additional offset to add for reading binary data.
@@ -211,7 +211,7 @@ public:
char separator=UI_FIELD_SEPARATOR) = 0;
/**
* @brief Writes the value to the master or slave @a SymbolString.
* Writes the value to the master or slave @a SymbolString.
* @param input the @a istringstream to parse the formatted value from.
* @param partType the @a PartType of the data.
* @param data the unescaped data @a SymbolString for writing binary data.
@@ -235,14 +235,14 @@ protected:
/**
* @brief A single @a DataField holding a value.
* A single @a DataField holding a value.
*/
class SingleDataField : public DataField
{
public:
/**
* @brief Constructs a new instance.
* Constructs a new instance.
* @param name the field name.
* @param comment the field comment.
* @param unit the value unit.
@@ -258,24 +258,24 @@ public:
m_length(length) {}
/**
* @brief Destructor.
* Destructor.
*/
virtual ~SingleDataField() {}
/**
* @brief Get the value unit.
* Get the value unit.
* @return the value unit.
*/
string getUnit() const { return m_unit; }
/**
* @brief Get whether this field is ignored.
* Get whether this field is ignored.
* @return whether this field is ignored.
*/
bool isIgnored() const { return (m_dataType.flags & IGN) != 0; }
/**
* @brief Get the message part in which the field is stored.
* Get the message part in which the field is stored.
* @return the message part in which the field is stored.
*/
PartType getPartType() const { return m_partType; }
@@ -285,7 +285,7 @@ public:
// re-use same position as previous field as not all bits of fully consumed yet
/**
* @brief Get whether this field uses a full byte offset.
* Get whether this field uses a full byte offset.
* @param after @p true to check after consuming the bits, false to check before.
* @return true if this field uses a full byte offset, false if this field
* only consumes a part of a byte and a subsequent field may re-use the same offset.
@@ -310,7 +310,7 @@ public:
protected:
/**
* @brief Internal method for reading the field from a @a SymbolString.
* Internal method for reading the field from a @a SymbolString.
* @param input the unescaped @a SymbolString to read the binary value from.
* @param offset the offset in the @a SymbolString.
* @param output the ostringstream to append the formatted value to.
@@ -319,7 +319,7 @@ protected:
virtual result_t readSymbols(SymbolString& input, const unsigned char offset, ostringstream& output) = 0;
/**
* @brief Internal method for writing the field to a @a SymbolString.
* Internal method for writing the field to a @a SymbolString.
* @param input the @a istringstream to parse the formatted value from.
* @param offset the offset in the @a SymbolString.
* @param output the unescaped @a SymbolString to write the binary value to.
@@ -345,14 +345,14 @@ protected:
/**
* @brief Base class for all string based data fields.
* Base class for all string based data fields.
*/
class StringDataField : public SingleDataField
{
public:
/**
* @brief Constructs a new instance.
* Constructs a new instance.
* @param name the field name.
* @param comment the field comment.
* @param unit the value unit.
@@ -366,7 +366,7 @@ public:
: SingleDataField(name, comment, unit, dataType, partType, length) {}
/**
* @brief Destructor.
* Destructor.
*/
virtual ~StringDataField() {}
@@ -391,14 +391,14 @@ protected:
/**
* @brief Base class for all numeric data fields.
* Base class for all numeric data fields.
*/
class NumericDataField : public SingleDataField
{
public:
/**
* @brief Constructs a new instance.
* Constructs a new instance.
* @param name the field name.
* @param comment the field comment.
* @param unit the value unit.
@@ -415,7 +415,7 @@ public:
m_bitCount(bitCount), m_bitOffset(bitOffset) {}
/**
* @brief Destructor.
* Destructor.
*/
virtual ~NumericDataField() {}
@@ -428,7 +428,7 @@ public:
protected:
/**
* @brief Internal method for reading the raw value from a @a SymbolString.
* Internal method for reading the raw value from a @a SymbolString.
* @param input the unescaped @a SymbolString to read the binary value from.
* @param offset the offset in the @a SymbolString.
* @param value the variable in which to store the raw value.
@@ -437,7 +437,7 @@ protected:
result_t readRawValue(SymbolString& input, const unsigned char offset, unsigned int& value);
/**
* @brief Internal method for writing the raw value to a @a SymbolString.
* Internal method for writing the raw value to a @a SymbolString.
* @param value the raw value to write.
* @param offset the offset in the @a SymbolString.
* @param output the unescaped @a SymbolString to write the binary value to.
@@ -455,14 +455,14 @@ protected:
/**
* @brief Base class for all numeric data fields with a number representation.
* Base class for all numeric data fields with a number representation.
*/
class NumberDataField : public NumericDataField
{
public:
/**
* @brief Constructs a new instance.
* Constructs a new instance.
* @param name the field name.
* @param comment the field comment.
* @param unit the value unit.
@@ -478,7 +478,7 @@ public:
const unsigned int divisor);
/**
* @brief Destructor.
* Destructor.
*/
virtual ~NumberDataField() {}
@@ -511,14 +511,14 @@ private:
/**
* @brief A numeric data field with a list of value=text assignments and a string representation.
* A numeric data field with a list of value=text assignments and a string representation.
*/
class ValueListDataField : public NumericDataField
{
public:
/**
* @brief Constructs a new instance.
* Constructs a new instance.
* @param name the field name.
* @param comment the field comment.
* @param unit the value unit.
@@ -537,7 +537,7 @@ public:
m_values(values) {}
/**
* @brief Destructor.
* Destructor.
*/
virtual ~ValueListDataField() {}
@@ -567,20 +567,20 @@ private:
/**
* @brief A set of @a DataField instances.
* A set of @a DataField instances.
*/
class DataFieldSet : public DataField
{
public:
/**
* @brief Create the @a DataFieldSet for parsing the identification message (service 0x07 0x04).
* Create the @a DataFieldSet for parsing the identification message (service 0x07 0x04).
* @return the @a DataFieldSet for parsing the identification message.
*/
static DataFieldSet* createIdentFields();
/**
* @brief Constructs a new instance.
* Constructs a new instance.
* @param name the field name.
* @param comment the field comment.
* @param fields the @a vector of @a SingleDataField instances part of this set.
@@ -591,7 +591,7 @@ public:
m_fields(fields) {}
/**
* @brief Destructor.
* Destructor.
*/
virtual ~DataFieldSet();
@@ -605,21 +605,21 @@ public:
vector<SingleDataField*>& fields);
/**
* @brief Returns the @a SingleDataField at the specified index.
* Returns the @a SingleDataField at the specified index.
* @param index the index of the @a SingleDataField to return.
* @return the @a SingleDataField at the specified index, or NULL.
*/
SingleDataField* operator[](const size_t index) { if (index >= m_fields.size()) return NULL; return m_fields[index]; }
/**
* @brief Returns the @a SingleDataField at the specified index.
* Returns the @a SingleDataField at the specified index.
* @param index the index of the @a SingleDataField to return.
* @return the @a SingleDataField at the specified index, or NULL.
*/
const SingleDataField* operator[](const size_t index) const { if (index >= m_fields.size()) return NULL; return m_fields[index]; }
/**
* @brief Returns the number of @a SingleDataFields instances in this set.
* Returns the number of @a SingleDataFields instances in this set.
* @return the number of available @a SingleDataField instances.
*/
size_t size() const { return m_fields.size(); }
@@ -648,29 +648,29 @@ private:
/**
* @brief A map of template @a DataField instances.
* A map of template @a DataField instances.
*/
class DataFieldTemplates : public FileReader<void*>
{
public:
/**
* @brief Constructs a new instance.
* Constructs a new instance.
*/
DataFieldTemplates() : FileReader<void*>::FileReader(false) {}
/**
* @brief Destructor.
* Destructor.
*/
virtual ~DataFieldTemplates() { clear(); }
/**
* @brief Removes all @a DataField instances.
* Removes all @a DataField instances.
*/
void clear();
/**
* @brief Adds a template @a DataField instance to this map.
* Adds a template @a DataField instance to this map.
* @param field the @a DataField instance to add.
* @param replace whether replacing an already stored instance is allowed.
* @return @a RESULT_OK on success, or an error code.
@@ -682,7 +682,7 @@ public:
virtual result_t addFromFile(vector<string>::iterator& begin, const vector<string>::iterator end, void* arg, vector< vector<string> >* defaults, const string& filename, unsigned int lineNo);
/**
* @brief Gets the template @a DataField instance with the specified name.
* Gets the template @a DataField instance with the specified name.
* @param name the name of the template to get.
* @return the template @a DataField instance, or NULL.
* Note: the caller may not free the returned instance.
+7 -7
View File
@@ -33,17 +33,17 @@
using namespace std;
/** @brief the separator character used between fields. */
/** the separator character used between fields. */
#define FIELD_SEPARATOR ','
/** @brief the separator character used to quote text having the @a FIELD_SEPARATOR in it. */
/** the separator character used to quote text having the @a FIELD_SEPARATOR in it. */
#define TEXT_SEPARATOR '"'
extern void printErrorPos(vector<string>::iterator begin, const vector<string>::iterator end, vector<string>::iterator pos, string filename, size_t lineNo, result_t result);
/**
* @brief An abstract class that support reading definitions from a file.
* An abstract class that support reading definitions from a file.
*/
template<typename T>
class FileReader
@@ -51,18 +51,18 @@ class FileReader
public:
/**
* @brief Construct a new instance.
* Construct a new instance.
*/
FileReader(bool supportsDefaults)
: m_supportsDefaults(supportsDefaults) {}
/**
* @brief Destructor.
* Destructor.
*/
virtual ~FileReader() {}
/**
* @brief Read the definitions from a file.
* Read the definitions from a file.
* @param filename the name of the file being read.
* @param arg an argument to pass to @a addFromFile().
* @param verbose whether to verbosely log problems.
@@ -155,7 +155,7 @@ public:
}
/**
* @brief Add a definition that was read from a file.
* Add a definition that was read from a file.
* @param begin an iterator to the first column of the definition row to read.
* @param end the end iterator of the definition row to read.
* @param arg the argument passed to @a readFromFile().
+1 -1
View File
@@ -70,7 +70,7 @@ Message::Message(const bool isWrite, const bool isPassive,
}
/**
* @brief Helper method for getting a default if the value is empty.
* Helper method for getting a default if the value is empty.
* @param value the value to check.
* @param defaults a @a vector of defaults, or NULL.
* @param pos the position in defaults.
+37 -37
View File
@@ -35,7 +35,7 @@ using namespace std;
class MessageMap;
/**
* @brief Defines parameters of a message sent or received on the bus.
* Defines parameters of a message sent or received on the bus.
*/
class Message
{
@@ -43,7 +43,7 @@ class Message
public:
/**
* @brief Construct a new instance.
* Construct a new instance.
* @param clazz the optional device class.
* @param name the message name (unique within the same class and type).
* @param isWrite whether this is a write message.
@@ -63,7 +63,7 @@ public:
const unsigned int pollPriority);
/**
* @brief Construct a new temporary instance.
* Construct a new temporary instance.
* @param isWrite whether this is a write message.
* @param isPassive true if message can only be initiated by a participant other than us,
* false if message can be initiated by any participant.
@@ -76,12 +76,12 @@ public:
DataField* data);
/**
* @brief Destructor.
* Destructor.
*/
virtual ~Message() { delete m_data; }
/**
* @brief Factory method for creating a new instance.
* Factory method for creating a new instance.
* @param it the iterator to traverse for the definition parts.
* @param end the iterator pointing to the end of the definition parts.
* @param defaultsRows a @a vector with rows containing defaults, or NULL.
@@ -95,68 +95,68 @@ public:
DataFieldTemplates* templates, Message*& returnValue);
/**
* @brief Get the optional device class.
* Get the optional device class.
* @return the optional device class.
*/
string getClass() const { return m_class; }
/**
* @brief Get the message name (unique within the same class and type).
* Get the message name (unique within the same class and type).
* @return the message name (unique within the same class and type).
*/
string getName() const { return m_name; }
/**
* @brief Get whether this is a write message.
* Get whether this is a write message.
* @return whether this is a write message.
*/
bool isWrite() const { return m_isWrite; }
/**
* @brief Get whether message can be initiated only by a participant other than us.
* Get whether message can be initiated only by a participant other than us.
* @return true if message can only be initiated by a participant other than us,
* false if message can be initiated by any participant.
*/
bool isPassive() const { return m_isPassive; }
/**
* @brief Get the comment.
* Get the comment.
* @return the comment.
*/
string getComment() const { return m_comment; }
/**
* @brief Get the source address.
* Get the source address.
* @return the source address, or @a SYN for any.
*/
unsigned char getSrcAddress() const { return m_srcAddress; }
/**
* @brief Get the destination address.
* Get the destination address.
* @return the destination address, or @a SYN for any.
*/
unsigned char getDstAddress() const { return m_dstAddress; }
/**
* @brief Get the command ID bytes.
* Get the command ID bytes.
* @return the primary, secondary, and optionally further command ID bytes.
*/
vector<unsigned char> getId() const { return m_id; }
/**
* @brief Return the key for storing in @a MessageMap.
* Return the key for storing in @a MessageMap.
* @return the key for storing in @a MessageMap.
*/
unsigned long long getKey() { return m_key; }
/**
* @brief Get the polling priority, or 0 for no polling at all.
* Get the polling priority, or 0 for no polling at all.
* @return the polling priority, or 0 for no polling at all.
*/
unsigned char getPollPriority() const { return m_pollPriority; }
/**
* @brief Prepare the master @a SymbolString for sending a query or command to the bus.
* Prepare the master @a SymbolString for sending a query or command to the bus.
* @param srcAddress the source address to set.
* @param masterData the master data @a SymbolString for writing symbols to.
* @param input the @a istringstream to parse the formatted value(s) from.
@@ -169,14 +169,14 @@ public:
const unsigned char dstAddress=SYN);
/**
* @brief Prepare the slave @a SymbolString for sending an answer to the bus.
* Prepare the slave @a SymbolString for sending an answer to the bus.
* @param slaveData the slave data @a SymbolString for writing symbols to.
* @return @a RESULT_OK on success, or an error code.
*/
result_t prepareSlave(SymbolString& slaveData);
/**
* @brief Decode a singular part of a received message.
* Decode a singular part of a received message.
* @param partType the @a PartType of the data.
* @param data the unescaped data @a SymbolString for reading binary data.
* @param output the @a ostringstream to append the formatted value to.
@@ -193,7 +193,7 @@ public:
char separator=UI_FIELD_SEPARATOR);
/**
* @brief Decode all parts of a received message.
* Decode all parts of a received message.
* @param masterData the unescaped master data @a SymbolString to decode.
* @param slaveData the unescaped slave data @a SymbolString to decode.
* @param output the @a ostringstream to append the formatted value to.
@@ -210,31 +210,31 @@ public:
char separator=UI_FIELD_SEPARATOR);
/**
* @brief Get the last decoded value.
* Get the last decoded value.
* @return the last decoded value, or the empty string if it was not successful.
*/
string getLastValue() { return m_lastValue; }
/**
* @brief Get the time when @a m_lastValue was last stored.
* Get the time when @a m_lastValue was last stored.
* @return the time when @a m_lastValue was last stored, or 0 if this message was not decoded yet.
*/
time_t getLastUpdateTime() { return m_lastUpdateTime; }
/**
* @brief Get the time when @a m_lastValue was last changed.
* Get the time when @a m_lastValue was last changed.
* @return the time when @a m_lastValue was last changed, or 0 if this message was not decoded yet.
*/
time_t getLastChangeTime() { return m_lastChangeTime; }
/**
* @brief Get the time when this message was last polled for.
* Get the time when this message was last polled for.
* @return the time when this message was last polled for, or 0 for never.
*/
time_t getLastPollTime() { return m_lastPollTime; }
/**
* @brief Return whether this @a Message needs to be polled after the other one.
* Return whether this @a Message needs to be polled after the other one.
* @param other the other @a Message to compare with.
* @return true if this @a Message needs to be polled after the other one.
*/
@@ -295,11 +295,11 @@ private:
/**
* @brief A function that compares the weighted poll priority of two @a Message instances.
* A function that compares the weighted poll priority of two @a Message instances.
*/
struct compareMessagePriority : binary_function <Message*,Message*,bool> {
/**
* @brief Compare the weighted poll priority of the two @a Message instances.
* Compare the weighted poll priority of the two @a Message instances.
* @param x the first @a Message.
* @param y the second @a Message.
* @return whether @a x is smaller than @a y with regard to their weighted poll priority.
@@ -309,25 +309,25 @@ struct compareMessagePriority : binary_function <Message*,Message*,bool> {
/**
* @brief Holds a map of all known @a Message instances.
* Holds a map of all known @a Message instances.
*/
class MessageMap : public FileReader<DataFieldTemplates*>
{
public:
/**
* @brief Construct a new instance.
* Construct a new instance.
*/
MessageMap() : FileReader<DataFieldTemplates*>::FileReader(true),
m_minIdLength(4), m_maxIdLength(0), m_messageCount(0), m_passiveMessageCount(0) {}
/**
* @brief Destructor.
* Destructor.
*/
virtual ~MessageMap() { clear(); }
/**
* @brief Add a @a Message instance to this set.
* Add a @a Message instance to this set.
* @param message the @a Message instance to add.
* @return @a RESULT_OK on success, or an error code.
* Note: the caller may not free the added instance on success.
@@ -338,7 +338,7 @@ public:
virtual result_t addFromFile(vector<string>::iterator& begin, const vector<string>::iterator end, DataFieldTemplates* arg, vector< vector<string> >* defaults, const string& filename, unsigned int lineNo);
/**
* @brief Find the @a Message instance for the specified class and name.
* Find the @a Message instance for the specified class and name.
* @param clazz the optional device class.
* @param name the message name.
* @param isWrite whether this is a write message.
@@ -349,7 +349,7 @@ public:
Message* find(const string& clazz, const string& name, const bool isWrite, const bool isPassive=false);
/**
* @brief Find all active get @a Message instances for the specified class and name.
* Find all active get @a Message instances for the specified class and name.
* @param clazz the device class, or empty for any.
* @param name the message name, or empty for any.
* @param pb the primary ID byte, or -1 for any (default any).
@@ -364,7 +364,7 @@ public:
const bool withRead=true, const bool withWrite=false, const bool withPassive=false);
/**
* @brief Find the @a Message instance for the specified master data.
* Find the @a Message instance for the specified master data.
* @param master the master @a SymbolString for identifying the @a Message.
* @return the @a Message instance, or NULL.
* Note: the caller may not free the returned instance.
@@ -372,25 +372,25 @@ public:
Message* find(SymbolString& master);
/**
* @brief Removes all @a Message instances.
* Removes all @a Message instances.
*/
void clear();
/**
* @brief Get the number of stored @a Message instances.
* Get the number of stored @a Message instances.
* @param passiveOnly true to count only passive messages, false to count all messages.
* @return the the number of stored @a Message instances.
*/
size_t size(const bool passiveOnly=false) { return passiveOnly ? m_passiveMessageCount : m_messageCount; }
/**
* @brief Get the number of stored @a Message instances with a poll priority.
* Get the number of stored @a Message instances with a poll priority.
* @return the the number of stored @a Message instances with a poll priority.
*/
size_t sizePoll() { return m_pollMessages.size(); }
/**
* @brief Get the next @a Message to poll.
* Get the next @a Message to poll.
* @return the next @a Message to poll, or NULL.
* Note: the caller may not free the returned instance.
*/
+30 -30
View File
@@ -32,7 +32,7 @@
using namespace std;
/** @brief available device types. */
/** available device types. */
enum DeviceType {
dt_serial, /*!< serial device */
dt_network /*!< network device */
@@ -40,24 +40,24 @@ enum DeviceType {
/**
* @brief base class for input devices.
* base class for input devices.
*/
class Device
{
public:
/**
* @brief constructs a new instance.
* constructs a new instance.
*/
Device() : m_fd(-1), m_open(false), m_noDeviceCheck(false) {}
/**
* @brief destructor.
* destructor.
*/
virtual ~Device() {}
/**
* @brief virtual open function for opening file descriptor
* virtual open function for opening file descriptor
* @param deviceName to determine device type.
* @param noDeviceCheck en-/disable device check.
* @return the @a result_t code.
@@ -65,25 +65,25 @@ public:
virtual result_t openDevice(const string deviceName, const bool noDeviceCheck) = 0;
/**
* @brief virtual close function for closing opened file descriptor
* virtual close function for closing opened file descriptor
*/
virtual void closeDevice() = 0;
/**
* @brief connection state of device.
* connection state of device.
* @return true if device is open
*/
bool isOpen();
/**
* @brief Write a single byte to opened file descriptor.
* Write a single byte to opened file descriptor.
* @param value the value to send.
* @return the result_t code.
*/
result_t send(const unsigned char value);
/**
* @brief Read a single byte from opened file descriptor.
* Read a single byte from opened file descriptor.
* @param timeout max time out for new input data [usec], or 0 for infinite.
* @param value the reference in which the value is stored.
* @return the result_t code.
@@ -102,7 +102,7 @@ protected:
private:
/**
* @brief system check if opened file descriptor is valid
* system check if opened file descriptor is valid
* @return true if file descriptor is valid
*/
bool isValid();
@@ -110,14 +110,14 @@ private:
};
/**
* @brief class for serial input device.
* class for serial input device.
*/
class DeviceSerial : public Device
{
public:
/**
* @brief destructor.
* destructor.
*/
~DeviceSerial() { closeDevice(); }
@@ -134,14 +134,14 @@ private:
};
/**
* @brief class for network input device.
* class for network input device.
*/
class DeviceNetwork : public Device
{
public:
/**
* @brief destructor.
* destructor.
*/
~DeviceNetwork() { closeDevice(); }
@@ -156,14 +156,14 @@ private:
};
/**
* @brief wrapper class for class device.
* wrapper class for class device.
*/
class Port
{
public:
/**
* @brief constructs a new instance and determine device type.
* constructs a new instance and determine device type.
* @param deviceName to determine device type.
* @param noDeviceCheck en-/disable device check.
* @param logRaw whether logging of raw data is enabled.
@@ -177,35 +177,35 @@ public:
const bool dumpRaw, const char* dumpRawFile, const long dumpRawMaxSize);
/**
* @brief destructor.
* destructor.
*/
~Port() { delete m_device; m_dumpRawStream.close(); }
/**
* @brief open device
* open device
*/
result_t open() { return m_device->openDevice(m_deviceName, m_noDeviceCheck); }
/**
* @brief close device
* close device
*/
void close() { m_device->closeDevice(); }
/**
* @brief connection state of device.
* connection state of device.
* @return true if device is open
*/
bool isOpen() { return m_device->isOpen(); }
/**
* @brief Write a single byte to opened file descriptor.
* Write a single byte to opened file descriptor.
* @param value the value to send.
* @return the result_t code.
*/
result_t send(const unsigned char value);
/**
* @brief Read a single byte from opened file descriptor.
* Read a single byte from opened file descriptor.
* @param timeout max time out for new input data [usec], or 0 for infinite.
* @param value the reference in which the value is stored.
* @return the result_t code.
@@ -213,43 +213,43 @@ public:
result_t recv(const long timeout, unsigned char& value);
/**
* @brief Get whether logging of raw data is enabled.
* Get whether logging of raw data is enabled.
* @return whether logging of raw data is enabled.
*/
bool getLogRaw() { return m_logRaw; }
/**
* @brief Enable or disable logging of raw data.
* Enable or disable logging of raw data.
* @param logRaw true to enable logging of raw data, false to disable it.
*/
void setLogRaw(bool logRaw=true) { m_logRaw = logRaw; }
/**
* @brief Get whether dumping of raw data to a file is enabled.
* Get whether dumping of raw data to a file is enabled.
* @return whether dumping of raw data to a file is enabled.
*/
bool getDumpRaw() { return m_dumpRaw; }
/**
* @brief Enable or disable dumping of raw data to a file.
* Enable or disable dumping of raw data to a file.
* @param dumpRaw true to enable dumping of raw data to a file, false to disable it.
*/
void setDumpRaw(bool dumpRaw=true);
/**
* @brief Set the name of the file to dump raw data to.
* Set the name of the file to dump raw data to.
* @param dumpFile the name of the file to dump raw data to.
*/
void setDumpRawFile(const string& dumpFile);
/**
* @brief Set the maximum size of a file to dump raw data to.
* Set the maximum size of a file to dump raw data to.
* @param maxSize the maximum size of a file to dump raw data to.
*/
void setDumpRawMaxSize(const long maxSize) { m_dumpRawMaxSize = maxSize; }
/**
* @brief Return the device name.
* Return the device name.
* @return the device name.
*/
const char* getDeviceName() { return m_deviceName.c_str(); }
@@ -286,7 +286,7 @@ private:
long m_dumpRawFileSize;
/**
* @brief internal setter for device type.
* internal setter for device type.
* @param type of device
*/
void setType(const DeviceType type);
+1 -1
View File
@@ -57,7 +57,7 @@ static const int RESULT_ERR_NO_SIGNAL = -21; //!< no signal found on the bus
typedef int result_t;
/**
* @brief Return the string corresponding to the result code.
* Return the string corresponding to the result code.
* @param resultCode the result code (see RESULT_ constants).
* @return the string corresponding to the result code.
*/
+1 -1
View File
@@ -25,7 +25,7 @@
using namespace std;
/**
* @brief CRC8 lookup table for the polynom 0x9b = x^8 + x^7 + x^4 + x^3 + x^1 + 1.
* CRC8 lookup table for the polynom 0x9b = x^8 + x^7 + x^4 + x^3 + x^1 + 1.
*/
static const unsigned char CRC_LOOKUP_TABLE[] =
{
+21 -21
View File
@@ -38,25 +38,25 @@ static const unsigned char BROADCAST = 0xFE; //!< the broadcast destination addr
/**
* @brief A string of escaped or unescaped bus symbols.
* A string of escaped or unescaped bus symbols.
*/
class SymbolString
{
public:
/**
* @brief Creates a new unescaped empty instance.
* Creates a new unescaped empty instance.
*/
SymbolString() : m_unescapeState(1), m_crc(0) {}
/**
* @brief Creates a new escaped instance from an unescaped hex string and adds the calculated CRC.
* Creates a new escaped instance from an unescaped hex string and adds the calculated CRC.
* @param str the unescaped hex string.
*/
SymbolString(const string& str);
/**
* @brief Creates a new escaped or unescaped instance from another @a SymbolString and adds the calculated CRC.
* Creates a new escaped or unescaped instance from another @a SymbolString and adds the calculated CRC.
* @param str the @a SymbolString top copy from.
* @param escape true for an escaped instance, false for an unescaped instance.
* @param addCrc whether to add the calculated CRC as last symbol.
@@ -64,35 +64,35 @@ public:
SymbolString(const SymbolString& str, const bool escape, const bool addCrc=true);
/**
* @brief Creates a new unescaped instance from a hex string.
* Creates a new unescaped instance from a hex string.
* @param isEscaped whether the hex string is escaped and shall be unescaped.
* @param str the hex string.
*/
SymbolString(const string& str, const bool isEscaped);
/**
* @brief Returns the symbols as hex string.
* Returns the symbols as hex string.
* @param unescape whether to unescape an escaped instance.
* @return the symbols as hex string.
*/
const string getDataStr(const bool unescape=true);
/**
* @brief Returns a reference to the symbol at the specified index.
* Returns a reference to the symbol at the specified index.
* @param index the index of the symbol to return.
* @return the reference to the symbol at the specified index.
*/
unsigned char& operator[](const size_t index) { if (index >= m_data.size()) m_data.resize(index+1, 0); return m_data[index]; }
/**
* @brief Returns the symbol at the specified index.
* Returns the symbol at the specified index.
* @param index the index of the symbol to return.
* @return the symbol at the specified index.
*/
const unsigned char& operator[](const size_t index) const { return m_data[index]; }
/**
* @brief Returns whether this instance is equal to the other instance.
* Returns whether this instance is equal to the other instance.
* @param other the other instance.
* @return true if this instance is equal to the other instance (i.e. both escaped or both unescaped and same symbols).
*/
@@ -112,7 +112,7 @@ public:
}
/**
* @brief Appends a the symbol to the end of the symbol string and escapes/unescapes it if necessary.
* Appends a the symbol to the end of the symbol string and escapes/unescapes it if necessary.
* @param value the symbol to append.
* @param isEscaped whether the symbol is escaped.
* @param updateCRC whether to update the calculated CRC in @a m_crc.
@@ -123,72 +123,72 @@ public:
result_t push_back(const unsigned char value, const bool isEscaped=true, const bool updateCRC=true);
/**
* @brief Returns the number of symbols in this symbol string.
* Returns the number of symbols in this symbol string.
* @return the number of available symbols.
*/
unsigned char size() const { return (unsigned char)m_data.size(); }
/**
* @brief Returns the calculated CRC.
* Returns the calculated CRC.
* @return the calculated CRC.
*/
unsigned char getCRC() const { return m_crc; }
/**
* @brief Clears the symbols.
* Clears the symbols.
*/
void clear() { m_data.clear(); m_unescapeState = m_unescapeState==0 ? 0 : 1; m_crc = 0; }
private:
/**
* @brief Hidden copy constructor.
* Hidden copy constructor.
* @param str the @a SymbolString to copy from.
*/
SymbolString(const SymbolString& str)
: m_data(str.m_data), m_unescapeState(str.m_unescapeState), m_crc(str.m_crc) {}
/**
* @brief Updates the calculated CRC in @a m_crc by adding a value.
* Updates the calculated CRC in @a m_crc by adding a value.
* @param value the (escaped) value to add to the calculated CRC in @a m_crc.
*/
void addCRC(const unsigned char value);
/**
* @brief the string of bus symbols.
* the string of bus symbols.
*/
vector<unsigned char> m_data;
/**
* @brief 0 if the symbols in @a m_data are escaped,
* 0 if the symbols in @a m_data are escaped,
* 1 if the symbols in @a m_data are unescaped and the last symbol passed to @a push_back was a normal symbol,
* 2 if the symbols in @a m_data are unescaped and the last symbol passed to @a push_back was the escape symbol.
*/
int m_unescapeState;
/**
* @brief the calculated CRC.
* the calculated CRC.
*/
unsigned char m_crc;
};
/**
* @brief Returns whether the address is one of the 25 master addresses.
* Returns whether the address is one of the 25 master addresses.
* @param addr the address to check.
* @return <code>true</code> if the specified address is a master address.
*/
bool isMaster(unsigned char addr);
/**
* @brief Returns the number of the master if the address is a valid bus address.
* Returns the number of the master if the address is a valid bus address.
* @param addr the bus address.
* @return the number of the master if the address is a valid bus address (1 to 25), or 0.
*/
unsigned char getMasterNumber(unsigned char addr);
/**
* @brief Returns whether the address is a valid bus address.
* Returns whether the address is a valid bus address.
* @param addr the address to check.
* @param allowBroadcast whether to also allow @a addr to be the broadcast address (default true).
* @return <code>true</code> if the specified address is a valid bus address.
+30 -30
View File
@@ -29,7 +29,7 @@
using namespace std;
/** @brief the available data types. */
/** the available data types. */
enum DataType {
dt_none, //!< default for __text_only__
dt_bool, //!< boolean
@@ -40,14 +40,14 @@ enum DataType {
dt_string //!< string
};
/** @brief option types. */
/** option types. */
enum OptionType {
ot_none, //!< no option type is needed
ot_optional, //!< a value is optional
ot_mandatory //!< a value is mandatory
};
/** @brief structure for defining application options */
/** structure for defining application options */
typedef struct {
const char* name; //!< long option name
const char* shortname; //!< short option name
@@ -57,7 +57,7 @@ typedef struct {
} opt_t;
/**
* @brief union for option values
* union for option values
*/
union OptVal {
/** boolean */
@@ -76,36 +76,36 @@ union OptVal {
const char* c;
/**
* @brief clear memory
* clear memory
*/
OptVal() { memset(this, 0, sizeof(OptVal)); }
/**
* @brief create boolean type
* create boolean type
* @param _b the boolean
*/
OptVal(bool _b) : b(_b) {}
/**
* @brief create integer type
* create integer type
* @param _i the integer
*/
OptVal(int _i) : i(_i) {}
/**
* @brief create long type
* create long type
* @param _l the long
*/
OptVal(long _l) : l(_l) {}
/**
* @brief create float type
* create float type
* @param _f the float
*/
OptVal(float _f) : f(_f) {}
/**
* @brief create string type
* create string type
* @param _c the string
*/
OptVal(const char* _c) : c(_c) {}
@@ -113,14 +113,14 @@ union OptVal {
/**
* @brief class for all kinds of application parameters.
* class for all kinds of application parameters.
*/
class Appl
{
public:
/**
* @brief create an instance and return the reference.
* create an instance and return the reference.
* @param command string for help page.
* @param argument string for help page.
* @return the reference to instance.
@@ -128,24 +128,24 @@ public:
static Appl& Instance(const char* command="", const char* argument="");
/**
* @brief destructor.
* destructor.
*/
~Appl();
/**
* @brief save application version string.
* save application version string.
* @param version string.
*/
void setVersion(const char* version) { m_version = version; }
/**
* @brief create new entry of application option only for help page.
* create new entry of application option only for help page.
* @param text string to print.
*/
void addText(const char* text);
/**
* @brief create new entry of application option.
* create new entry of application option.
* @param name the long name.
* @param shortname optional short name.
* @param optval value of option.
@@ -157,7 +157,7 @@ public:
DataType datatype, OptionType optiontype, const char* description);
/**
* @brief returns the value of the interested option.
* returns the value of the interested option.
* @param name the interested option.
* @return casted value.
*/
@@ -169,7 +169,7 @@ public:
}
/**
* @brief parse application arguments.
* parse application arguments.
* @param argc the number of options.
* @param argv the given options.
* @return false if the arguments are invalid or a help/error message was printed and the process should exit.
@@ -177,32 +177,32 @@ public:
bool parseArgs(int argc, char* argv[]);
/**
* @brief returns the number of saved commands and arguments.
* returns the number of saved commands and arguments.
* @return number of commands and arguments.
*/
int numArgs() const { return m_arguments.size(); }
/**
* @brief returns the string of an interested argument.
* returns the string of an interested argument.
* @param num number of interested argument.
* @return the argument string.
*/
string getArg(const int num) const { return m_arguments[num]; }
/**
* @brief returns the string of given command.
* returns the string of given command.
* @return the command string.
*/
string getCommand() const { return m_command; }
/**
* @brief Get whether a command string is missing.
* Get whether a command string is missing.
* @return true if a command string is missing.
*/
bool missingCommand() const { return (m_command.size() == 0 ? true : false); }
private:
/**
* @brief private construtor.
* private construtor.
* @param command string for help page.
* @param argument string for help page.
*/
@@ -210,13 +210,13 @@ private:
: m_version(NULL), m_withCommand(command), m_withArgument(argument) {}
/**
* @brief private copy construtor.
* private copy construtor.
* @param reference to an instance.
*/
Appl(const Appl&);
/**
* @brief private = operator.
* private = operator.
* @param reference to an instance.
* @return reference to instance.
*/
@@ -253,7 +253,7 @@ private:
vector<string> m_arguments;
/**
* @brief checks the passed parameter if this is a valid option.
* checks the passed parameter if this is a valid option.
* @param option to check.
* @param value to save.
* @return true if parameter is a valid option.
@@ -261,7 +261,7 @@ private:
bool checkOption(const string& option, const string& value);
/**
* @brief save the passed value to option.
* save the passed value to option.
* @param option name.
* @param value to save.
* @param datatype of given option.
@@ -269,19 +269,19 @@ private:
void setOptVal(const char* option, const string value, DataType datatype);
/**
* @brief print application version.
* print application version.
* @return false.
*/
bool printVersion();
/**
* @brief print help page.
* print help page.
* @return false.
*/
bool printHelp();
/**
* @brief print used option settings.
* print used option settings.
* @return false.
*/
bool printSettings();
+10 -10
View File
@@ -25,49 +25,49 @@
/** \file daemon.h */
/**
* @brief class to daemonize a process.
* class to daemonize a process.
*/
class Daemon
{
public:
/**
* @brief create an instance and return the reference.
* create an instance and return the reference.
* @return the reference to instance.
*/
static Daemon& Instance();
/**
* @brief daemonize act process.
* daemonize act process.
* @param pidfile the name of the pid file.
*/
void run(const char* pidfile);
/**
* @brief stop daemon and delete the pid file.
* stop daemon and delete the pid file.
*/
void stop() { if (m_pidfile != NULL) pidfile_close(); }
/**
* @brief show actual status if daemonize.
* show actual status if daemonize.
* @return true if process is a daemon.
*/
bool status() { return m_status; }
private:
/**
* @brief private construtor.
* private construtor.
*/
Daemon() : m_status(false), m_pidfile(NULL), m_pidfd(0) {}
/**
* @brief private copy construtor.
* private copy construtor.
* @param reference to an instance.
*/
Daemon(const Daemon&);
/**
* @brief private = operator.
* private = operator.
* @param reference to an instance.
* @return reference to instance.
*/
@@ -83,13 +83,13 @@ private:
int m_pidfd;
/**
* @brief creates a pid file for process.
* creates a pid file for process.
* @return true if success.
*/
bool pidfile_open();
/**
* @brief close and delete the pid file.
* close and delete the pid file.
* @return true if success.
*/
bool pidfile_close();
+41 -41
View File
@@ -32,7 +32,7 @@
using namespace std;
/** @brief available types for all subsystems */
/** available types for all subsystems */
enum AreasType {
bas=0, /*!< basis */
net, /*!< network */
@@ -41,7 +41,7 @@ enum AreasType {
Size_of_Areas=4 /*!< number of possible areas */
};
/** @brief available logging levels */
/** available logging levels */
enum LevelType {
error=0, /*!< silent run, only errors will be printed */
event, /*!< only interesting message for normal use */
@@ -51,28 +51,28 @@ enum LevelType {
};
/**
* @brief Calculate the mask of logging areas from string.
* Calculate the mask of logging areas from string.
* @param areas the string to parse the areas from.
* @return the bit combination of @a AreasType.
*/
int calcAreaMask(const string areas);
/**
* @brief Calculate the log level from string.
* Calculate the log level from string.
* @param level the level as string.
* @return @a the LevelType.
*/
LevelType calcLevel(const string level);
/**
* @brief class which describes a logging message itself.
* class which describes a logging message itself.
*/
class LogMessage
{
public:
/**
* @brief creates a new logging message.
* creates a new logging message.
* @param area the logging area of the message.
* @param level the logging level of the message.
* @param text the logging message.
@@ -80,25 +80,25 @@ public:
LogMessage(const int area, const int level, const string text);
/**
* @brief get the logging area.
* get the logging area.
* @return the logging area.
*/
int getArea() const { return m_area; }
/**
* @brief get the logging level.
* get the logging level.
* @return the logging level.
*/
int getLevel() const { return m_level; }
/**
* @brief get the logging text.
* get the logging text.
* @return the logging text.
*/
string getText() const { return m_text.c_str(); }
/**
* @brief get the logging timestamp.
* get the logging timestamp.
* @return the logging timestamp.
*/
string getTime() const { return m_time.c_str(); }
@@ -119,55 +119,55 @@ private:
};
/**
* @brief base class for all type of logging sinks.
* base class for all type of logging sinks.
*/
class LogSink : public Thread
{
public:
/**
* @brief creates a virtual logging sink.
* creates a virtual logging sink.
* @param areaMask the logging area mask.
* @param level the logging level.
*/
LogSink(const int areaMask, const int level) : m_areaMask(areaMask), m_level(level) {}
/**
* @brief destructor.
* destructor.
*/
virtual ~LogSink();
/**
* @brief adds the logging message to internal message queue.
* adds the logging message to internal message queue.
* @param message a reference to logging message.
*/
void addMessage(const LogMessage& message);
/**
* @brief endless loop for logging sink instance.
* endless loop for logging sink instance.
*/
void run();
/**
* @brief get the logging area mask.
* get the logging area mask.
* @return the logging area mask.
*/
int getAreaMask() const { return m_areaMask; }
/**
* @brief set the logging area mask.
* set the logging area mask.
* @param areaMask the logging area mask.
*/
void setAreaMask(const int& areaMask) { m_areaMask = areaMask; }
/**
* @brief get the logging level.
* get the logging level.
* @return the logging level.
*/
int getLevel() const { return (m_level); }
/**
* @brief set the logging level.
* set the logging level.
* @param level the logging level.
*/
void setLevel(const int& level) { m_level = level; }
@@ -186,7 +186,7 @@ private:
protected:
/**
* @brief virtual function for writing the logging message.
* virtual function for writing the logging message.
* @param message the logging message.
*/
virtual void write(const LogMessage& message) const = 0;
@@ -194,14 +194,14 @@ protected:
};
/**
* @brief class for console logging sink type.
* class for console logging sink type.
*/
class LogConsole : public LogSink
{
public:
/**
* @brief creates a console logging sink.
* creates a console logging sink.
* @param areaMask the logging area mask.
* @param level the logging level.
* @param name the thread name for logging sink.
@@ -210,14 +210,14 @@ public:
: LogSink(areaMask, level) { this->start(name); }
/**
* @brief destructor.
* destructor.
*/
virtual ~LogConsole() {}
protected:
/**
* @brief write the logging message to stdout.
* write the logging message to stdout.
* @param message the logging message.
*/
virtual void write(const LogMessage& message) const;
@@ -225,14 +225,14 @@ protected:
};
/**
* @brief class for logfile logging sink type.
* class for logfile logging sink type.
*/
class LogFile : public LogSink
{
public:
/**
* @brief creates a log file logging sink.
* creates a log file logging sink.
* @param areaMask the logging area mask.
* @param level the logging level.
* @param name the thread name for logging sink.
@@ -242,7 +242,7 @@ public:
: LogSink(areaMask, level), m_file(file) { this->start(name); }
/**
* @brief destructor.
* destructor.
*/
virtual ~LogFile() {}
@@ -254,7 +254,7 @@ private:
protected:
/**
* @brief write the logging message to specific log file.
* write the logging message to specific log file.
* @param message the logging message.
*/
virtual void write(const LogMessage& message) const;
@@ -262,51 +262,51 @@ protected:
};
/**
* @brief logger base class which provide the logging interface.
* logger base class which provide the logging interface.
*/
class Logger : public Thread
{
public:
/**
* @brief create an instance and return the reference.
* create an instance and return the reference.
* @return the reference to instance.
*/
static Logger& Instance();
/**
* @brief destructor.
* destructor.
*/
virtual ~Logger();
/**
* @brief Add a @a LogSink.
* Add a @a LogSink.
* @param sink the used @a LogSink.
* @return the reference to this @a Logger.
*/
Logger& operator+=(LogSink* sink);
/**
* @brief Remove a @a LogSink and delete it.
* Remove a @a LogSink and delete it.
* @param sink the used @a LogSink.
* @return the reference to this @a Logger.
*/
Logger& operator-=(const LogSink* sink);
/**
* @brief Set the logging area mask on all @a LogSink instances.
* Set the logging area mask on all @a LogSink instances.
* @param areaMask the logging area mask.
*/
void setAreaMask(const int& areaMask);
/**
* @brief Set the logging level on all @a LogSink instances.
* Set the logging level on all @a LogSink instances.
* @param level the logging level.
*/
void setLevel(const int& level);
/**
* @brief Return whether a @a LogSink is available that will produce output for the specified area and level.
* Return whether a @a LogSink is available that will produce output for the specified area and level.
* @param area the logging area of the message.
* @param level the logging level of the message.
* @return whether a @a LogSink is available that will produce output for the specified area and level.
@@ -314,7 +314,7 @@ public:
bool hasSink(const int area, const int level);
/**
* @brief creates a logging message and add them to internal message queue.
* creates a logging message and add them to internal message queue.
* @param area the logging area of the message.
* @param level the logging level of the message.
* @param text the logging message.
@@ -335,25 +335,25 @@ protected:
private:
/**
* @brief private constructor.
* private constructor.
*/
Logger() : m_direct(true), m_sink(NULL) {}
/**
* @brief private copy constructor.
* private copy constructor.
* @param reference to an instance.
*/
Logger(const Logger&);
/**
* @brief private = operator.
* private = operator.
* @param reference to an instance.
* @return reference to instance.
*/
Logger& operator=(const Logger&);
/**
* @brief Distribute the @a LogMessage to all known sinks and delete it afterwards.
* Distribute the @a LogMessage to all known sinks and delete it afterwards.
* @param mesage the @a LogMessage to distribute.
*/
void handleMessage(LogMessage* message);
+5 -5
View File
@@ -26,14 +26,14 @@
/** \file notify.h */
/**
* @brief class to notify other thread per pipe.
* class to notify other thread per pipe.
*/
class Notify
{
public:
/**
* @brief constructs a new instance and do notifying.
* constructs a new instance and do notifying.
*/
Notify()
{
@@ -49,18 +49,18 @@ public:
}
/**
* @brief destructor.
* destructor.
*/
~Notify() { close(m_sendfd); close(m_recvfd); }
/**
* @brief file descriptor to watch for notify event.
* file descriptor to watch for notify event.
* @return the notification value.
*/
int notifyFD() { return m_recvfd; }
/**
* @brief write notify event to file descriptor.
* write notify event to file descriptor.
* @return result of writing notification.
*/
int notify() const { return write(m_sendfd,"1",1); }
+17 -17
View File
@@ -29,7 +29,7 @@
using namespace std;
/**
* @brief class for low level tcp socket operations. (open, close, send, receive).
* class for low level tcp socket operations. (open, close, send, receive).
*/
class TCPSocket
{
@@ -42,12 +42,12 @@ public:
friend class TCPServer;
/**
* @brief destructor.
* destructor.
*/
~TCPSocket() { close(m_sfd); }
/**
* @brief write bytes to opened file descriptor.
* write bytes to opened file descriptor.
* @param buffer data to send.
* @param len number of bytes to send.
* @return number of written bytes or -1 if an error has occured.
@@ -55,7 +55,7 @@ public:
ssize_t send(const char* buffer, size_t len) { return ::send(m_sfd, buffer, len, MSG_NOSIGNAL); }
/**
* @brief read bytes from opened file descriptor.
* read bytes from opened file descriptor.
* @param buffer for received bytes.
* @param len size of the receive buffer.
* @return number of read bytes or -1 if an error has occured.
@@ -63,25 +63,25 @@ public:
ssize_t recv(char* buffer, size_t len) { return ::recv(m_sfd, buffer, len, 0); }
/**
* @brief returns the tcp port.
* returns the tcp port.
* @return the tcp port.
*/
int getPort() const { return m_port; }
/**
* @brief returns the ip address.
* returns the ip address.
* @return the ip address.
*/
string getIP() const { return m_ip; }
/**
* @brief returns the file descriptor.
* returns the file descriptor.
* @return the file descriptor.
*/
int getFD() const { return m_sfd; }
/**
* @brief returns status of file descriptor.
* returns status of file descriptor.
* @return true if file descriptor is valid.
*/
bool isValid();
@@ -97,7 +97,7 @@ private:
string m_ip;
/**
* @brief private constructor, limited access only for friend classes.
* private constructor, limited access only for friend classes.
* @param sfd the file desctriptor of tcp socket.
* @param address struct which holds the ip address.
*/
@@ -106,14 +106,14 @@ private:
};
/**
* @brief class to initiate a tcp socket connection to a listening server.
* class to initiate a tcp socket connection to a listening server.
*/
class TCPClient
{
public:
/**
* @brief initiate a tcp socket connection to a listening server.
* initiate a tcp socket connection to a listening server.
* @param server the server name or ip address to connect.
* @param port the tcp port.
* @return pointer to an opened tcp socket.
@@ -123,14 +123,14 @@ public:
};
/**
* @brief class for a tcp based network server.
* class for a tcp based network server.
*/
class TCPServer
{
public:
/**
* @brief creates a new instance of a listening tcp server.
* creates a new instance of a listening tcp server.
* @param port the tcp port.
* @param address the ip address.
*/
@@ -138,24 +138,24 @@ public:
: m_lfd(0), m_port(port), m_address(address), m_listening(false) {}
/**
* @brief destructor.
* destructor.
*/
~TCPServer() { if (m_lfd > 0) {close(m_lfd);} }
/**
* @brief start listening of tcp socket.
* start listening of tcp socket.
* @return result of low level functions.
*/
int start();
/**
* @brief accept an incomming tcp connection and create a local tcp socket for communication.
* accept an incomming tcp connection and create a local tcp socket for communication.
* @return pointer to an opened tcp socket.
*/
TCPSocket* newSocket();
/**
* @brief returns the file descriptor.
* returns the file descriptor.
* @return the file descriptor.
*/
int getFD() const { return m_lfd; }
+12 -12
View File
@@ -25,61 +25,61 @@
/** \file thread.h */
/**
* @brief wrapper class for pthread.
* wrapper class for pthread.
*/
class Thread
{
public:
/**
* @brief constructor.
* constructor.
*/
Thread() : m_threadid(0), m_started(false), m_running(false), m_stopped(false), m_detached(false) {}
/**
* @brief virtual destructor.
* virtual destructor.
*/
virtual ~Thread();
/**
* @brief Thread entry helper for pthread_create.
* Thread entry helper for pthread_create.
* @param arg pointer to the @a Thread.
* @return NULL.
*/
static void* runThread(void* arg);
/**
* @brief Return whether this @a Thread is still running and not yet stopped.
* Return whether this @a Thread is still running and not yet stopped.
* @return true if this @a Thread is till running and not yet stopped.
*/
virtual bool isRunning() { return m_running == true && m_stopped == false; }
/**
* @brief Create the native thread and set its name.
* Create the native thread and set its name.
* @param name the thread name to show in the process list.
* @return whether the thread was started.
*/
virtual bool start(const char* name);
/**
* @brief Notify the thread that it shall stop.
* Notify the thread that it shall stop.
*/
virtual void stop() { m_stopped = true; }
/**
* @brief Join the thread.
* Join the thread.
* @return whether the thread was joined.
*/
virtual bool join();
/**
* @brief Detach the thread.
* Detach the thread.
* @return whether the thread was detached.
*/
virtual bool detach();
/**
* @brief Get the thread id.
* Get the thread id.
* @return the thread id.
*/
pthread_t self() {return m_threadid; }
@@ -87,14 +87,14 @@ public:
protected:
/**
* @brief Thread entry method to be overridden by derived class.
* Thread entry method to be overridden by derived class.
*/
virtual void run() = 0;
private:
/**
* @brief Enter the Thread loop by calling run().
* Enter the Thread loop by calling run().
*/
void enter();