Developer Application Interface (ARC API) v4.5.8
ARC, Inc. GenIV Application Interface
arc::gen4::CArcBase Class Reference

#include <CArcBase.h>

Inheritance diagram for arc::gen4::CArcBase:
arc::gen4::CArcBoardMap arc::gen4::CArcDisplay arc::gen4::CArcFitsFile< T > arc::gen4::CArcImage< T > arc::gen4::CArcImageAssembler arc::gen4::CArcLog arc::gen4::CArcLog arc::gen4::CArcPCIeBase arc::gen4::CArcPacket arc::gen4::CArcSystem arc::gen4::CArcTimer

Public Member Functions

virtual ~CArcBase (void)
 

Static Public Member Functions

static const std::string version (void)
 
static void zeroMemory (void *pDest, std::size_t uiSize)
 
static void copyMemory (void *pDest, void *pSrc, std::size_t uiSize)
 
template<typename T >
static std::tuple< T *, T * > copyAndIncrement (void *pDest, void *pSrc, const std::size_t uiSize)
 
template<typename ErrCode >
requires std::is_integral_v<ErrCode>
static const std::string getSystemErrorMessage (ErrCode iErrCode)
 
static const std::string getSystemErrorMessage (void)
 
static std::uint32_t getSystemError (void) noexcept
 
static pStringList_t splitString (const std::string &sString, const char &zDelim=' ')
 
static std::string formatString (const char *pszFmt,...)
 
static const std::filesystem::path incrementFileName (const std::filesystem::path &tFilePath="", const std::int32_t iStartValue=-1)
 
static std::string convertWideToAnsi (const 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)
 
template<typename T >
static std::string iterToString (T *begin, T *end, const char zSeperator=' ')
 
static std::string setDots (const std::string &sText, const std::size_t uiMaxLength, const char szDot='.')
 
static std::string trim (const std::string &sText) noexcept
 
static const std::chrono::time_point< std::chrono::high_resolution_clock > startCodeTime (void) noexcept
 
template<typename T >
static constexpr auto endCodeTime (const std::chrono::time_point< std::chrono::high_resolution_clock > tStartTimePoint) noexcept
 

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 ).

Definition at line 236 of file CArcBase.h.

Constructor & Destructor Documentation

◆ ~CArcBase()

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

Destructor

◆ CArcBase() [1/3]

arc::gen4::CArcBase::CArcBase ( void  )
protecteddefault

Default constructor

◆ CArcBase() [2/3]

arc::gen4::CArcBase::CArcBase ( const CArcBase )
protecteddelete

Delete copy constructor

◆ CArcBase() [3/3]

arc::gen4::CArcBase::CArcBase ( CArcBase &&  )
protecteddelete

Delete move constructor

Member Function Documentation

◆ version()

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

Returns a textual representation of the library version and compile date and time.

Returns
A string representation of the library details.

◆ zeroMemory()

static void arc::gen4::CArcBase::zeroMemory ( void *  pDest,
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.

◆ copyMemory()

static void arc::gen4::CArcBase::copyMemory ( void *  pDest,
void *  pSrc,
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.

◆ copyAndIncrement()

template<typename T >
static std::tuple< T *, T * > arc::gen4::CArcBase::copyAndIncrement ( void *  pDest,
void *  pSrc,
const std::size_t  uiSize 
)
inlinestatic

Copies the source buffer into the destination buffer. The pointers are incremented.

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.

Definition at line 269 of file CArcBase.h.

◆ getSystemErrorMessage() [1/2]

template<typename ErrCode >
requires std::is_integral_v<ErrCode>
static const std::string arc::gen4::CArcBase::getSystemErrorMessage ( ErrCode  iErrCode)
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 ).
Returns
A string that represents the error message assoctiated with the specified system error uiCode.
Exceptions
std::ios_base::failure

Definition at line 306 of file CArcBase.h.

◆ getSystemErrorMessage() [2/2]

static const std::string arc::gen4::CArcBase::getSystemErrorMessage ( void  )
static

Returns a string that describes the last system error as returned from GetLastError() on Windows and errno on Linux.

Returns
A string that describes the error message assoctiated with the specified system error code.
Exceptions
std::ios_base::failure

◆ getSystemError()

static std::uint32_t arc::gen4::CArcBase::getSystemError ( void  )
inlinestaticnoexcept

Returns the current system error code.

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

Definition at line 381 of file CArcBase.h.

◆ splitString()

static pStringList_t arc::gen4::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::regex_error

◆ formatString()

static std::string arc::gen4::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)
          %b   -> bool
          %x/X -> 32-bit lower/upper case hexadecimal integer.
          %p   -> 64-bit upper case hexadecimal integer ( pointer )
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.
Exceptions
std::ios_base::failure

◆ incrementFileName()

static const std::filesystem::path arc::gen4::CArcBase::incrementFileName ( const std::filesystem::path &  tFilePath = "",
const std::int32_t  iStartValue = -1 
)
static

Modifies the specified filename to contain an increment value string ("_#). The increment value starts at zero by default. To reset the increment value back to zero, pass in the default values. @param tFilePath - The un-modified filename to modify with an increment value (default: "" ).

Parameters
iStartValue- The increment start value or -1 to reset back to zero (default: -1).
Returns
The incremented filename. The original file parameter remains unscathed.
Exceptions
std::runtime_errorand any error thrown by the std::filesystem methods ( parent_path, stem, extension, /=, += ).

◆ convertWideToAnsi() [1/2]

static std::string arc::gen4::CArcBase::convertWideToAnsi ( const 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.

◆ convertWideToAnsi() [2/2]

static std::string arc::gen4::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.
Exceptions
std::ios_base::failure

◆ convertAnsiToWide()

static std::wstring arc::gen4::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.
Exceptions
std::ios_base::failure

◆ cmdToString()

static std::string arc::gen4::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.
Exceptions
std::ios_base::failure

◆ iterToString()

template<typename T >
static std::string arc::gen4::CArcBase::iterToString ( T *  begin,
T *  end,
const 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
begin- Pointer to iterator to the first element.
end- 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_argument
std::ios_base::failure

Definition at line 485 of file CArcBase.h.

◆ setDots()

static std::string arc::gen4::CArcBase::setDots ( const std::string &  sText,
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
sText- 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

◆ trim()

static std::string arc::gen4::CArcBase::trim ( const std::string &  sText)
staticnoexcept

Trims the leading and trailing whitespace from the text.

Parameters
sText- The text to trim leading and trailing whitespace from.
Returns
The whitespace trimmed text.

◆ startCodeTime()

static const std::chrono::time_point< std::chrono::high_resolution_clock > arc::gen4::CArcBase::startCodeTime ( void  )
staticnoexcept

Reads the current time point using the std::high_resolution_clock for timing a piece of code. This is the start time to be called first.

Returns
The current time point

◆ endCodeTime()

template<typename T >
static constexpr auto arc::gen4::CArcBase::endCodeTime ( const std::chrono::time_point< std::chrono::high_resolution_clock >  tStartTimePoint)
inlinestaticconstexprnoexcept

Reads the current time point using the std::high_resolution_clock and subtracts the specified start time point for timing a piece of code. This is the end time to be called second.

Parameters
tStartTimePoint- The start time point returned by startCodeTime() method.
Returns
The time difference in the specified duration.

Definition at line 539 of file CArcBase.h.

◆ operator=() [1/2]

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

Delete copy assignment constructor

◆ operator=() [2/2]

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

Delete move assignment constructor

Member Data Documentation

◆ m_sVersion

const std::string arc::gen4::CArcBase::m_sVersion
staticprotected

version() text holder

Definition at line 566 of file CArcBase.h.