CDPUtils Class
The CDPUtils provides utility like free functions for all around use. More...
Header: | #include <Generic/CDPUtils.h> |
Public Types
typedef | Parameter |
Static Public Members
unsigned short | CRC16(unsigned char *puchMsg, unsigned short usDataLen) |
timeval | ConvertMsToTimeval(int ms) |
std::string | EscapeQuotation(const std::string &input) |
std::string | GetBufferDataAsHexadecimalString(const unsigned char *buffer, unsigned int len) |
std::string | GetModelFileNameFromModelName(const std::string &modelName) |
std::string | GetTypeFromTypeName(const std::string &typeName) |
unsigned int | Hash32(const char *string, unsigned short dataLen) |
bool | IsContainedIn(std::string element, std::string container, std::string separatorChar) |
std::string | JoinParameters(const std::vector<CDPUtils::Parameter> ¶ms) |
double | NormalizedRadDegree(double degree) |
double | NormalizedRadDegreeDiff(double degreeFrom, double degreeTo) |
std::string | ReplaceAll(const std::string &stringToReplaceIn, const std::string &from, const std::string &to) |
std::string | ReplaceLessThanGreaterThan(std::string strName) |
std::vector<CDPUtils::Parameter> | SplitParameters(const std::string ¶ms) |
std::string | StripTemplate(const std::string &name) |
Detailed Description
The CDPUtils provides utility like free functions for all around use.
Member Function Documentation
[static]
unsigned short CDPUtils::CRC16(unsigned char *puchMsg, unsigned short usDataLen)
16-bit Cyclic Redundancy Check CRC16(pmsg,nDataLen) - computes CRC of modbus serial RTU message. The function returns the CRC as a unsigned short type. CRC should be performed on the entire message (excluding the crc of course).
[static]
timeval CDPUtils::ConvertMsToTimeval(int ms)
Converts the time in milliseconds to a timeval struct.
[static]
std::string CDPUtils::EscapeQuotation(const std::string &input)
[static]
std::string CDPUtils::GetBufferDataAsHexadecimalString(const unsigned char *buffer, unsigned int len)
[static]
std::string CDPUtils::GetModelFileNameFromModelName(const std::string &modelName)
Returns the model filename for the model (as it is stored on disk, without .xml ending). Example:
assert( GetModelFileNameFromModelName("CDPSignal<double>")=="CDPSignal_double" ); assert( GetModelFileNameFromModelName("CDPOperator<bool>")=="CDPOperator_bool" );
[static]
std::string CDPUtils::GetTypeFromTypeName(const std::string &typeName)
[static]
unsigned int CDPUtils::Hash32(const char *string, unsigned short dataLen)
Generates a 32 bit hash from a string of characters of length dataLen with Murmur2 hash algorithm
[static]
bool CDPUtils::IsContainedIn(std::string element, std::string container, std::string separatorChar)
Finds whether an element appears within a container.
[static]
std::string CDPUtils::JoinParameters(const std::vector<CDPUtils::Parameter> ¶ms)
[static]
double CDPUtils::NormalizedRadDegree(double degree)
[static]
double CDPUtils::NormalizedRadDegreeDiff(double degreeFrom, double degreeTo)
[static]
std::string CDPUtils::ReplaceAll(const std::string &stringToReplaceIn, const std::string &from, const std::string &to)
Replaces character from with string to based on a string stringToReplaceIn. Returns new string where replacments have been done.
[static]
std::string CDPUtils::ReplaceLessThanGreaterThan(std::string strName)
Replaces < with < and > with >
[static]
std::vector<CDPUtils::Parameter> CDPUtils::SplitParameters(const std::string ¶ms)
[static]
std::string CDPUtils::StripTemplate(const std::string &name)
Strips the template brackets at the end of name if found. Handles both '<>' and '<>'.
Get started with CDP Studio today
Let us help you take your great ideas and turn them into the products your customer will love.