Developer Application Interface (ARC API) v3.6.2
ARC, Inc. GenII/III Application Interface
arc::gen3::CArcBase Class Reference

#include <CArcBase.h>

Inheritance diagram for arc::gen3::CArcBase:
arc::gen3::CArcDeinterlace< T > arc::gen3::CArcDisplay arc::gen3::CArcFitsFile< T > arc::gen3::CArcImage< T > arc::gen3::CArcPluginManager arc::gen3::CArcSystem arc::gen3::IArcPlugin

Public Member Functions

virtual ~CArcBase (void)
 

Static Public Member Functions

static const std::string version (void)
 
static void zeroMemory (void *pDest, const std::size_t uiSize)
 
static void copyMemory (void *pDest, void *pSrc, const std::size_t uiSize)
 
static void throwOutOfRange (const std::string &sMethodName, const std::int32_t iLine, const std::uint32_t uiElement, std::pair< std::uint32_t, std::uint32_t > range)
 
static void throwOutOfRange (const std::string &sMethodName, const std::int32_t iLine, const std::string &sElement, const std::size_t uiSize)
 
static void throwNoDeviceError (const std::string &sMethodName, const std::int32_t iLine, const std::string &sMsg="")
 
template<typename T = std::runtime_error>
static void throwException (const std::string &sMethodName, const std::int32_t iLine, const std::string &sMsg)
 
template<typename T = std::runtime_error>
static void throwException (const std::string &sMethodName, const std::int32_t iLine, const char *pszFmt,...)
 
template<typename ErrCode >
requires std::is_integral_v<ErrCode>
static const std::string getSystemMessage (ErrCode iCode)
 
static std::int32_t getSystemError (void) noexcept
 
static std::unique_ptr< CArcStringListsplitString (const std::string &sString, const char &zDelim=' ')
 
static std::string formatString (const char *pszFmt,...)
 
static std::string convertWideToAnsi (wchar_t wzString[]) noexcept
 
static std::string convertWideToAnsi (const std::wstring &wsString)
 
static std::wstring convertAnsiToWide (const char *pszString)
 
static std::string cmdToString (const std::uint32_t uiCmd)
 
static std::string cmdToString (const std::uint32_t uiReply, const std::initializer_list< std::uint32_t > &tCmdList)
 
static std::string setDots (std::string_view svText, const std::size_t uiMaxLength, const char szDot='.')
 
template<typename T >
static std::string iterToString (T *pBegin, T *pEnd, char zSeperator=' ')
 

Protected Member Functions

 CArcBase (void)=default
 
 CArcBase (const CArcBase &)=delete
 
 CArcBase (CArcBase &&)=delete
 
CArcBaseoperator= (const CArcBase &)=delete
 
CArcBaseoperator= (CArcBase &&)=delete
 

Static Protected Attributes

static const std::string m_sVersion
 

Detailed Description

Standard ARC device base class that makes a set of useful methods available to all subclasses. Class methods include throwing formatted exceptions, ascii to string command conversion, error uiCode formatting and character conversion ( unicode to ascii and vice versa ).

Constructor & Destructor Documentation

◆ ~CArcBase()

arc::gen3::CArcBase::~CArcBase ( void  )
virtual

Destructor

◆ CArcBase() [1/3]

arc::gen3::CArcBase::CArcBase ( void  )
protecteddefault

Default constructor

◆ CArcBase() [2/3]

arc::gen3::CArcBase::CArcBase ( const CArcBase )
protecteddelete

Delete copy constructor

◆ CArcBase() [3/3]

arc::gen3::CArcBase::CArcBase ( CArcBase &&  )
protecteddelete

Delete move constructor

Member Function Documentation

◆ cmdToString() [1/2]

std::string arc::gen3::CArcBase::cmdToString ( const std::uint32_t  uiCmd)
static

Converts a device or controller ascii command to a string represented by changing each each byte to its ascii letter equivalent. This is useful for logging human readable versions of a command. For example, 0x54444C would be converted to "TDL". If the command fails to be converted, then the hexadecimal value is returned as a string. For example, 0x212223 would be returned as "0x212223" and not "!*#".

Parameters
uiCmd- A device or controller ascii command.
Returns
A string version of the command parameter.

◆ cmdToString() [2/2]

std::string arc::gen3::CArcBase::cmdToString ( const std::uint32_t  uiReply,
const std::initializer_list< std::uint32_t > &  tCmdList 
)
static

Converts a device or controller ascii command to a string represented by changing each each byte to its ascii letter equivalent. This is useful for logging human readable versions of a command. For example, 0x54444C would be converted to "TDL". If the command fails to be converted, then the hexadecimal value is returned as a string. For example, 0x212223 would be returned as "0x212223" and not "!*#".

Parameters
uiCmd- A controller ascii command reply value.
tCmdList- The controller ascii command list.
Returns
A string version of the command parameter.

◆ convertAnsiToWide()

std::wstring arc::gen3::CArcBase::convertAnsiToWide ( const char *  pszString)
static

Converts an ansi string to a unicode string.

Parameters
pszString- The ansi string to convert.
Returns
A unicode string version of the ansi string parameter.

◆ convertWideToAnsi() [1/2]

std::string arc::gen3::CArcBase::convertWideToAnsi ( const std::wstring &  wsString)
static

Converts a unicode string to an ansi string.

Parameters
wsString- The unicode string to convert.
Returns
An ansi string version of the unicode string parameter.

◆ convertWideToAnsi() [2/2]

std::string arc::gen3::CArcBase::convertWideToAnsi ( wchar_t  wzString[])
staticnoexcept

Converts a unicode character array to an ansi string.

Parameters
wzString- The unicode character array to convert.
Returns
An ansi string version of the unicode array parameter.

◆ copyMemory()

void arc::gen3::CArcBase::copyMemory ( void *  pDest,
void *  pSrc,
const std::size_t  uiSize 
)
static

Copies the source buffer into the destination buffer.

Parameters
pDest- Pointer to the destination buffer to copy into.
pSrc- Pointer to the source buffer to copy out of.
uiSize- The size of the buffers ( in bytes ).
Exceptions
std::invalid_argumentif arguments are invalid.

◆ formatString()

std::string arc::gen3::CArcBase::formatString ( const char *  pszFmt,
  ... 
)
static

Formats a std::string using printf-style formatting. Acceptable format string specifiers:

          Acceptable format string specifiers:
          %u   -> unsigned integer
          %d   -> integer
          %f   -> double
          %l   -> long
          %j   -> unsigned long
          %J   -> unsigned long long
          %s   -> char * string
          %e   -> system message (as returned by errno or GetLastError)
          %x/X -> lower/upper case hexadecimal integer.
Parameters
pszFmt- A printf-style format string. See above for specifiers.
...- Arguments to fill in format string specifiers.
Returns
A string formatted using the specified parameters.

◆ getSystemError()

static std::int32_t arc::gen3::CArcBase::getSystemError ( void  )
inlinestaticnoexcept

Returns the current system error code.

Returns
The current system error code (GetLastError() on windows, errno on linux).

◆ getSystemMessage()

template<typename ErrCode >
requires std::is_integral_v<ErrCode>
static const std::string arc::gen3::CArcBase::getSystemMessage ( ErrCode  iCode)
inlinestatic

Returns a string that represents the specified system error uiCode.

Parameters
uiCode/iCode- The system specific error uiCode ( GetLastError() on windows, errno on linux/mac ).
Returns
A string that represents the error message assoctiated with the specified system error uiCode.

◆ iterToString()

template<typename T >
static std::string arc::gen3::CArcBase::iterToString ( T *  pBegin,
T *  pEnd,
char  zSeperator = ' ' 
)
inlinestatic

Moves through the specified iterator positions and places each value into a return string that is seperated by the specified zSeperator.

Example: std::initializer_list<std::uint32_t> list = { 1, 2, 3, 4 }; produces the following output: "1 2 3 4 "

Parameters
pBegin- Pointer to iterator to the first element.
pEnd- Pointer to iterator to the last element.
zSeperator- Seperator character ( default = ' ' ).
Returns
A string containing all iterator elements seperated by the zSeperator parameter.
Exceptions
std::invalid_argumentif iterator pointers are invalid.

◆ operator=() [1/2]

CArcBase & arc::gen3::CArcBase::operator= ( CArcBase &&  )
protecteddelete

Delete move assignment constructor

◆ operator=() [2/2]

CArcBase & arc::gen3::CArcBase::operator= ( const CArcBase )
protecteddelete

Delete copy assignment constructor

◆ setDots()

std::string arc::gen3::CArcBase::setDots ( std::string_view  svText,
const std::size_t  uiMaxLength,
const char  szDot = '.' 
)
static

Appends dots to the end of the specified string to show a connection to a component.

Parameters
svText- The text to append the dots too.
uiMaxLength- The maximum length of the returned string.
szDot- The dot character (default = '.').
Returns
A string of length iMaxLength with dots appended.
Exceptions
std::ios_base::failure
std::length_error

◆ splitString()

std::unique_ptr< CArcStringList > arc::gen3::CArcBase::splitString ( const std::string &  sString,
const char &  zDelim = ' ' 
)
static

Splits a string based on the specified deliminator.

Parameters
sString- The string to split.
zDelim- The character used to split the string ( default = ' ' ).
Returns
A pointer to a CArcStringList object that contains the string tokens.
Exceptions
std::runtime_error()

◆ throwException() [1/2]

template<typename T = std::runtime_error>
static void arc::gen3::CArcBase::throwException ( const std::string &  sMethodName,
const std::int32_t  iLine,
const char *  pszFmt,
  ... 
)
inlinestatic

Throws a std::exception based on the template parameter (default = std::runtime_error). Uses printf-style formatting. Acceptable format string specifiers:

          Acceptable format string specifiers:
          %u   -> unsigned integer
          %d   -> integer
          %f   -> double
          %l   -> long
          %j   -> unsigned long
          %J   -> unsigned long long
          %s   -> char * string
          %e   -> system message (as returned by errno or GetLastError)
          %x/X -> lower/upper case hexadecimal integer.
Parameters
sMethodName- The name of the method that's the source of the exception.
iLine- The line number that's the source of the exception.
pszFmt- A printf-style format string. See above for specifiers.
...- Arguments to fill in format string specifiers.
See also
std::runtime_error()

◆ throwException() [2/2]

template<typename T = std::runtime_error>
static void arc::gen3::CArcBase::throwException ( const std::string &  sMethodName,
const std::int32_t  iLine,
const std::string &  sMsg 
)
inlinestatic

Throws a std::exception based on the template parameter (default = std::runtime_error).

Parameters
sMethodName- The name of the method that's the source of the exception.
iLine- The line number that's the source of the exception.
sMsg- The exception message.
See also
std::runtime_error()

◆ throwNoDeviceError()

void arc::gen3::CArcBase::throwNoDeviceError ( const std::string &  sMethodName,
const std::int32_t  iLine,
const std::string &  sMsg = "" 
)
static

Throws a std::runtime_error exception.

Parameters
sMethodName- The name of the method that's the source of the exception.
iLine- The line number that's the source of the exception.
sMsg- The exception message.
See also
std::runtime_error()

◆ throwOutOfRange() [1/2]

void arc::gen3::CArcBase::throwOutOfRange ( const std::string &  sMethodName,
const std::int32_t  iLine,
const std::string &  sElement,
const std::size_t  uiSize 
)
static

Throws a std::out_of_range exception.

Parameters
sMethodName- The name of the method that's the source of the exception.
iLine- The line number that's the source of the exception.
sElement- The element that's out of range.
uiSize- The elements max size.
See also
std::out_of_range()

◆ throwOutOfRange() [2/2]

void arc::gen3::CArcBase::throwOutOfRange ( const std::string &  sMethodName,
const std::int32_t  iLine,
const std::uint32_t  uiElement,
std::pair< std::uint32_t, std::uint32_t >  range 
)
static

Throws a std::out_of_range exception.

Parameters
sMethodName- The name of the method that's the source of the exception.
iLine- The line number that's the source of the exception.
uiElement- The element that's out of range.
range- A pair that defines the valid range.
See also
std::out_of_range()

◆ version()

const std::string arc::gen3::CArcBase::version ( void  )
static

Returns a textual representation of the library version.

Returns
A string representation of the library version.

◆ zeroMemory()

void arc::gen3::CArcBase::zeroMemory ( void *  pDest,
const std::size_t  uiSize 
)
static

Zero out the specified buffer.

Parameters
pDest- Pointer to the buffer to zero.
uiSize- The size of the buffer ( in bytes ).
Exceptions
std::invalid_argumentif arguments are invalid.

Member Data Documentation

◆ m_sVersion

const std::string arc::gen3::CArcBase::m_sVersion
staticprotected
Initial value:
= "ARC Gen III Base API Library. "s +
arc::gen3::CArcBase::formatString( "[ Compiler Version: %d.%d.%d, Built: %s %s ]", __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__, __DATE__, __TIME__ )
static std::string formatString(const char *pszFmt,...)
Definition: CArcBase.cpp:256

version() text holder


The documentation for this class was generated from the following files: