• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Product
    • Design UI
    • Develop
    • Analyze and test
    • Deploy
    • Framework and toolbox
    • Compatibility
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Framework - CDP Core
  • CDPUtils
  • 4.11.14

CDPUtils Class

The CDPUtils provides utility like free functions for all around use. More...

Header: #include <Generic/CDPUtils.h>
  • List of all members, including inherited members

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> &params)
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 &params)
std::string StripTemplate(const std::string &name)

Detailed Description

The CDPUtils provides utility like free functions for all around use.

Member Type Documentation

typedef CDPUtils::Parameter

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&lt;double&gt;")=="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> &params)

[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 &lt; with < and &gt; with >

[static] std::vector<CDPUtils::Parameter> CDPUtils::SplitParameters(const std::string &params)

[static] std::string CDPUtils::StripTemplate(const std::string &name)

Strips the template brackets at the end of name if found. Handles both '&lt;&gt;' and '<>'.

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

    © Copyright 2022 CDP Technologies. Privacy and cookie policy.

    Return to top