|
Serial-TCP/IPbridge
1.0
|
Base class for all configuration classes. More...
#include <config.h>
Classes | |
| class | InvalidValueError |
| This exception should be thrown if some configuration value is invalid. More... | |
Public Types | |
| typedef std::map< std::string, std::string > | RawConfigValues |
| Raw configuration option -> values mapping. More... | |
| typedef size_t | BufferSize |
| Buffer size type. More... | |
| typedef unsigned | LengthField |
| Length field type. More... | |
| typedef std::tr1::uint32_t | LengthFieldMessageLength |
| Message length type when using length field. More... | |
Public Member Functions | |
| ~Config () | |
| Destructor. More... | |
| Config (const Config &other) | |
| Copy constructor. More... | |
| Config & | operator= (const Config &other) |
| Assignment operator. More... | |
| bool | operator== (const Config &other) const |
| Equality comparison. More... | |
| bool | operator!= (const Config &other) const |
| Non-equality comparison. More... | |
| void | swap (Config &other) |
| Swap the contents of this object with the other object. More... | |
| size_t | getBufferSize () const |
| Returns the buffer size (in bytes). More... | |
| LengthField | getLengthField () const |
| Returns the size of a field containing the length of a message (in bytes). More... | |
Static Public Member Functions | |
| static Config | fromRawConfigValues (RawConfigValues rawConfigValues) |
| Creates a Config object from raw configuration values. More... | |
| static LengthFieldMessageLength | binaryFieldLengthToNumber (const std::string &binaryNumber) |
| Transforms the selected binary string into a number. More... | |
| static LengthFieldMessageLength | computeMaximalMessageLength (unsigned lengthField) |
| Returns the maximal message size that can be stored in lengthField bytes. More... | |
| static std::string | messageLengthToBinaryLengthField (LengthFieldMessageLength messageLength, unsigned lengthField) |
| Transforms the selected message length into a binary length field string. More... | |
Protected Member Functions | |
| Config () | |
| Default constructor. More... | |
| Config (RawConfigValues rawConfigValues) | |
| Constructor. More... | |
Static Protected Member Functions | |
| template<typename T > | |
| static T | parseNumber (const std::string &optionName, const std::string &rawValue, T minValue, T maxValue) |
| Parses the selected number from the selected string. More... | |
Static Private Member Functions | |
| static BufferSize | parseBufferSize (const std::string &rawBufferSize) |
| static LengthField | parseLengthField (const std::string &rawLengthField) |
Private Attributes | |
| BufferSize | _bufferSize |
| Buffer size (in bytes). More... | |
| LengthField | _lengthField |
| Size of a field containing the length of a message (in bytes). More... | |
Static Private Attributes | |
| static const BufferSize | DEFAULT_BUFFER_SIZE |
| Default buffer size (in bytes). More... | |
| static const LengthField | DEFAULT_LENGTH_FIELD |
| Default length field (in bytes). More... | |
Base class for all configuration classes.
Subclasses should provide value semantics (object copying and comparison should be allowed).
| typedef size_t Config::BufferSize |
Buffer size type.
| typedef unsigned Config::LengthField |
Length field type.
| typedef std::tr1::uint32_t Config::LengthFieldMessageLength |
Message length type when using length field.
| typedef std::map<std::string, std::string> Config::RawConfigValues |
Raw configuration option -> values mapping.
| Config::~Config | ( | ) |
Destructor.
Destroys a Config object.
| Config::Config | ( | const Config & | other | ) |
Copy constructor.
| other | Object that will be used as a model in the object creation. |
Constructs a copy of the other object.
|
protected |
Default constructor.
Constructs an empty Config object.
|
protected |
Constructor.
| rawConfigValues | Raw configuration option -> values mappings. |
Constructs a Config object from the selected values.
|
static |
Transforms the selected binary string into a number.
| binaryNumber | Binary field length value in a string. |
Preconditions:
|
static |
Returns the maximal message size that can be stored in lengthField bytes.
| lengthField | Size of the length field. |
Preconditions:
|
static |
Creates a Config object from raw configuration values.
| rawConfigValues | Raw configuration option -> values mappings. |
If some passed value is invalid, InvalidValueError will be thrown.
Preconditions:
Meets the strong guarantee of exception safety.
|
inline |
Returns the buffer size (in bytes).
References _bufferSize.
|
inline |
Returns the size of a field containing the length of a message (in bytes).
References _lengthField.
|
static |
Transforms the selected message length into a binary length field string.
| messageLength | Length of the message. |
| lengthField | Length field value (returned from getLengthField()). |
Precodnitions:
Postconditions:
| bool Config::operator!= | ( | const Config & | other | ) | const |
Non-equality comparison.
| other | Object that will be compared with this object. |
Assignment operator.
| other | Object that will be assigned to this object. |
Guarantees the strong exception safety.
| bool Config::operator== | ( | const Config & | other | ) | const |
Equality comparison.
| other | Object that will be compared with this object. |
|
staticprivate |
|
staticprivate |
|
inlinestaticprotected |
Parses the selected number from the selected string.
| optionName | Name of the option. |
| rawValue | Number value in a string. |
| minValue | Minimal valid number value. |
| maxValue | Maximal valid number value. |
If there is some error, InvalidValueError will be thrown.
References strToNum(), and toString().
| void Config::swap | ( | Config & | other | ) |
Swap the contents of this object with the other object.
| other | Object that will be swapped with this object. |
Guarantees nothrow exception safety.
|
private |
Buffer size (in bytes).
Referenced by getBufferSize().
|
private |
Size of a field containing the length of a message (in bytes).
Referenced by getLengthField().
|
staticprivate |
Default buffer size (in bytes).
|
staticprivate |
Default length field (in bytes).
1.8.6