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

#include <CArcLog.h>

Inheritance diagram for arc::gen4::CArcLog:
arc::gen4::CArcBase arc::gen4::CArcBase

Public Member Functions

 CArcLog (void)
 
 ~CArcLog (void)=default
 
void setMaxSize (const qsize_t uiSize=Q_MAX)
 
void enable (const bool bEnable=true)
 
bool isEnabled (void) const noexcept
 
void put (const std::string &sText)
 
void put (const char *pszFmt,...)
 
const std::string next (void)
 
const std::string last (void)
 
std::size_t count (void) const noexcept
 
bool empty (void) const noexcept
 
CArcLogoperator<< (std::string const &sText)
 
- Public Member Functions inherited from arc::gen4::CArcBase
virtual ~CArcBase (void)
 

Additional Inherited Members

- Static Public Member Functions inherited from arc::gen4::CArcBase
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 inherited from arc::gen4::CArcBase
 CArcBase (void)=default
 
 CArcBase (const CArcBase &)=delete
 
 CArcBase (CArcBase &&)=delete
 
CArcBaseoperator= (const CArcBase &)=delete
 
CArcBaseoperator= (CArcBase &&)=delete
 
- Static Protected Attributes inherited from arc::gen4::CArcBase
static const std::string m_sVersion
 

Detailed Description

Class to log device and controller commands for debugging purposes.

Definition at line 46 of file CArcLog.h.

Constructor & Destructor Documentation

◆ CArcLog()

arc::gen4::CArcLog::CArcLog ( void  )

Default constructor

◆ ~CArcLog()

arc::gen4::CArcLog::~CArcLog ( void  )
default

Destructor

Member Function Documentation

◆ setMaxSize()

void arc::gen4::CArcLog::setMaxSize ( const qsize_t  uiSize = Q_MAX)

Sets the maximum number of messages that the Q can hold.

Parameters
uiSize- The maximum number of message the Q can hold. Must be > 0 ( default = Q_MAX ).
Exceptions
Anyexception thrown by std::lock_guard

◆ enable()

void arc::gen4::CArcLog::enable ( const bool  bEnable = true)

Enable/Disable logging.

Parameters
bEnable- true to enable logging; false to disable ( default = true ).
Exceptions
Anyexception thrown by std::lock_guard

◆ isEnabled()

bool arc::gen4::CArcLog::isEnabled ( void  ) const
noexcept

Returns whether or not logging is enabled.

Returns
true if logging is enabled; false otherwise.

◆ put() [1/2]

void arc::gen4::CArcLog::put ( const std::string &  sText)

Inserts the packet into the log queue. It dumps the oldest message if the queue size is
greater than or equal to Q_MAX.

Parameters
sText- The text to add to the log queue.
Exceptions
Anyexception thrown by std::lock_guard
Anyexception thrown by std::queue

◆ put() [2/2]

void arc::gen4::CArcLog::put ( const char *  pszFmt,
  ... 
)

Inserts a message into the log queue. It dumps the oldest message if the queue size is greater than or equal to Q_MAX.

Parameters
pszFmt- C-printf style format (sort of). See arc::gen4::CArcBase::formatString() for format list.
Exceptions
Anyexception thrown by std::lock_guard
Anyexception thrown by std::queue

◆ next()

const std::string arc::gen4::CArcLog::next ( void  )

Returns the oldest string ( as char * ) from the front of the queue. Also pops the message from the queue. Applications should call empty() to check if more messages are available. throws std::runtime_error

◆ last()

const std::string arc::gen4::CArcLog::last ( void  )

Returns the newest string ( as char * ) from the back of the queue. Also pops the message from the queue.

Exceptions
Anyexception thrown by std::lock_guard
Anyexception thrown by std::queue

◆ count()

std::size_t arc::gen4::CArcLog::count ( void  ) const
noexcept

Returns the number of elements in the queue. throws std::runtime_error

◆ empty()

bool arc::gen4::CArcLog::empty ( void  ) const
noexcept

Checks if the Q is empty. i.e. if there are any messages in the Q. Returns 'true' if the queue is empty; 'false' otherwise. throws std::runtime_error

◆ operator<<()

CArcLog & arc::gen4::CArcLog::operator<< ( std::string const &  sText)

Append operator. Appends a string to the end of the log.

Parameters
sElem- The string to add to the log.
Returns
A reference to the new log.