/** * @file include/ActivMiddleware/ActivBase/MessageValidator.h * * @brief Header file for the message validator class. */ #if (!defined ACTIV_BASE_MESSAGE_VALIDATOR_H) #define ACTIV_BASE_MESSAGE_VALIDATOR_H #include "ActivMiddleware/ActivBase/External.h" #include "ActivMiddleware/ActivBase/MessageHandler.h" #include "ActivMiddleware/Misc/MemoryHelper.h" #include #include #include #include //! Activ namespace. namespace Activ { /** * @brief Message validator class. */ class MessageValidator : public MessageHandler { public: /** * @brief Default constructor. * * @param pMessage the address of the message. * @param length the length of the message. * @param messageVersion optional version. */ MessageValidator(const void *pMessage = 0, const size_t length = 0, const MessageVersion messageVersion = MESSAGE_VERSION_UNDEFINED); /** * @brief Initialize with a new contiguous message. * * @param pMessage the address of the message. * @param length the length of the message. * @param messageVersion optional version. */ void Initialize(const void *pMessage, const size_t length, const MessageVersion messageVersion = MESSAGE_VERSION_UNDEFINED); /** * @brief Reset. * * @param messageVersion optional version. */ void Reset(const MessageVersion messageVersion = MESSAGE_VERSION_UNDEFINED); /** * @brief Get the address of the message. * * @return The address of the message. */ const void *GetMessage() const; /** * @brief Get the length of the message. * * @return the length of the message. */ size_t GetLength() const; /** * @brief Get the current offset within the message. * * @return The offset within the message. */ size_t GetOffset() const; /** * @brief Set the current offset within the message. * * @param offset the offset within the message. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ StatusCode SetOffset(const size_t offset); /** * @brief Is the end of message. * * @return whether the end of message has been reached. */ bool IsEndOfMessage() const; /** * @brief Validate bytes. * * @param length the length of the buffer. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ StatusCode ValidateBytesRef(const size_t length, const void *&pData); /** * @brief Validate bytes. * * @param length the length of the buffer. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ StatusCode ValidateBytes(const size_t length); /** * @brief Validate bytes. * * @param length the length of the buffer. * @param pComperand data (of length @a length) to compare to. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ ACTIV_BASE_API StatusCode ValidateBytesCompare(const size_t length, const void * const pComperand, const void *&pData); /** * @brief Validate bytes. * * @param length the length of the buffer. * @param pComperand data (of length @a length) to compare to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ ACTIV_BASE_API StatusCode ValidateBytesCompare(const size_t length, const void * const pComperand); /** * @brief Validate bytes. * * @param length the length of the buffer. * @param value the value to compare all bytes in the buffer to. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ StatusCode ValidateBytes(const size_t length, const byte_t value, const void *&pData); /** * @brief Validate bytes. * * @param length the length of the buffer. * @param value the value to compare all bytes in the buffer to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ StatusCode ValidateBytes(const size_t length, const byte_t value); /** * @brief Validate bytes. * * @param length the length of the buffer. * @param lower the lower bound value. * @param upper the upper bound value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateBytesRange(const size_t length, const byte_t lower, const byte_t upper, const void *&pData); /** * @brief Validate bytes. * * @param length the length of the buffer. * @param lower the lower bound value. * @param upper the upper bound value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateBytesRange(const size_t length, const byte_t lower, const byte_t upper); /** * @brief Validate bytes. * * @param length the length of the buffer. * @param set the set of allowed values. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateBytesSet(const size_t length, const std::vector &set, const void *&pData); /** * @brief Validate bytes. * * @param length the length of the buffer. * @param set the set of allowed values. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateBytesSet(const size_t length, const std::vector &set); /** * @brief Validate bytes. * * @param length the length of the buffer. * @param set the set of allowed values. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateBytesSet(const size_t length, const std::vector &set, const void *&pData); /** * @brief Validate bytes. * * @param length the length of the buffer. * @param set the set of allowed values. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateBytesSet(const size_t length, const std::vector &set); /** * @brief Validate bytes and copy. * * @param length the length of the buffer. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ ACTIV_BASE_API StatusCode ValidateBytesCopy(const size_t length, void *pCopy); /** * @brief Validate bytes and copy. * * @param length the length of the buffer. * @param lower the lower bound value. * @param upper the upper bound value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateBytesRangeCopy(const size_t length, const byte_t lower, const byte_t upper, void *pCopy); /** * @brief Validate bytes and copy. * * @param length the length of the buffer. * @param set the set of allowed values. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateBytesSetCopy(const size_t length, const std::vector &set, void *pCopy); /** * @brief Validate bytes and copy. * * @param length the length of the buffer. * @param set the set of allowed values. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateBytesSetCopy(const size_t length, const std::vector &set, void *pCopy); /** * @brief Validate a signed or unsigned binary integral value. * * SIZE the number of bytes to validate. * ENDIAN the endian of the source. * T the type of the variable to receive the value. * * @param value reference to a variable to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ template StatusCode ValidateBinaryIntegral(T &value); /** * @brief Validate a signed or unsigned binary integral value. * * SIZE the number of bytes to validate. * ENDIAN the endian of the source. * T the type of the variable to receive the value. * LOWER the lower bound value. * UPPER the upper bound value. * * @param value reference to a variable to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateBinaryIntegralRange(T &value); /** * @brief Validate a signed or unsigned binary integral value. * * SIZE the number of bytes to validate. * ENDIAN the endian of the source. * T the type of the variable to receive the value. * * @param lower the lower bound value. * @param upper the upper bound value. * @param value reference to a variable to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateBinaryIntegralRange(const T lower, const T upper, T &value); /** * @brief Validate an ASCII hexadecimal integral value. * * @param size the size of the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ ACTIV_BASE_API StatusCode ValidateAsciiHexadecimalIntegral(const size_t size, const void *&pData); /** * @brief Validate an ASCII hexadecimal integral value. * * @param size the size of the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ ACTIV_BASE_API StatusCode ValidateAsciiHexadecimalIntegral(const size_t size); /** * @brief Validate an ASCII hexadecimal integral value. * * @param size the size of the value. * @param value to receive the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ template StatusCode ValidateAsciiHexadecimalIntegral(const size_t size, T &value, const void *&pData); /** * @brief Validate an ASCII hexadecimal integral value. * * @param size the size of the value. * @param value to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ template StatusCode ValidateAsciiHexadecimalIntegral(const size_t size, T &value); /** * @brief Validate an ASCII hexadecimal integral value. * * @param size the size of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateAsciiHexadecimalIntegralRange(const size_t size, const uint64_t lower, const uint64_t upper, const void *&pData); /** * @brief Validate an ASCII hexadecimal integral value. * * @param size the size of the value. * @param lower the lower bound value. * @param upper the upper bound value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateAsciiHexadecimalIntegralRange(const size_t size, const uint64_t lower, const uint64_t upper); /** * @brief Validate an ASCII hexadecimal integral value. * * @param size the size of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param value to receive the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateAsciiHexadecimalIntegralRange(const size_t size, const uint64_t lower, const uint64_t upper, T &value, const void *&pData); /** * @brief Validate an ASCII hexadecimal integral value. * * @param size the size of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param value to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateAsciiHexadecimalIntegralRange(const size_t size, const uint64_t lower, const uint64_t upper, T &value); /** * @brief Validate an ASCII hexadecimal integral value. * * @param size the size of the value. * @param set the set of allowed values. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateAsciiHexadecimalIntegralSet(const size_t size, const std::vector &set, const void *&pData); /** * @brief Validate an ASCII hexadecimal integral value. * * @param size the size of the value. * @param set the set of allowed values. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateAsciiHexadecimalIntegralSet(const size_t size, const std::vector &set); /** * @brief Validate an ASCII hexadecimal integral value. * * @param size the size of the value. * @param set the set of allowed values. * @param value to receive the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateAsciiHexadecimalIntegralSet(const size_t size, const std::vector &set, T &value, const void *&pData); /** * @brief Validate an ASCII hexadecimal integral value. * * @param size the size of the value. * @param set the set of allowed values. * @param value to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateAsciiHexadecimalIntegralSet(const size_t size, const std::vector &set, T &value); /** * @brief Validate an ASCII hexadecimal integral value and copy. * * @param size the size of the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ ACTIV_BASE_API StatusCode ValidateAsciiHexadecimalIntegralCopy(const size_t size, void *pCopy); /** * @brief Validate an ASCII hexadecimal integral value and copy. * * @param size the size of the value. * @param value to receive the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ template StatusCode ValidateAsciiHexadecimalIntegralCopy(const size_t size, T &value, void *pCopy); /** * @brief Validate an ASCII hexadecimal integral value and copy. * * @param size the size of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateAsciiHexadecimalIntegralRangeCopy(const size_t size, const uint64_t lower, const uint64_t upper, void *pCopy); /** * @brief Validate an ASCII hexadecimal integral value and copy. * * @param size the size of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param value to receive the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateAsciiHexadecimalIntegralRangeCopy(const size_t size, const uint64_t lower, const uint64_t upper, T &value, void *pCopy); /** * @brief Validate an ASCII hexadecimal integral value and copy. * * @param size the size of the value. * @param set the set of allowed values. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateAsciiHexadecimalIntegralSetCopy(const size_t size, const std::vector &set, void *pCopy); /** * @brief Validate an ASCII hexadecimal integral value and copy. * * @param size the size of the value. * @param set the set of allowed values. * @param value to receive the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateAsciiHexadecimalIntegralSetCopy(const size_t size, const std::vector &set, T &value, void *pCopy); /** * @brief Validate a signed ASCII integral value. * * @param length the length of the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER */ ACTIV_BASE_API StatusCode ValidateSignedAsciiIntegral(const size_t length, const void *&pData); /** * @brief Validate a signed ASCII integral value. * * @param length the length of the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER */ ACTIV_BASE_API StatusCode ValidateSignedAsciiIntegral(const size_t length); /** * @brief Validate a signed ASCII integral value. * * @param length the length of the value. * @param value to receive the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedAsciiIntegral(const size_t length, T &value, const void *&pData); /** * @brief Validate a signed ASCII integral value. * * @param length the length of the value. * @param value to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedAsciiIntegral(const size_t length, T &value); /** * @brief Validate a signed ASCII integral value. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateSignedAsciiIntegralRange(const size_t length, const int64_t lower, const int64_t upper, const void *&pData); /** * @brief Validate a signed ASCII integral value. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateSignedAsciiIntegralRange(const size_t length, const int64_t lower, const int64_t upper); /** * @brief Validate a signed ASCII integral value. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param value to receive the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedAsciiIntegralRange(const size_t length, const int64_t lower, const int64_t upper, T &value, const void *&pData); /** * @brief Validate a signed ASCII integral value. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param value to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedAsciiIntegralRange(const size_t length, const int64_t lower, const int64_t upper, T &value); /** * @brief Validate a signed ASCII integral value. * * @param length the length of the value. * @param set the set of allowed values. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ StatusCode ValidateSignedAsciiIntegralSet(const size_t length, const std::vector &set, const void *&pData); /** * @brief Validate a signed ASCII integral value. * * @param length the length of the value. * @param set the set of allowed values. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ StatusCode ValidateSignedAsciiIntegralSet(const size_t length, const std::vector &set); /** * @brief Validate a signed ASCII integral value. * * @param length the length of the value. * @param set the set of allowed values. * @param value to receive the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedAsciiIntegralSet(const size_t length, const std::vector &set, T &value, const void *&pData); /** * @brief Validate a signed ASCII integral value. * * @param length the length of the value. * @param set the set of allowed values. * @param value to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedAsciiIntegralSet(const size_t length, const std::vector &set, T &value); /** * @brief Validate a signed ASCII integral value and copy. * * @param length the length of the value. * @param pCopy the address to copy the data to. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateSignedAsciiIntegralCopy(const size_t length, void *pCopy); /** * @brief Validate a signed ASCII integral value and copy. * * @param length the length of the value. * @param value to receive the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedAsciiIntegralCopy(const size_t length, T &value, void *pCopy); /** * @brief Validate a signed ASCII integral value and copy. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateSignedAsciiIntegralRangeCopy(const size_t length, const int64_t lower, const int64_t upper, void *pCopy); /** * @brief Validate a signed ASCII integral value and copy. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param value to receive the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedAsciiIntegralRangeCopy(const size_t length, const int64_t lower, const int64_t upper, T &value, void *pCopy); /** * @brief Validate a signed ASCII integral value and copy. * * @param length the length of the value. * @param set the set of allowed values. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateSignedAsciiIntegralSetCopy(const size_t length, const std::vector &set, void *pCopy); /** * @brief Validate a signed ASCII integral value and copy. * * @param length the length of the value. * @param set the set of allowed values. * @param value to receive the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedAsciiIntegralSetCopy(const size_t length, const std::vector &set, T &value, void *pCopy); /** * @brief Validate a signed ASCII real value. * * @param length the length of the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateSignedAsciiReal(const size_t length, const void *&pData); /** * @brief Validate a signed ASCII real value. * * @param length the length of the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateSignedAsciiReal(const size_t length); /** * @brief Validate a signed ASCII real value. * * @param length the length of the value. * @param value to receive the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedAsciiReal(const size_t length, T &value, const void *&pData); /** * @brief Validate a signed ASCII real value. * * @param length the length of the value. * @param value to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedAsciiReal(const size_t length, T &value); /** * @brief Validate a signed ASCII real value. * * @param length the length of the value. * @param numerator to receive the numerator. * @param divisor to receive the divisor. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateSignedAsciiReal(const size_t length, int64_t &numerator, uint64_t &divisor, const void *&pData); /** * @brief Validate a signed ASCII real value. * * @param length the length of the value. * @param numerator to receive the numerator. * @param divisor to receive the divisor. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateSignedAsciiReal(const size_t length, int64_t &numerator, uint64_t &divisor); /** * @brief Validate a signed ASCII real value. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ StatusCode ValidateSignedAsciiRealRange(const size_t length, const long double lower, const long double upper, const void *&pData); /** * @brief Validate a signed ASCII real value. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ StatusCode ValidateSignedAsciiRealRange(const size_t length, const long double lower, const long double upper); /** * @brief Validate a signed ASCII real value. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param value to receive the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedAsciiRealRange(const size_t length, const long double lower, const long double upper, T &value, const void *&pData); /** * @brief Validate a signed ASCII real value. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param value to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedAsciiRealRange(const size_t length, const long double lower, const long double upper, T &value); /** * @brief Validate a signed ASCII real value. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param numerator to receive the numerator. * @param divisor to receive the divisor. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateSignedAsciiRealRange(const size_t length, const long double lower, const long double upper, int64_t &numerator, uint64_t &divisor, const void *&pData); /** * @brief Validate a signed ASCII real value. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param numerator to receive the numerator. * @param divisor to receive the divisor. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateSignedAsciiRealRange(const size_t length, const long double lower, const long double upper, int64_t &numerator, uint64_t &divisor); /** * @brief Validate a signed ASCII real value. * * @param length the length of the value. * @param set the set of allowed values. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ StatusCode ValidateSignedAsciiRealSet(const size_t length, const std::vector &set, const void *&pData); /** * @brief Validate a signed ASCII real value. * * @param length the length of the value. * @param set the set of allowed values. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ StatusCode ValidateSignedAsciiRealSet(const size_t length, const std::vector &set); /** * @brief Validate a signed ASCII real value. * * @param length the length of the value. * @param set the set of allowed values. * @param value to receive the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedAsciiRealSet(const size_t length, const std::vector &set, T &value, const void *&pData); /** * @brief Validate a signed ASCII real value. * * @param length the length of the value. * @param set the set of allowed values. * @param value to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedAsciiRealSet(const size_t length, const std::vector &set, T &value); /** * @brief Validate a signed ASCII real value. * * @param length the length of the value. * @param set the set of allowed values. * @param numerator to receive the numerator. * @param divisor to receive the divisor. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateSignedAsciiRealSet(const size_t length, const std::vector &set, int64_t &numerator, uint64_t &divisor, const void *&pData); /** * @brief Validate a signed ASCII real value. * * @param length the length of the value. * @param set the set of allowed values. * @param numerator to receive the numerator. * @param divisor to receive the divisor. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateSignedAsciiRealSet(const size_t length, const std::vector &set, int64_t &numerator, uint64_t &divisor); /** * @brief Validate a signed ASCII real value and copy. * * @param length the length of the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateSignedAsciiRealCopy(const size_t length, void *pCopy); /** * @brief Validate a signed ASCII real value and copy. * * @param length the length of the value. * @param value to receive the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedAsciiRealCopy(const size_t length, T &value, void *pCopy); /** * @brief Validate a signed ASCII real value and copy. * * @param length the length of the value. * @param numerator to receive the numerator. * @param divisor to receive the divisor. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateSignedAsciiRealCopy(const size_t length, int64_t &numerator, uint64_t &divisor, void *pCopy); /** * @brief Validate a signed ASCII real value and copy. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ StatusCode ValidateSignedAsciiRealRangeCopy(const size_t length, const long double lower, const long double upper, void *pCopy); /** * @brief Validate a signed ASCII real value and copy. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param value to receive the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedAsciiRealRangeCopy(const size_t length, const long double lower, const long double upper, T &value, void *pCopy); /** * @brief Validate a signed ASCII real value and copy. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param numerator to receive the numerator. * @param divisor to receive the divisor. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateSignedAsciiRealRangeCopy(const size_t length, const long double lower, const long double upper, int64_t &numerator, uint64_t &divisor, void *pCopy); /** * @brief Validate a signed ASCII real value and copy. * * @param length the length of the value. * @param set the set of allowed values. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ StatusCode ValidateSignedAsciiRealSetCopy(const size_t length, const std::vector &set, void *pCopy); /** * @brief Validate a signed ASCII real value and copy. * * @param length the length of the value. * @param set the set of allowed values. * @param value to receive the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedAsciiRealSetCopy(const size_t length, const std::vector &set, T &value, void *pCopy); /** * @brief Validate a signed ASCII real value and copy. * * @param length the length of the value. * @param set the set of allowed values. * @param numerator to receive the numerator. * @param divisor to receive the divisor. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateSignedAsciiRealSetCopy(const size_t length, const std::vector &set, int64_t &numerator, uint64_t &divisor, void *pCopy); /** * @brief Validate a signed binary integral value. * * @param size the size of the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ ACTIV_BASE_API StatusCode ValidateSignedBinaryIntegral(const size_t size, const void *&pData); /** * @brief Validate a signed binary integral value. * * @param size the size of the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ ACTIV_BASE_API StatusCode ValidateSignedBinaryIntegral(const size_t size); /** * @brief Validate a signed binary integral value. * * @param size the size of the value. * @param value to receive the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ template StatusCode ValidateSignedBinaryIntegral(const size_t size, T &value, const void *&pData); /** * @brief Validate a signed binary integral value. * * @param size the size of the value. * @param value to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ template StatusCode ValidateSignedBinaryIntegral(const size_t size, T &value); /** * @brief Validate a signed binary integral value. * * @param size the size of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedBinaryIntegralRange(const size_t size, const int64_t lower, const int64_t upper, const void *&pData); /** * @brief Validate a signed binary integral value. * * @param size the size of the value. * @param lower the lower bound value. * @param upper the upper bound value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedBinaryIntegralRange(const size_t size, const int64_t lower, const int64_t upper); /** * @brief Validate a signed binary integral value. * * @param size the size of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param value to receive the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedBinaryIntegralRange(const size_t size, const int64_t lower, const int64_t upper, T &value, const void *&pData); /** * @brief Validate a signed binary integral value. * * @param size the size of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param value to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedBinaryIntegralRange(const size_t size, const int64_t lower, const int64_t upper, T &value); /** * @brief Validate a signed binary integral value. * * @param size the size of the value. * @param set the set of allowed values. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedBinaryIntegralSet(const size_t size, const std::vector &set, const void *&pData); /** * @brief Validate a signed binary integral value. * * @param size the size of the value. * @param set the set of allowed values. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedBinaryIntegralSet(const size_t size, const std::vector &set); /** * @brief Validate a signed binary integral value. * * @param size the size of the value. * @param set the set of allowed values. * @param value to receive the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedBinaryIntegralSet(const size_t size, const std::vector &set, T &value, const void *&pData); /** * @brief Validate a signed binary integral value. * * @param size the size of the value. * @param set the set of allowed values. * @param value to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedBinaryIntegralSet(const size_t size, const std::vector &set, T &value); /** * @brief Validate a signed binary integral value and copy. * * @param size the size of the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ ACTIV_BASE_API StatusCode ValidateSignedBinaryIntegralCopy(const size_t size, void *pCopy); /** * @brief Validate a signed binary integral value and copy. * * @param size the size of the value. * @param value to receive the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ template StatusCode ValidateSignedBinaryIntegralCopy(const size_t size, T &value, void *pCopy); /** * @brief Validate a signed binary integral value and copy. * * @param size the size of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedBinaryIntegralRangeCopy(const size_t size, const int64_t lower, const int64_t upper, void *pCopy); /** * @brief Validate a signed binary integral value and copy. * * @param size the size of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param value to receive the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedBinaryIntegralRangeCopy(const size_t size, const int64_t lower, const int64_t upper, T &value, void *pCopy); /** * @brief Validate a signed binary integral value and copy. * * @param size the size of the value. * @param set the set of allowed values. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedBinaryIntegralSetCopy(const size_t size, const std::vector &set, void *pCopy); /** * @brief Validate a signed binary integral value and copy. * * @param size the size of the value. * @param set the set of allowed values. * @param value to receive the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateSignedBinaryIntegralSetCopy(const size_t size, const std::vector &set, T &value, void *pCopy); /** * @brief Validate string. * * @param string to assign the string to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ ACTIV_BASE_API StatusCode ValidateString(String &string); /** * @brief Validate string. * * @param lower the lower bound value. * @param upper the upper bound value. * @param string the location to copy the string to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateStringRange(const byte_t lower, const byte_t upper, String &string); /** * @brief Validate string. * * @param set the set of allowed values. * @param string the location to copy the string to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateStringSet(const std::vector &set, String &string); /** * @brief Validate string. * * @param set the set of allowed values. * @param string to assign the string to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateStringSet(const std::vector &set, String &string); /** * @brief Validate an unsigned ASCII integral value. * * @param length the length of the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER */ ACTIV_BASE_API StatusCode ValidateUnsignedAsciiIntegral(const size_t length, const void *&pData); /** * @brief Validate an unsigned ASCII integral value. * * @param length the length of the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER */ ACTIV_BASE_API StatusCode ValidateUnsignedAsciiIntegral(const size_t length); /** * @brief Validate an unsigned ASCII integral value. * * @param length the length of the value. * @param value to receive the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedAsciiIntegral(const size_t length, T &value, const void *&pData); /** * @brief Validate an unsigned ASCII integral value. * * @param length the length of the value. * @param value to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedAsciiIntegral(const size_t length, T &value); /** * @brief Validate an unsigned ASCII integral value. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ StatusCode ValidateUnsignedAsciiIntegralRange(const size_t length, const uint64_t lower, const uint64_t upper, const void *&pData); /** * @brief Validate an unsigned ASCII integral value. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ StatusCode ValidateUnsignedAsciiIntegralRange(const size_t length, const uint64_t lower, const uint64_t upper); /** * @brief Validate an unsigned ASCII integral value. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param value to receive the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedAsciiIntegralRange(const size_t length, const uint64_t lower, const uint64_t upper, T &value, const void *&pData); /** * @brief Validate an unsigned ASCII integral value. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param value to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedAsciiIntegralRange(const size_t length, const uint64_t lower, const uint64_t upper, T &value); /** * @brief Validate an unsigned ASCII integral value. * * @param length the length of the value. * @param set the set of allowed values. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ StatusCode ValidateUnsignedAsciiIntegralSet(const size_t length, const std::vector &set, const void *&pData); /** * @brief Validate an unsigned ASCII integral value. * * @param length the length of the value. * @param set the set of allowed values. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ StatusCode ValidateUnsignedAsciiIntegralSet(const size_t length, const std::vector &set); /** * @brief Validate an unsigned ASCII integral value. * * @param length the length of the value. * @param set the set of allowed values. * @param value to receive the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedAsciiIntegralSet(const size_t length, const std::vector &set, T &value, const void *&pData); /** * @brief Validate an unsigned ASCII integral value. * * @param length the length of the value. * @param set the set of allowed values. * @param value to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedAsciiIntegralSet(const size_t length, const std::vector &set, T &value); /** * @brief Validate an unsigned ASCII integral value and copy. * * @param length the length of the value. * @param pCopy the address to copy the data to. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateUnsignedAsciiIntegralCopy(const size_t length, void *pCopy); /** * @brief Validate an unsigned ASCII integral value and copy. * * @param length the length of the value. * @param value to receive the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedAsciiIntegralCopy(const size_t length, T &value, void *pCopy); /** * @brief Validate an unsigned ASCII integral value and copy. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateUnsignedAsciiIntegralRangeCopy(const size_t length, const uint64_t lower, const uint64_t upper, void *pCopy); /** * @brief Validate an unsigned ASCII integral value and copy. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param value to receive the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedAsciiIntegralRangeCopy(const size_t length, const uint64_t lower, const uint64_t upper, T &value, void *pCopy); /** * @brief Validate an unsigned ASCII integral value and copy. * * @param length the length of the value. * @param set the set of allowed values. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateUnsignedAsciiIntegralSetCopy(const size_t length, const std::vector &set, void *pCopy); /** * @brief Validate an unsigned ASCII integral value and copy. * * @param length the length of the value. * @param set the set of allowed values. * @param value to receive the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedAsciiIntegralSetCopy(const size_t length, const std::vector &set, T &value, void *pCopy); /** * @brief Validate an unsigned ASCII real value. * * @param length the length of the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateUnsignedAsciiReal(const size_t length, const void *&pData); /** * @brief Validate an unsigned ASCII real value. * * @param length the length of the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateUnsignedAsciiReal(const size_t length); /** * @brief Validate an unsigned ASCII real value. * * @param length the length of the value. * @param value to receive the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedAsciiReal(const size_t length, T &value, const void *&pData); /** * @brief Validate an unsigned ASCII real value. * * @param length the length of the value. * @param value to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedAsciiReal(const size_t length, T &value); /** * @brief Validate an unsigned ASCII real value. * * @param length the length of the value. * @param numerator to receive the numerator. * @param divisor to receive the divisor. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateUnsignedAsciiReal(const size_t length, uint64_t &numerator, uint64_t &divisor, const void *&pData); /** * @brief Validate an unsigned ASCII real value. * * @param length the length of the value. * @param numerator to receive the numerator. * @param divisor to receive the divisor. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateUnsignedAsciiReal(const size_t length, uint64_t &numerator, uint64_t &divisor); /** * @brief Validate an unsigned ASCII real value. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ StatusCode ValidateUnsignedAsciiRealRange(const size_t length, const long double lower, const long double upper, const void *&pData); /** * @brief Validate an unsigned ASCII real value. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ StatusCode ValidateUnsignedAsciiRealRange(const size_t length, const long double lower, const long double upper); /** * @brief Validate an unsigned ASCII real value. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param value to receive the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedAsciiRealRange(const size_t length, const long double lower, const long double upper, T &value, const void *&pData); /** * @brief Validate an unsigned ASCII real value. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param value to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedAsciiRealRange(const size_t length, const long double lower, const long double upper, T &value); /** * @brief Validate an unsigned ASCII real value. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param numerator to receive the numerator. * @param divisor to receive the divisor. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateUnsignedAsciiRealRange(const size_t length, const long double lower, const long double upper, uint64_t &numerator, uint64_t &divisor, const void *&pData); /** * @brief Validate an unsigned ASCII real value. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param numerator to receive the numerator. * @param divisor to receive the divisor. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateUnsignedAsciiRealRange(const size_t length, const long double lower, const long double upper, uint64_t &numerator, uint64_t &divisor); /** * @brief Validate an unsigned ASCII real value. * * @param length the length of the value. * @param set the set of allowed values. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ StatusCode ValidateUnsignedAsciiRealSet(const size_t length, const std::vector &set, const void *&pData); /** * @brief Validate an unsigned ASCII real value. * * @param length the length of the value. * @param set the set of allowed values. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ StatusCode ValidateUnsignedAsciiRealSet(const size_t length, const std::vector &set); /** * @brief Validate an unsigned ASCII real value. * * @param length the length of the value. * @param set the set of allowed values. * @param value to receive the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedAsciiRealSet(const size_t length, const std::vector &set, T &value, const void *&pData); /** * @brief Validate an unsigned ASCII real value. * * @param length the length of the value. * @param set the set of allowed values. * @param value to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedAsciiRealSet(const size_t length, const std::vector &set, T &value); /** * @brief Validate an unsigned ASCII real value. * * @param length the length of the value. * @param set the set of allowed values. * @param numerator to receive the numerator. * @param divisor to receive the divisor. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateUnsignedAsciiRealSet(const size_t length, const std::vector &set, uint64_t &numerator, uint64_t &divisor, const void *&pData); /** * @brief Validate an unsigned ASCII real value. * * @param length the length of the value. * @param set the set of allowed values. * @param numerator to receive the numerator. * @param divisor to receive the divisor. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateUnsignedAsciiRealSet(const size_t length, const std::vector &set, uint64_t &numerator, uint64_t &divisor); /** * @brief Validate an unsigned ASCII real value and copy. * * @param length the length of the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateUnsignedAsciiRealCopy(const size_t length, void *pCopy); /** * @brief Validate an unsigned ASCII real value and copy. * * @param length the length of the value. * @param value to receive the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedAsciiRealCopy(const size_t length, T &value, void *pCopy); /** * @brief Validate an unsigned ASCII real value and copy. * * @param length the length of the value. * @param numerator to receive the numerator. * @param divisor to receive the divisor. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateUnsignedAsciiRealCopy(const size_t length, uint64_t &numerator, uint64_t &divisor, void *pCopy); /** * @brief Validate an unsigned ASCII real value and copy. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ StatusCode ValidateUnsignedAsciiRealRangeCopy(const size_t length, const long double lower, const long double upper, void *pCopy); /** * @brief Validate an unsigned ASCII real value and copy. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param value to receive the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedAsciiRealRangeCopy(const size_t length, const long double lower, const long double upper, T &value, void *pCopy); /** * @brief Validate an unsigned ASCII real value and copy. * * @param length the length of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param numerator to receive the numerator. * @param divisor to receive the divisor. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateUnsignedAsciiRealRangeCopy(const size_t length, const long double lower, const long double upper, uint64_t &numerator, uint64_t &divisor, void *pCopy); /** * @brief Validate an unsigned ASCII real value and copy. * * @param length the length of the value. * @param set the set of allowed values. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ StatusCode ValidateUnsignedAsciiRealSetCopy(const size_t length, const std::vector &set, void *pCopy); /** * @brief Validate an unsigned ASCII real value and copy. * * @param length the length of the value. * @param set the set of allowed values. * @param value to receive the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedAsciiRealSetCopy(const size_t length, const std::vector &set, T &value, void *pCopy); /** * @brief Validate an unsigned ASCII real value and copy. * * @param length the length of the value. * @param set the set of allowed values. * @param numerator to receive the numerator. * @param divisor to receive the divisor. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API StatusCode ValidateUnsignedAsciiRealSetCopy(const size_t length, const std::vector &set, uint64_t &numerator, uint64_t &divisor, void *pCopy); /** * @brief Validate an unsigned binary integral value. * * @param size the size of the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ ACTIV_BASE_API StatusCode ValidateUnsignedBinaryIntegral(const size_t size, const void *&pData); /** * @brief Validate an unsigned binary integral value. * * @param size the size of the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ ACTIV_BASE_API StatusCode ValidateUnsignedBinaryIntegral(const size_t size); /** * @brief Validate an unsigned binary integral value. * * @param size the size of the value. * @param value to receive the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ template StatusCode ValidateUnsignedBinaryIntegral(const size_t size, T &value, const void *&pData); /** * @brief Validate an unsigned binary integral value. * * @param size the size of the value. * @param value to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ template StatusCode ValidateUnsignedBinaryIntegral(const size_t size, T &value); /** * @brief Validate an unsigned binary integral value. * * @param size the size of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedBinaryIntegralRange(const size_t size, const uint64_t lower, const uint64_t upper, const void *&pData); /** * @brief Validate an unsigned binary integral value. * * @param size the size of the value. * @param lower the lower bound value. * @param upper the upper bound value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedBinaryIntegralRange(const size_t size, const uint64_t lower, const uint64_t upper); /** * @brief Validate an unsigned binary integral value. * * @param size the size of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param value to receive the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedBinaryIntegralRange(const size_t size, const uint64_t lower, const uint64_t upper, T &value, const void *&pData); /** * @brief Validate an unsigned binary integral value. * * @param size the size of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param value to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedBinaryIntegralRange(const size_t size, const uint64_t lower, const uint64_t upper, T &value); /** * @brief Validate an unsigned binary integral value. * * @param size the size of the value. * @param set the set of allowed values. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedBinaryIntegralSet(const size_t size, const std::vector &set, const void *&pData); /** * @brief Validate an unsigned binary integral value. * * @param size the size of the value. * @param set the set of allowed values. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedBinaryIntegralSet(const size_t size, const std::vector &set); /** * @brief Validate an unsigned binary integral value. * * @param size the size of the value. * @param set the set of allowed values. * @param value to receive the value. * @param pData the location to copy the address of the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedBinaryIntegralSet(const size_t size, const std::vector &set, T &value, const void *&pData); /** * @brief Validate an unsigned binary integral value. * * @param size the size of the value. * @param set the set of allowed values. * @param value to receive the value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedBinaryIntegralSet(const size_t size, const std::vector &set, T &value); /** * @brief Validate an unsigned binary integral value and copy. * * @param size the size of the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ ACTIV_BASE_API StatusCode ValidateUnsignedBinaryIntegralCopy(const size_t size, void *pCopy); /** * @brief Validate an unsigned binary integral value and copy. * * @param size the size of the value. * @param value to receive the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ template StatusCode ValidateUnsignedBinaryIntegralCopy(const size_t size, T &value, void *pCopy); /** * @brief Validate an unsigned binary integral value and copy. * * @param size the size of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedBinaryIntegralRangeCopy(const size_t size, const uint64_t lower, const uint64_t upper, void *pCopy); /** * @brief Validate an unsigned binary integral value and copy. * * @param size the size of the value. * @param lower the lower bound value. * @param upper the upper bound value. * @param value to receive the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedBinaryIntegralRangeCopy(const size_t size, const uint64_t lower, const uint64_t upper, T &value, void *pCopy); /** * @brief Validate an unsigned binary integral value and copy. * * @param size the size of the value. * @param set the set of allowed values. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedBinaryIntegralSetCopy(const size_t size, const std::vector &set, void *pCopy); /** * @brief Validate an unsigned binary integral value and copy. * * @param size the size of the value. * @param set the set of allowed values. * @param value to receive the value. * @param pCopy the address to copy the data to. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ template StatusCode ValidateUnsignedBinaryIntegralSetCopy(const size_t size, const std::vector &set, T &value, void *pCopy); /** * @brief Validate a binary boolean value. * * @param value to receive the boolean value. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER * @retval STATUS_CODE_OUT_OF_RANGE */ StatusCode ValidateBoolean(bool &value); /** * @brief Validate message. * * @param message message to deserialize. Must have a StatusCode Deserialize(MessageValidator &) method. * * @retval STATUS_CODE_SUCCESS * @retval ... */ template StatusCode ValidateMessage(MESSAGE_TYPE &message); /** * @brief Get data from the message. * * @param offset the offset within the message. * @param pData reference to the address of the data. * @param length the length to get. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_PARAMETER */ StatusCode Get(const size_t offset, const void *&pData, const size_t length) const; /** * @brief Copy an ASCII hexadecimal integral value to an unsigned binary integral value. * * @param to the value to be copied to. * @param pData a pointer to the data to copy from. * @param size the size of the data to copy from. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_OUT_OF_RANGE */ template static StatusCode CopyAsciiHexadecimalIntegralToUnsignedBinaryIntegral(T &to, const void * const pData, size_t size); /** * @brief Copy a signed ASCII integral value to a signed binary integral value. * * @param to the value to be copied to. * @param pData a pointer to the data to copy from. * @param length the length of the data to copy from. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_OUT_OF_RANGE */ template static StatusCode CopySignedAsciiIntegralToSignedBinaryIntegral(T &to, const void * const pData, size_t length); /** * @brief Copy a signed ASCII real value to a binary real. * * @param to the value to be copied to. * @param pData a pointer to the data to copy from. * @param length the length of the data to copy from. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_OUT_OF_RANGE */ template static StatusCode CopySignedAsciiRealToBinaryReal(T &to, const void * const pData, size_t length); /** * @brief Copy a signed ASCII real value to a numerator and divisor. * * @param numerator the numerator to be copied to. * @param divisor the divisor to be copied to. * @param pData a pointer to the data to copy from. * @param length the length of the data to copy from. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API static StatusCode CopySignedAsciiRealToNumeratorAndDivisor(int64_t &numerator, uint64_t &divisor, const void * const pData, const size_t length); /** * @brief Copy a signed binary integral value to a signed binary integral value. * * @param to the value to be copied to. * @param pData a pointer to the data to copy from. * @param size the size of the data to copy from. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_OUT_OF_RANGE */ template static StatusCode CopySignedBinaryIntegralToSignedBinaryIntegral(T &to, const void * const pData, size_t size); /** * @brief Copy an unsigned ASCII integral value to an unsigned binary integral value. * * @param to the value to be copied to. * @param pData a pointer to the data to copy from. * @param length the length of the data to copy from. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_OUT_OF_RANGE */ template static StatusCode CopyUnsignedAsciiIntegralToUnsignedBinaryIntegral(T &to, const void * const pData, size_t length); /** * @brief Copy an unsigned ASCII real value to a binary real. * * @param to the value to be copied to. * @param pData a pointer to the data to copy from. * @param length the length of the data to copy from. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_OUT_OF_RANGE */ template static StatusCode CopyUnsignedAsciiRealToBinaryReal(T &to, const void * const pData, size_t length); /** * @brief Copy an unsigned ASCII real value to a numerator and divisor. * * @param numerator the numerator to be copied to. * @param divisor the divisor to be copied to. * @param pData a pointer to the data to copy from. * @param length the length of the data to copy from. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_OUT_OF_RANGE */ ACTIV_BASE_API static StatusCode CopyUnsignedAsciiRealToNumeratorAndDivisor(uint64_t &numerator, uint64_t &divisor, const void * const pData, const size_t length); /** * @brief Copy an unsigned binary integral value to an unsigned binary integral value. * * @param to the value to be copied to. * @param pData a pointer to the data to copy from. * @param size the size of the data to copy from. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_OUT_OF_RANGE */ template static StatusCode CopyUnsignedBinaryIntegralToUnsignedBinaryIntegral(T &to, const void * const pData, size_t size); private: /** * @brief Copy a signed ASCII integral value to a signed binary integral value. * * @param to the value to be copied to. * @param pData a pointer to the data to copy from. * @param length the length of the data to copy from. Assumed to be not 0. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_OUT_OF_RANGE */ template static StatusCode CopySignedAsciiIntegralToSignedBinaryIntegralInternal(T &to, const void * const pData, size_t length); /** * @brief Copy a positive signed ASCII integral value to a signed binary integral value. * * @param to the value to be copied to. * @param pData a pointer to the data to copy from. * @param length the length of the data to copy from. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_OUT_OF_RANGE */ template static StatusCode CopyPositiveAsciiIntegralToSignedBinaryIntegral(T &to, const void * const pData, size_t length); /** * @brief Copy a negative signed ASCII integral value to a signed binary integral value. * * @param to the value to be copied to. * @param pData a pointer to the data to copy from. * @param length the length of the data to copy from. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_OUT_OF_RANGE */ template static StatusCode CopyNegativeAsciiIntegralToSignedBinaryIntegral(T &to, const void * const pData, size_t length); /** * @brief Copy a signed ASCII real value to a numerator and divisor. * * @param numerator the numerator to be copied to. * @param divisor the divisor to be copied to. * @param pData a pointer to the data to copy from. * @param length the length of the data to copy from. Assumed to be not 0. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_OUT_OF_RANGE */ static StatusCode CopySignedAsciiRealToNumeratorAndDivisorInternal(int64_t &numerator, uint64_t &divisor, const void * const pData, const size_t length); /** * @brief Copy a positive ASCII real value to a numerator and divisor. * * @param numerator the numerator to be copied to. * @param divisor the divisor to be copied to. * @param pData a pointer to the data to copy from. * @param length the length of the data to copy from. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_OUT_OF_RANGE */ static StatusCode CopyPositiveAsciiRealToNumeratorAndDivisor(int64_t &numerator, uint64_t &divisor, const void * const pData, const size_t length); /** * @brief Copy a negative ASCII real value to a numerator and divisor. * * @param numerator the numerator to be copied to. * @param divisor the divisor to be copied to. * @param pData a pointer to the data to copy from. * @param length the length of the data to copy from. * * @retval STATUS_CODE_SUCCESS * @retval STATUS_CODE_INVALID_FORMAT * @retval STATUS_CODE_OUT_OF_RANGE */ static StatusCode CopyNegativeAsciiRealToNumeratorAndDivisor(int64_t &numerator, uint64_t &divisor, const void * const pData, const size_t length); template static StatusCode CopySignedBinaryIntegralToSignedBinaryIntegralInternal(T &to, const void * const pData, size_t size); template static StatusCode CopyUnsignedBinaryIntegralToUnsignedBinaryIntegralInternal(T &to, const void * const pData, size_t size); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateAsciiHexadecimalIntegralT(const size_t size, T &value, const void *&pData); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateAsciiHexadecimalIntegralT(const size_t size, T &value); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateAsciiHexadecimalIntegralRangeT(const size_t size, const uint64_t lower, const uint64_t upper, T &value, const void *&pData); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateAsciiHexadecimalIntegralRangeT(const size_t size, const uint64_t lower, const uint64_t upper, T &value); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateAsciiHexadecimalIntegralSetT(const size_t size, const std::vector &set, T &value, const void *&pData); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateAsciiHexadecimalIntegralSetT(const size_t size, const std::vector &set, T &value); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateAsciiHexadecimalIntegralCopyT(const size_t size, T &value, void *pCopy); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateAsciiHexadecimalIntegralRangeCopyT(const size_t size, const uint64_t lower, const uint64_t upper, T &value, void *pCopy); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateAsciiHexadecimalIntegralSetCopyT(const size_t size, const std::vector &set, T &value, void *pCopy); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedAsciiIntegralT(const size_t length, T &value, const void *&pData); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedAsciiIntegralT(const size_t length, T &value); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedAsciiIntegralRangeT(const size_t length, const int64_t lower, const int64_t upper, T &value, const void *&pData); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedAsciiIntegralRangeT(const size_t length, const int64_t lower, const int64_t upper, T &value); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedAsciiIntegralSetT(const size_t length, const std::vector &set, T &value, const void *&pData); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedAsciiIntegralSetT(const size_t length, const std::vector &set, T &value); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedAsciiIntegralCopyT(const size_t length, T &value, void *pCopy); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedAsciiIntegralRangeCopyT(const size_t length, const int64_t lower, const int64_t upper, T &value, void *pCopy); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedAsciiIntegralSetCopyT(const size_t length, const std::vector &set, T &value, void *pCopy); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedAsciiRealT(const size_t length, T &value, const void *&pData); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedAsciiRealT(const size_t length, T &value); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedAsciiRealRangeT(const size_t length, const long double lower, const long double upper, T &value, const void *&pData); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedAsciiRealRangeT(const size_t length, const long double lower, const long double upper, T &value); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedAsciiRealSetT(const size_t length, const std::vector &set, T &value, const void *&pData); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedAsciiRealSetT(const size_t length, const std::vector &set, T &value); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedAsciiRealCopyT(const size_t length, T &value, void *pCopy); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedAsciiRealRangeCopyT(const size_t length, const long double lower, const long double upper, T &value, void *pCopy); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedAsciiRealSetCopyT(const size_t length, const std::vector &set, T &value, void *pCopy); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedBinaryIntegralT(const size_t size, T &value, const void *&pData); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedBinaryIntegralT(const size_t size, T &value); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedBinaryIntegralRangeT(const size_t size, const int64_t lower, const int64_t upper, T &value, const void *&pData); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedBinaryIntegralRangeT(const size_t size, const int64_t lower, const int64_t upper, T &value); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedBinaryIntegralSetT(const size_t size, const std::vector &set, T &value, const void *&pData); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedBinaryIntegralSetT(const size_t size, const std::vector &set, T &value); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedBinaryIntegralCopyT(const size_t size, T &value, void *pCopy); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedBinaryIntegralRangeCopyT(const size_t size, const int64_t lower, const int64_t upper, T &value, void *pCopy); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateSignedBinaryIntegralSetCopyT(const size_t size, const std::vector &set, T &value, void *pCopy); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedAsciiIntegralT(const size_t length, T &value, const void *&pData); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedAsciiIntegralT(const size_t length, T &value); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedAsciiIntegralRangeT(const size_t length, const uint64_t lower, const uint64_t upper, T &value, const void *&pData); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedAsciiIntegralRangeT(const size_t length, const uint64_t lower, const uint64_t upper, T &value); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedAsciiIntegralSetT(const size_t length, const std::vector &set, T &value, const void *&pData); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedAsciiIntegralSetT(const size_t length, const std::vector &set, T &value); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedAsciiIntegralCopyT(const size_t length, T &value, void *pCopy); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedAsciiIntegralRangeCopyT(const size_t length, const uint64_t lower, const uint64_t upper, T &value, void *pCopy); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedAsciiIntegralSetCopyT(const size_t length, const std::vector &set, T &value, void *pCopy); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedAsciiRealT(const size_t length, T &value, const void *&pData); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedAsciiRealT(const size_t length, T &value); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedAsciiRealRangeT(const size_t length, const long double lower, const long double upper, T &value, const void *&pData); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedAsciiRealRangeT(const size_t length, const long double lower, const long double upper, T &value); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedAsciiRealSetT(const size_t length, const std::vector &set, T &value, const void *&pData); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedAsciiRealSetT(const size_t length, const std::vector &set, T &value); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedAsciiRealCopyT(const size_t length, T &value, void *pCopy); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedAsciiRealRangeCopyT(const size_t length, const long double lower, const long double upper, T &value, void *pCopy); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedAsciiRealSetCopyT(const size_t length, const std::vector &set, T &value, void *pCopy); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedBinaryIntegralT(const size_t size, T &value, const void *&pData); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedBinaryIntegralT(const size_t size, T &value); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedBinaryIntegralRangeT(const size_t size, const uint64_t lower, const uint64_t upper, T &value, const void *&pData); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedBinaryIntegralRangeT(const size_t size, const uint64_t lower, const uint64_t upper, T &value); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedBinaryIntegralSetT(const size_t size, const std::vector &set, T &value, const void *&pData); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedBinaryIntegralSetT(const size_t size, const std::vector &set, T &value); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedBinaryIntegralCopyT(const size_t size, T &value, void *pCopy); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedBinaryIntegralRangeCopyT(const size_t size, const uint64_t lower, const uint64_t upper, T &value, void *pCopy); template ACTIV_TEMPLATE_API(ACTIV_BASE_API) StatusCode ValidateUnsignedBinaryIntegralSetCopyT(const size_t size, const std::vector &set, T &value, void *pCopy); /** * @brief Template to get built-in type value from a (potentially) unaligned pointer and swap endian if required. * * ENDIAN source endian. * T type of destination. */ template class GetValueFromUnalignedPointerInEndianT { }; /** * @brief Template to copy binary to binary with template length. * * Note no definition of this template is provided - one of the partial specializations should be used. * * SIZE_MATCH used for partial specialization to optimize case when sizeof(T) == SIZE. * IS_SIGNED used for partial specialization on signedness of T. * SIZE number of bytes to copy. * ENDIAN source endian. * T type of destination. */ template class CopyBinaryIntegralToBinaryIntegralT { }; /** * @brief Template to copy binary to binary with run-time length. * * Note no definition of this template is provided - one of the partial specializations should be used. * * IS_SIGNED used for partial specialization on signedness of T. * ENDIAN source endian. * T type of destination. */ template class CopyBinaryIntegralToBinaryIntegralRtlT { }; /** * @brief Template to copy ascii hexadecimal to binary. * * Note no definition of this template is provided - one of the partial specializations should be used. * * ENDIAN source endian. */ template class CopyAsciiHexadecimalIntegralToUnsignedBinaryIntegralT { }; const byte_t * m_pMessage; ///< The address of the message. const byte_t * m_pNext; ///< Next byte to be validated. const byte_t * m_pMessageEnd; ///< The address of one byte passed the end of the message. }; // --------------------------------------------------------------------------------------------------------------------------------- inline MessageValidator::MessageValidator(const void *pMessage, const size_t length, const MessageVersion messageVersion) { Initialize(pMessage, length, messageVersion); } // --------------------------------------------------------------------------------------------------------------------------------- inline void MessageValidator::Initialize(const void *pMessage, const size_t length, const MessageVersion messageVersion) { m_pMessage = reinterpret_cast(pMessage); m_pMessageEnd = m_pMessage + length; Reset(messageVersion); } // --------------------------------------------------------------------------------------------------------------------------------- inline void MessageValidator::Reset(const MessageVersion messageVersion) { SetMessageVersion(messageVersion); m_pNext = m_pMessage; } // --------------------------------------------------------------------------------------------------------------------------------- inline const void *MessageValidator::GetMessage() const { return m_pMessage; } // --------------------------------------------------------------------------------------------------------------------------------- inline size_t MessageValidator::GetLength() const { return (m_pMessageEnd - m_pMessage); } // --------------------------------------------------------------------------------------------------------------------------------- inline size_t MessageValidator::GetOffset() const { return (m_pNext - m_pMessage); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::SetOffset(const size_t offset) { const byte_t * const pNewNext = m_pMessage + offset; if (ACTIV_UNLIKELY(pNewNext > m_pMessageEnd)) return STATUS_CODE_INVALID_PARAMETER; m_pNext = pNewNext; return STATUS_CODE_SUCCESS; } // --------------------------------------------------------------------------------------------------------------------------------- inline bool MessageValidator::IsEndOfMessage() const { return (m_pNext == m_pMessageEnd); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateBytesRef(const size_t length, const void *&pData) { const byte_t * const pNewNext = m_pNext + length; if (ACTIV_UNLIKELY(pNewNext > m_pMessageEnd)) return STATUS_CODE_INVALID_PARAMETER; pData = m_pNext; m_pNext = pNewNext; return STATUS_CODE_SUCCESS; } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateBytes(const size_t length) { const byte_t * const pNewNext = m_pNext + length; if (ACTIV_UNLIKELY(pNewNext > m_pMessageEnd)) return STATUS_CODE_INVALID_PARAMETER; m_pNext = pNewNext; return STATUS_CODE_SUCCESS; } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateBytes(const size_t length, const byte_t value, const void *&pData) { const byte_t * const pNewNext = m_pNext + length; if (ACTIV_UNLIKELY(pNewNext > m_pMessageEnd)) return STATUS_CODE_INVALID_PARAMETER; for (const byte_t *pByte = m_pNext; pByte < pNewNext; ++pByte) { const byte_t thisByte(*pByte); if (ACTIV_UNLIKELY(thisByte != value)) return STATUS_CODE_OUT_OF_RANGE; } pData = m_pNext; m_pNext = pNewNext; return STATUS_CODE_SUCCESS; } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateBytes(const size_t length, const byte_t value) { const byte_t * const pNewNext = m_pNext + length; if (ACTIV_UNLIKELY(pNewNext > m_pMessageEnd)) return STATUS_CODE_INVALID_PARAMETER; for (const byte_t *pByte = m_pNext; pByte < pNewNext; ++pByte) { const byte_t thisByte(*pByte); if (ACTIV_UNLIKELY(thisByte != value)) return STATUS_CODE_OUT_OF_RANGE; } m_pNext = pNewNext; return STATUS_CODE_SUCCESS; } // --------------------------------------------------------------------------------------------------------------------------------- template StatusCode MessageValidator::ValidateBinaryIntegral(T &value) { ACTIV_BOOST_STATIC_ASSERT((SIZE > 0) && (SIZE <= sizeof(uint64_t))); ACTIV_BOOST_STATIC_ASSERT(Boost::is_integral::value || Boost::is_enum::value); const byte_t * const pNewNext = m_pNext + SIZE; if (ACTIV_UNLIKELY(pNewNext > m_pMessageEnd)) return STATUS_CODE_INVALID_PARAMETER; T to; StatusCode statusCode = CopyBinaryIntegralToBinaryIntegralT<(SIZE == sizeof(T)), Boost::is_signed::value, SIZE, ENDIAN, T>()(m_pNext, to); if (ACTIV_UNLIKELY(STATUS_CODE_SUCCESS != statusCode)) return statusCode; m_pNext = pNewNext; value = to; return STATUS_CODE_SUCCESS; } // --------------------------------------------------------------------------------------------------------------------------------- template StatusCode MessageValidator::ValidateBinaryIntegralRange(T &value) { ACTIV_BOOST_STATIC_ASSERT((SIZE > 0) && (SIZE <= sizeof(uint64_t))); ACTIV_BOOST_STATIC_ASSERT(Boost::is_integral::value); const byte_t * const pNewNext = m_pNext + SIZE; if (ACTIV_UNLIKELY(pNewNext > m_pMessageEnd)) return STATUS_CODE_INVALID_PARAMETER; T to; StatusCode statusCode = CopyBinaryIntegralToBinaryIntegralT<(SIZE == sizeof(T)), Boost::is_signed::value, SIZE, ENDIAN, T>()(m_pNext, to); if (ACTIV_UNLIKELY(STATUS_CODE_SUCCESS != statusCode)) return statusCode; if (ACTIV_UNLIKELY((Less()(to))) || ACTIV_UNLIKELY((Greater()(to)))) return STATUS_CODE_OUT_OF_RANGE; m_pNext = pNewNext; value = to; return STATUS_CODE_SUCCESS; } // --------------------------------------------------------------------------------------------------------------------------------- template StatusCode MessageValidator::ValidateBinaryIntegralRange(const T lower, const T upper, T &value) { ACTIV_BOOST_STATIC_ASSERT((SIZE > 0) && (SIZE <= sizeof(uint64_t))); ACTIV_BOOST_STATIC_ASSERT(Boost::is_integral::value); const byte_t * const pNewNext = m_pNext + SIZE; if (ACTIV_UNLIKELY(pNewNext > m_pMessageEnd)) return STATUS_CODE_INVALID_PARAMETER; T to; StatusCode statusCode = CopyBinaryIntegralToBinaryIntegralT<(SIZE == sizeof(T)), Boost::is_signed::value, SIZE, ENDIAN, T>()(m_pNext, to); if (ACTIV_UNLIKELY(STATUS_CODE_SUCCESS != statusCode)) return statusCode; if (ACTIV_UNLIKELY(to < lower) || ACTIV_UNLIKELY(to > upper)) return STATUS_CODE_OUT_OF_RANGE; m_pNext = pNewNext; value = to; return STATUS_CODE_SUCCESS; } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateAsciiHexadecimalIntegralRange(const size_t size, const uint64_t lower, const uint64_t upper, const void *&pData) { uint64_t value; return ValidateAsciiHexadecimalIntegralRange(size, lower, upper, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateAsciiHexadecimalIntegralRange(const size_t size, const uint64_t lower, const uint64_t upper) { uint64_t value; return ValidateAsciiHexadecimalIntegralRange(size, lower, upper, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateAsciiHexadecimalIntegralSet(const size_t size, const std::vector &set, const void *&pData) { uint64_t value; return ValidateAsciiHexadecimalIntegralSet(size, set, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateAsciiHexadecimalIntegralSet(const size_t size, const std::vector &set) { uint64_t value; return ValidateAsciiHexadecimalIntegralSet(size, set, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateAsciiHexadecimalIntegralRangeCopy(const size_t size, const uint64_t lower, const uint64_t upper, void *pCopy) { uint64_t value; return ValidateAsciiHexadecimalIntegralRangeCopy(size, lower, upper, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateAsciiHexadecimalIntegralSetCopy(const size_t size, const std::vector &set, void *pCopy) { uint64_t value; return ValidateAsciiHexadecimalIntegralSetCopy(size, set, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateSignedAsciiIntegralRange(const size_t length, const int64_t lower, const int64_t upper, const void *&pData) { int64_t value; return ValidateSignedAsciiIntegralRange(length, lower, upper, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateSignedAsciiIntegralRange(const size_t length, const int64_t lower, const int64_t upper) { int64_t value; return ValidateSignedAsciiIntegralRange(length, lower, upper, value); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateSignedAsciiIntegralSet(const size_t length, const std::vector &set, const void *&pData) { int64_t value; return ValidateSignedAsciiIntegralSet(length, set, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateSignedAsciiIntegralSet(const size_t length, const std::vector &set) { int64_t value; return ValidateSignedAsciiIntegralSet(length, set, value); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateSignedAsciiIntegralRangeCopy(const size_t length, const int64_t lower, const int64_t upper, void *pCopy) { int64_t value; return ValidateSignedAsciiIntegralRangeCopy(length, lower, upper, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateSignedAsciiIntegralSetCopy(const size_t length, const std::vector &set, void *pCopy) { int64_t value; return ValidateSignedAsciiIntegralSetCopy(length, set, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateSignedAsciiRealRange(const size_t length, const long double lower, const long double upper, const void *&pData) { long double value; return ValidateSignedAsciiRealRangeT(length, lower, upper, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateSignedAsciiRealRange(const size_t length, const long double lower, const long double upper) { long double value; return ValidateSignedAsciiRealRangeT(length, lower, upper, value); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateSignedAsciiRealSet(const size_t length, const std::vector &set, const void *&pData) { long double value; return ValidateSignedAsciiRealSetT(length, set, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateSignedAsciiRealSet(const size_t length, const std::vector &set) { long double value; return ValidateSignedAsciiRealSetT(length, set, value); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateSignedAsciiRealRangeCopy(const size_t length, const long double lower, const long double upper, void *pCopy) { long double value; return ValidateSignedAsciiRealRangeCopyT(length, lower, upper, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateSignedAsciiRealSetCopy(const size_t length, const std::vector &set, void *pCopy) { long double value; return ValidateSignedAsciiRealSetCopyT(length, set, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedBinaryIntegralRange(const size_t size, const int64_t lower, const int64_t upper, const void *&pData) { int64_t value; return ValidateSignedBinaryIntegralRange(size, lower, upper, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedBinaryIntegralRange(const size_t size, const int64_t lower, const int64_t upper) { int64_t value; return ValidateSignedBinaryIntegralRange(size, lower, upper, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedBinaryIntegralSet(const size_t size, const std::vector &set, const void *&pData) { int64_t value; return ValidateSignedBinaryIntegralSet(size, set, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedBinaryIntegralSet(const size_t size, const std::vector &set) { int64_t value; return ValidateSignedBinaryIntegralSet(size, set, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedBinaryIntegralRangeCopy(const size_t size, const int64_t lower, const int64_t upper, void *pCopy) { int64_t value; return ValidateSignedBinaryIntegralRangeCopy(size, lower, upper, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedBinaryIntegralSetCopy(const size_t size, const std::vector &set, void *pCopy) { int64_t value; return ValidateSignedBinaryIntegralSetCopy(size, set, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateUnsignedAsciiIntegralRange(const size_t length, const uint64_t lower, const uint64_t upper, const void *&pData) { uint64_t value; return ValidateUnsignedAsciiIntegralRange(length, lower, upper, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateUnsignedAsciiIntegralRange(const size_t length, const uint64_t lower, const uint64_t upper) { uint64_t value; return ValidateUnsignedAsciiIntegralRange(length, lower, upper, value); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateUnsignedAsciiIntegralSet(const size_t length, const std::vector &set, const void *&pData) { uint64_t value; return ValidateUnsignedAsciiIntegralSet(length, set, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateUnsignedAsciiIntegralSet(const size_t length, const std::vector &set) { uint64_t value; return ValidateUnsignedAsciiIntegralSet(length, set, value); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateUnsignedAsciiIntegralRangeCopy(const size_t length, const uint64_t lower, const uint64_t upper, void *pCopy) { uint64_t value; return ValidateUnsignedAsciiIntegralRangeCopy(length, lower, upper, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateUnsignedAsciiIntegralSetCopy(const size_t length, const std::vector &set, void *pCopy) { uint64_t value; return ValidateUnsignedAsciiIntegralSetCopy(length, set, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateUnsignedAsciiRealRange(const size_t length, const long double lower, const long double upper, const void *&pData) { long double value; return ValidateUnsignedAsciiRealRange(length, lower, upper, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateUnsignedAsciiRealRange(const size_t length, const long double lower, const long double upper) { long double value; return ValidateUnsignedAsciiRealRange(length, lower, upper, value); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateUnsignedAsciiRealSet(const size_t length, const std::vector &set, const void *&pData) { long double value; return ValidateUnsignedAsciiRealSet(length, set, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateUnsignedAsciiRealSet(const size_t length, const std::vector &set) { long double value; return ValidateUnsignedAsciiRealSet(length, set, value); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateUnsignedAsciiRealRangeCopy(const size_t length, const long double lower, const long double upper, void *pCopy) { long double value; return ValidateUnsignedAsciiRealRangeCopy(length, lower, upper, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateUnsignedAsciiRealSetCopy(const size_t length, const std::vector &set, void *pCopy) { long double value; return ValidateUnsignedAsciiRealSetCopy(length, set, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedBinaryIntegralRange(const size_t size, const uint64_t lower, const uint64_t upper, const void *&pData) { uint64_t value; return ValidateUnsignedBinaryIntegralRange(size, lower, upper, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedBinaryIntegralRange(const size_t size, const uint64_t lower, const uint64_t upper) { uint64_t value; return ValidateUnsignedBinaryIntegralRange(size, lower, upper, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedBinaryIntegralSet(const size_t size, const std::vector &set, const void *&pData) { uint64_t value; return ValidateUnsignedBinaryIntegralSet(size, set, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedBinaryIntegralSet(const size_t size, const std::vector &set) { uint64_t value; return ValidateUnsignedBinaryIntegralSet(size, set, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedBinaryIntegralRangeCopy(const size_t size, const uint64_t lower, const uint64_t upper, void *pCopy) { uint64_t value; return ValidateUnsignedBinaryIntegralRangeCopy(size, lower, upper, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedBinaryIntegralSetCopy(const size_t size, const std::vector &set, void *pCopy) { uint64_t value; return ValidateUnsignedBinaryIntegralSetCopy(size, set, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::ValidateBoolean(bool &value) { uint8_t tempValue; ACTIV_RETURN_RESULT_IF_UNLIKELY(STATUS_CODE_SUCCESS, !=, (ValidateBinaryIntegral(tempValue))); value = (0 != tempValue); return STATUS_CODE_SUCCESS; } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateMessage(MESSAGE_TYPE &message) { return message.Deserialize(*this); } // --------------------------------------------------------------------------------------------------------------------------------- inline StatusCode MessageValidator::Get(const size_t offset, const void *&pData, const size_t length) const { if (ACTIV_UNLIKELY(0 == length)) return STATUS_CODE_SUCCESS; const byte_t * const pReturnedData = m_pMessage + offset; if (ACTIV_UNLIKELY((pReturnedData + length) > m_pMessageEnd)) return STATUS_CODE_INVALID_PARAMETER; pData = pReturnedData; return STATUS_CODE_SUCCESS; } // --------------------------------------------------------------------------------------------------------------------------------- template StatusCode MessageValidator::CopyAsciiHexadecimalIntegralToUnsignedBinaryIntegral(T &to, const void * const pData, size_t size) { if (ACTIV_UNLIKELY(0 != (size % 2)) || ACTIV_UNLIKELY(size > (2 * sizeof(uint64_t)))) return STATUS_CODE_INVALID_PARAMETER; uint64_t value; try { value = CopyAsciiHexadecimalIntegralToUnsignedBinaryIntegralT()(pData, size); } catch (const StatusCode statusCode) { return statusCode; } if (ACTIV_UNLIKELY(value > Boost::integer_traits::const_max)) return STATUS_CODE_OUT_OF_RANGE; to = static_cast(value); return STATUS_CODE_SUCCESS; } // --------------------------------------------------------------------------------------------------------------------------------- template StatusCode MessageValidator::CopySignedAsciiIntegralToSignedBinaryIntegral(T &to, const void * const pData, size_t length) { if (ACTIV_LIKELY(length > 0)) { return CopySignedAsciiIntegralToSignedBinaryIntegralInternal(to, pData, length); } else { to = 0; return STATUS_CODE_SUCCESS; } } // --------------------------------------------------------------------------------------------------------------------------------- template StatusCode MessageValidator::CopySignedAsciiRealToBinaryReal(T &to, const void * const pData, size_t length) { int64_t numerator; uint64_t divisor; ACTIV_RETURN_RESULT_IF_UNLIKELY(STATUS_CODE_SUCCESS, !=, CopySignedAsciiRealToNumeratorAndDivisor(numerator, divisor, pData, length)); to = static_cast(numerator) / static_cast(divisor); return STATUS_CODE_SUCCESS; } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::CopySignedAsciiIntegralToSignedBinaryIntegralInternal(T &to, const void * const pData, size_t length) { assert(length > 0); const byte_t * const pDataBuffer = static_cast(pData); const byte_t firstByte(*pDataBuffer); if (ACTIV_LIKELY('-' != firstByte)) { if ('+' == firstByte) return CopyPositiveAsciiIntegralToSignedBinaryIntegral(to, pDataBuffer + 1, length - 1); else return CopyPositiveAsciiIntegralToSignedBinaryIntegral(to, pDataBuffer, length); } else { return CopyNegativeAsciiIntegralToSignedBinaryIntegral(to, pDataBuffer + 1, length - 1); } } // --------------------------------------------------------------------------------------------------------------------------------- template StatusCode MessageValidator::CopyPositiveAsciiIntegralToSignedBinaryIntegral(T &to, const void * const pData, size_t length) { const byte_t *pByte = static_cast(pData); const byte_t * const pEnd = pByte + length; int64_t value = 0; if (ACTIV_LIKELY(length <= static_cast(Boost::integer_traits::digits10))) { for (; pByte < pEnd; ++pByte) { const byte_t thisDigit(*pByte - byte_t('0')); if (ACTIV_LIKELY(thisDigit <= 9)) value = (value * 10) + static_cast(thisDigit); else return STATUS_CODE_INVALID_FORMAT; } } else { for (size_t i = 0; pByte < pEnd; ++pByte, ++i) { const byte_t thisDigit(*pByte - byte_t('0')); if (ACTIV_LIKELY(thisDigit <= 9)) { if (ACTIV_UNLIKELY(i >= static_cast(Boost::integer_traits::digits10))) { if (ACTIV_UNLIKELY( value > ((Boost::integer_traits::const_max - static_cast(thisDigit)) / 10))) { return STATUS_CODE_OUT_OF_RANGE; } } value = (value * 10) + static_cast(thisDigit); } else { return STATUS_CODE_INVALID_FORMAT; } } } if (ACTIV_UNLIKELY(value > Boost::integer_traits::const_max)) return STATUS_CODE_OUT_OF_RANGE; to = static_cast(value); return STATUS_CODE_SUCCESS; } // --------------------------------------------------------------------------------------------------------------------------------- template StatusCode MessageValidator::CopyNegativeAsciiIntegralToSignedBinaryIntegral(T &to, const void * const pData, size_t length) { const byte_t *pByte = static_cast(pData); const byte_t * const pEnd = pByte + length; int64_t value = 0; if (ACTIV_LIKELY(length <= static_cast(Boost::integer_traits::digits10))) { for (size_t i = 0; pByte < pEnd; ++pByte, ++i) { const byte_t thisDigit(*pByte - byte_t('0')); if (ACTIV_LIKELY(thisDigit <= 9)) value = (value * 10) - static_cast(thisDigit); else return STATUS_CODE_INVALID_FORMAT; } } else { for (size_t i = 0; i < length; ++i) { const byte_t thisDigit(*pByte - byte_t('0')); if (ACTIV_LIKELY(thisDigit <= 9)) { if (ACTIV_UNLIKELY(i >= static_cast(Boost::integer_traits::digits10))) { if (ACTIV_UNLIKELY( value < ((Boost::integer_traits::const_min + static_cast(thisDigit)) / 10))) { return STATUS_CODE_OUT_OF_RANGE; } } value = (value * 10) - static_cast(thisDigit); } else { return STATUS_CODE_INVALID_FORMAT; } } } if (ACTIV_UNLIKELY(value < Boost::integer_traits::const_min)) return STATUS_CODE_OUT_OF_RANGE; to = static_cast(value); return STATUS_CODE_SUCCESS; } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::CopySignedBinaryIntegralToSignedBinaryIntegral(T &to, const void * const pData, size_t size) { return CopyBinaryIntegralToBinaryIntegralRtlT()(pData, size, to); } // --------------------------------------------------------------------------------------------------------------------------------- template StatusCode MessageValidator::CopyUnsignedAsciiIntegralToUnsignedBinaryIntegral(T &to, const void * const pData, size_t length) { const byte_t * const pDataBuffer = static_cast(pData); uint64_t value = 0; // If fewer digits than the maximum digits in a uint64_t, then we know we can't overflow. if (ACTIV_LIKELY(length <= static_cast(Boost::integer_traits::digits10))) { for (size_t i = 0; i < length; ++i) { const byte_t thisDigit = pDataBuffer[i] - byte_t('0'); if (ACTIV_LIKELY(thisDigit <= 9)) value = (value * 10) + static_cast(thisDigit); else return STATUS_CODE_INVALID_FORMAT; } } else { for (size_t i = 0; i < length; ++i) { const byte_t thisDigit = pDataBuffer[i] - byte_t('0'); const uint64_t oldValue = value; if (ACTIV_LIKELY(thisDigit <= 9)) value = (value * 10) + static_cast(thisDigit); else return STATUS_CODE_INVALID_FORMAT; if (ACTIV_UNLIKELY(value < oldValue)) return STATUS_CODE_OUT_OF_RANGE; } } if (ACTIV_UNLIKELY(value > Boost::integer_traits::const_max)) return STATUS_CODE_OUT_OF_RANGE; to = static_cast(value); return STATUS_CODE_SUCCESS; } // --------------------------------------------------------------------------------------------------------------------------------- template StatusCode MessageValidator::CopyUnsignedAsciiRealToBinaryReal(T &to, const void * const pData, size_t length) { uint64_t numerator; uint64_t divisor; ACTIV_RETURN_RESULT_IF_UNLIKELY(STATUS_CODE_SUCCESS, !=, CopyUnsignedAsciiRealToNumeratorAndDivisor(numerator, divisor, pData, length)); to = static_cast(numerator) / static_cast(divisor); return STATUS_CODE_SUCCESS; } // --------------------------------------------------------------------------------------------------------------------------------- template StatusCode MessageValidator::CopyUnsignedBinaryIntegralToUnsignedBinaryIntegral(T &to, const void * const pData, size_t size) { return CopyBinaryIntegralToBinaryIntegralRtlT()(pData, size, to); } // --------------------------------------------------------------------------------------------------------------------------------- template StatusCode MessageValidator::CopySignedBinaryIntegralToSignedBinaryIntegralInternal(T &to, const void * const pData, size_t size) { ACTIV_BOOST_STATIC_ASSERT(Boost::is_signed::value); if (ACTIV_LIKELY(size <= sizeof(T))) { // Fast path when we can guarantee the value will fit in the target. switch (size) { case sizeof(int8_t): to = static_cast(GetValueFromUnalignedPointerInEndianT()(pData)); return STATUS_CODE_SUCCESS; case sizeof(int16_t): to = static_cast(GetValueFromUnalignedPointerInEndianT()(pData)); return STATUS_CODE_SUCCESS; case sizeof(int32_t): to = static_cast(GetValueFromUnalignedPointerInEndianT()(pData)); return STATUS_CODE_SUCCESS; case sizeof(int64_t): to = static_cast(GetValueFromUnalignedPointerInEndianT()(pData)); return STATUS_CODE_SUCCESS; default: break; } } else if (ACTIV_UNLIKELY(size > sizeof(int64_t))) { return STATUS_CODE_INVALID_PARAMETER; } const byte_t * const pDataBuffer = static_cast(pData); int64_t value = 0; if (ENDIAN_LITTLE == ENDIAN) { for (size_t i = 0; i < size; ++i) { value |= static_cast(pDataBuffer[i]) << (i * CHAR_BIT); } } else // (ENDIAN_BIG == ENDIAN) { for (size_t i = 0; i < size; ++i) { value |= static_cast(pDataBuffer[i]) << ((size - i - 1) * CHAR_BIT); } } if ((sizeof(int64_t) != size) && (value & (INT64_C(1) << (((size - 1) * CHAR_BIT) + (CHAR_BIT - 1))))) { #if (defined ACTIV_COMPILER_GCC) && (ACTIV_GCC_COMPILER_VERSION >= ACTIV_MAKE_GCC_COMPILER_VERSION(9, 0)) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wshift-negative-value" #endif value |= ((INT64_C(-1) >> ((sizeof(int64_t) - size) * CHAR_BIT)) << (size * CHAR_BIT)); #if (defined ACTIV_COMPILER_GCC) && (ACTIV_GCC_COMPILER_VERSION >= ACTIV_MAKE_GCC_COMPILER_VERSION(9, 0)) #pragma GCC diagnostic pop #endif } if (ACTIV_UNLIKELY(value < Boost::integer_traits::const_min) || ACTIV_UNLIKELY(value > Boost::integer_traits::const_max)) return STATUS_CODE_OUT_OF_RANGE; to = static_cast(value); return STATUS_CODE_SUCCESS; } // --------------------------------------------------------------------------------------------------------------------------------- template StatusCode MessageValidator::CopyUnsignedBinaryIntegralToUnsignedBinaryIntegralInternal(T &to, const void * const pData, size_t size) { ACTIV_BOOST_STATIC_ASSERT(!Boost::is_signed::value); if (ACTIV_LIKELY(size <= sizeof(T))) { // Fast path when we can guarantee the value will fit in the target. switch (size) { case sizeof(uint8_t): to = static_cast(GetValueFromUnalignedPointerInEndianT()(pData)); return STATUS_CODE_SUCCESS; case sizeof(uint16_t): to = static_cast(GetValueFromUnalignedPointerInEndianT()(pData)); return STATUS_CODE_SUCCESS; case sizeof(uint32_t): to = static_cast(GetValueFromUnalignedPointerInEndianT()(pData)); return STATUS_CODE_SUCCESS; case sizeof(uint64_t): to = static_cast(GetValueFromUnalignedPointerInEndianT()(pData)); return STATUS_CODE_SUCCESS; default: break; } } else if (ACTIV_UNLIKELY(size > sizeof(uint64_t))) { return STATUS_CODE_INVALID_PARAMETER; } const byte_t * const pDataBuffer = static_cast(pData); uint64_t value = 0; if (ENDIAN_LITTLE == ENDIAN) { for (size_t i = 0; i < size; ++i) { value |= static_cast(pDataBuffer[i]) << (i * CHAR_BIT); } } else // (ENDIAN_BIG == ENDIAN) { for (size_t i = 0; i < size; ++i) { value |= static_cast(pDataBuffer[i]) << ((size - i - 1) * CHAR_BIT); } } if (ACTIV_UNLIKELY(value > Boost::integer_traits::const_max)) return STATUS_CODE_OUT_OF_RANGE; to = static_cast(value); return STATUS_CODE_SUCCESS; } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateAsciiHexadecimalIntegral(const size_t size, T &value, const void *&pData) { return ValidateAsciiHexadecimalIntegralT(size, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateAsciiHexadecimalIntegral(const size_t size, T &value) { return ValidateAsciiHexadecimalIntegralT(size, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateAsciiHexadecimalIntegralRange(const size_t size, const uint64_t lower, const uint64_t upper, T &value, const void *&pData) { return ValidateAsciiHexadecimalIntegralRangeT(size, lower, upper, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateAsciiHexadecimalIntegralRange(const size_t size, const uint64_t lower, const uint64_t upper, T &value) { return ValidateAsciiHexadecimalIntegralRangeT(size, lower, upper, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateAsciiHexadecimalIntegralSet(const size_t size, const std::vector &set, T &value, const void *&pData) { return ValidateAsciiHexadecimalIntegralSetT(size, set, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateAsciiHexadecimalIntegralSet(const size_t size, const std::vector &set, T &value) { return ValidateAsciiHexadecimalIntegralSetT(size, set, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateAsciiHexadecimalIntegralCopy(const size_t size, T &value, void *pCopy) { return ValidateAsciiHexadecimalIntegralCopyT(size, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateAsciiHexadecimalIntegralRangeCopy(const size_t size, const uint64_t lower, const uint64_t upper, T &value, void *pCopy) { return ValidateAsciiHexadecimalIntegralRangeCopyT(size, lower, upper, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateAsciiHexadecimalIntegralSetCopy(const size_t size, const std::vector &set, T &value, void *pCopy) { return ValidateAsciiHexadecimalIntegralSetCopyT(size, set, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedAsciiIntegral(const size_t length, T &value, const void *&pData) { return ValidateSignedAsciiIntegralT(length, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedAsciiIntegral(const size_t length, T &value) { return ValidateSignedAsciiIntegralT(length, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedAsciiIntegralRange(const size_t length, const int64_t lower, const int64_t upper, T &value, const void *&pData) { return ValidateSignedAsciiIntegralRangeT(length, lower, upper, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedAsciiIntegralRange(const size_t length, const int64_t lower, const int64_t upper, T &value) { return ValidateSignedAsciiIntegralRangeT(length, lower, upper, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedAsciiIntegralSet(const size_t length, const std::vector &set, T &value, const void *&pData) { return ValidateSignedAsciiIntegralSetT(length, set, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedAsciiIntegralSet(const size_t length, const std::vector &set, T &value) { return ValidateSignedAsciiIntegralSetT(length, set, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedAsciiIntegralCopy(const size_t length, T &value, void *pCopy) { return ValidateSignedAsciiIntegralCopyT(length, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedAsciiIntegralRangeCopy(const size_t length, const int64_t lower, const int64_t upper, T &value, void *pCopy) { return ValidateSignedAsciiIntegralRangeCopyT(length, lower, upper, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedAsciiIntegralSetCopy(const size_t length, const std::vector &set, T &value, void *pCopy) { return ValidateSignedAsciiIntegralSetCopyT(length, set, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedAsciiReal(const size_t length, T &value, const void *&pData) { return ValidateSignedAsciiRealT(length, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedAsciiReal(const size_t length, T &value) { return ValidateSignedAsciiRealT(length, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedAsciiRealRange(const size_t length, const long double lower, const long double upper, T &value, const void *&pData) { return ValidateSignedAsciiRealRangeT(length, lower, upper, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedAsciiRealRange(const size_t length, const long double lower, const long double upper, T &value) { return ValidateSignedAsciiRealRangeT(length, lower, upper, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedAsciiRealSet(const size_t length, const std::vector &set, T &value, const void *&pData) { return ValidateSignedAsciiRealSetT(length, set, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedAsciiRealSet(const size_t length, const std::vector &set, T &value) { return ValidateSignedAsciiRealSetT(length, set, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedAsciiRealCopy(const size_t length, T &value, void *pCopy) { return ValidateSignedAsciiRealCopyT(length, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedAsciiRealRangeCopy(const size_t length, const long double lower, const long double upper, T &value, void *pCopy) { return ValidateSignedAsciiRealRangeCopyT(length, lower, upper, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedAsciiRealSetCopy(const size_t length, const std::vector &set, T &value, void *pCopy) { return ValidateSignedAsciiRealSetCopyT(length, set, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedBinaryIntegral(const size_t size, T &value, const void *&pData) { return ValidateSignedBinaryIntegralT(size, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedBinaryIntegral(const size_t size, T &value) { return ValidateSignedBinaryIntegralT(size, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedBinaryIntegralRange(const size_t size, const int64_t lower, const int64_t upper, T &value, const void *&pData) { return ValidateSignedBinaryIntegralRangeT(size, lower, upper, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedBinaryIntegralRange(const size_t size, const int64_t lower, const int64_t upper, T &value) { return ValidateSignedBinaryIntegralRangeT(size, lower, upper, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedBinaryIntegralSet(const size_t size, const std::vector &set, T &value, const void *&pData) { return ValidateSignedBinaryIntegralSetT(size, set, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedBinaryIntegralSet(const size_t size, const std::vector &set, T &value) { return ValidateSignedBinaryIntegralSetT(size, set, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedBinaryIntegralCopy(const size_t size, T &value, void *pCopy) { return ValidateSignedBinaryIntegralCopyT(size, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedBinaryIntegralRangeCopy(const size_t size, const int64_t lower, const int64_t upper, T &value, void *pCopy) { return ValidateSignedBinaryIntegralRangeCopyT(size, lower, upper, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateSignedBinaryIntegralSetCopy(const size_t size, const std::vector &set, T &value, void *pCopy) { return ValidateSignedBinaryIntegralSetCopyT(size, set, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedAsciiIntegral(const size_t length, T &value, const void *&pData) { return ValidateUnsignedAsciiIntegralT(length, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedAsciiIntegral(const size_t length, T &value) { return ValidateUnsignedAsciiIntegralT(length, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedAsciiIntegralRange(const size_t length, const uint64_t lower, const uint64_t upper, T &value, const void *&pData) { return ValidateUnsignedAsciiIntegralRangeT(length, lower, upper, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedAsciiIntegralRange(const size_t length, const uint64_t lower, const uint64_t upper, T &value) { return ValidateUnsignedAsciiIntegralRangeT(length, lower, upper, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedAsciiIntegralSet(const size_t length, const std::vector &set, T &value, const void *&pData) { return ValidateUnsignedAsciiIntegralSetT(length, set, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedAsciiIntegralSet(const size_t length, const std::vector &set, T &value) { return ValidateUnsignedAsciiIntegralSetT(length, set, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedAsciiIntegralCopy(const size_t length, T &value, void *pCopy) { return ValidateUnsignedAsciiIntegralCopyT(length, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedAsciiIntegralRangeCopy(const size_t length, const uint64_t lower, const uint64_t upper, T &value, void *pCopy) { return ValidateUnsignedAsciiIntegralRangeCopyT(length, lower, upper, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedAsciiIntegralSetCopy(const size_t length, const std::vector &set, T &value, void *pCopy) { return ValidateUnsignedAsciiIntegralSetCopyT(length, set, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedAsciiReal(const size_t length, T &value, const void *&pData) { return ValidateUnsignedAsciiRealT(length, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedAsciiReal(const size_t length, T &value) { return ValidateUnsignedAsciiRealT(length, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedAsciiRealRange(const size_t length, const long double lower, const long double upper, T &value, const void *&pData) { return ValidateUnsignedAsciiRealRangeT(length, lower, upper, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedAsciiRealRange(const size_t length, const long double lower, const long double upper, T &value) { return ValidateUnsignedAsciiRealRangeT(length, lower, upper, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedAsciiRealSet(const size_t length, const std::vector &set, T &value, const void *&pData) { return ValidateUnsignedAsciiRealSetT(length, set, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedAsciiRealSet(const size_t length, const std::vector &set, T &value) { return ValidateUnsignedAsciiRealSetT(length, set, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedAsciiRealCopy(const size_t length, T &value, void *pCopy) { return ValidateUnsignedAsciiRealCopyT(length, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedAsciiRealRangeCopy(const size_t length, const long double lower, const long double upper, T &value, void *pCopy) { return ValidateUnsignedAsciiRealRangeCopyT(length, lower, upper, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedAsciiRealSetCopy(const size_t length, const std::vector &set, T &value, void *pCopy) { return ValidateUnsignedAsciiRealSetCopyT(length, set, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedBinaryIntegral(const size_t size, T &value, const void *&pData) { return ValidateUnsignedBinaryIntegralT(size, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedBinaryIntegral(const size_t size, T &value) { return ValidateUnsignedBinaryIntegralT(size, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedBinaryIntegralRange(const size_t size, const uint64_t lower, const uint64_t upper, T &value, const void *&pData) { return ValidateUnsignedBinaryIntegralRangeT(size, lower, upper, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedBinaryIntegralRange(const size_t size, const uint64_t lower, const uint64_t upper, T &value) { return ValidateUnsignedBinaryIntegralRangeT(size, lower, upper, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedBinaryIntegralSet(const size_t size, const std::vector &set, T &value, const void *&pData) { return ValidateUnsignedBinaryIntegralSetT(size, set, value, pData); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedBinaryIntegralSet(const size_t size, const std::vector &set, T &value) { return ValidateUnsignedBinaryIntegralSetT(size, set, value); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedBinaryIntegralCopy(const size_t size, T &value, void *pCopy) { return ValidateUnsignedBinaryIntegralCopyT(size, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedBinaryIntegralRangeCopy(const size_t size, const uint64_t lower, const uint64_t upper, T &value, void *pCopy) { return ValidateUnsignedBinaryIntegralRangeCopyT(size, lower, upper, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- template inline StatusCode MessageValidator::ValidateUnsignedBinaryIntegralSetCopy(const size_t size, const std::vector &set, T &value, void *pCopy) { return ValidateUnsignedBinaryIntegralSetCopyT(size, set, value, pCopy); } // --------------------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------------------- template class MessageValidator::GetValueFromUnalignedPointerInEndianT { public: T operator()(const void * const pData) const { return GetValueFromUnalignedPointer(pData); } }; // --------------------------------------------------------------------------------------------------------------------------------- template class MessageValidator::GetValueFromUnalignedPointerInEndianT { public: T operator()(const void * const pData) const { return ByteSwap(GetValueFromUnalignedPointer(pData)); } }; // --------------------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------------------- template class MessageValidator::CopyBinaryIntegralToBinaryIntegralT { public: StatusCode operator()(const void * const pData, T &value) const { return CopySignedBinaryIntegralToSignedBinaryIntegralInternal(value, pData, SIZE); } }; // --------------------------------------------------------------------------------------------------------------------------------- template class MessageValidator::CopyBinaryIntegralToBinaryIntegralT { public: StatusCode operator()(const void * const pData, T &value) const { return CopyUnsignedBinaryIntegralToUnsignedBinaryIntegralInternal(value, pData, SIZE); } }; // --------------------------------------------------------------------------------------------------------------------------------- template class MessageValidator::CopyBinaryIntegralToBinaryIntegralT { public: StatusCode operator()(const void * const pData, T &value) const { ACTIV_BOOST_STATIC_ASSERT(SIZE == sizeof(T)); value = GetValueFromUnalignedPointerInEndianT()(pData); return STATUS_CODE_SUCCESS; } }; // --------------------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------------------- template class MessageValidator::CopyBinaryIntegralToBinaryIntegralRtlT { public: StatusCode operator()(const void * const pData, const size_t size, T &value) const { // NB intentionally no LIKELYs here. if (sizeof(T) == size) { // Fast path for "normal" case. value = GetValueFromUnalignedPointerInEndianT()(pData); return STATUS_CODE_SUCCESS; } return CopySignedBinaryIntegralToSignedBinaryIntegralInternal(value, pData, size); } }; // --------------------------------------------------------------------------------------------------------------------------------- template class MessageValidator::CopyBinaryIntegralToBinaryIntegralRtlT { public: StatusCode operator()(const void * const pData, const size_t size, T &value) const { // NB intentionally no LIKELYs here. if (sizeof(T) == size) { // Fast path for "normal" case. value = GetValueFromUnalignedPointerInEndianT()(pData); return STATUS_CODE_SUCCESS; } return CopyUnsignedBinaryIntegralToUnsignedBinaryIntegralInternal(value, pData, size); } }; // --------------------------------------------------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------------------------------------------------- template<> class MessageValidator::CopyAsciiHexadecimalIntegralToUnsignedBinaryIntegralT { public: ACTIV_BASE_API uint64_t operator()(const void * const pData, size_t length) const; }; // --------------------------------------------------------------------------------------------------------------------------------- template<> class MessageValidator::CopyAsciiHexadecimalIntegralToUnsignedBinaryIntegralT { public: ACTIV_BASE_API uint64_t operator()(const void * const pData, size_t length) const; }; } // namespace Activ #endif // (!defined ACTIV_BASE_MESSAGE_VALIDATOR_H)