THM1176InstrumentDriver  1.0
C++ API for Metrolab THM1176
MTL::Instrument::CSCPIBufferParser Class Reference

SCPI buffer parser. More...

#include <SCPIInstrumentBuffer.h>

Classes

struct  sToken
 Location of a token within a buffer. More...
 

Public Types

typedef std::vector< sTokentTokens
 List of tokens. More...
 

Public Member Functions

 CSCPIBufferParser (std::vector< char >::const_iterator begin, std::vector< char >::const_iterator end)
 Constructor. More...
 
std::vector< char >::const_iterator begin ()
 Return the beginning of the data to be parsed. More...
 
std::vector< char >::const_iterator end ()
 Return the end of the data to be parsed. More...
 
const tTokens Tokenize (const char Separator=';', size_t Offset=0)
 Split the buffer into tokens. More...
 
bool GetNext (std::vector< char >::const_iterator &rNextBegin, std::vector< char >::const_iterator &rNextEnd, const char Separator=';')
 Find the next token. More...
 
void SetNextOffset (std::vector< char >::const_iterator Offset)
 Manually set the offset to the next token. More...
 

Detailed Description

SCPI buffer parser.

Class to help parse SCPI reponse strings.

Definition at line 216 of file SCPIInstrumentBuffer.h.

Member Typedef Documentation

◆ tTokens

List of tokens.

Definition at line 233 of file SCPIInstrumentBuffer.h.

Constructor & Destructor Documentation

◆ CSCPIBufferParser()

MTL::Instrument::CSCPIBufferParser::CSCPIBufferParser ( std::vector< char >::const_iterator  begin,
std::vector< char >::const_iterator  end 
)
inline

Constructor.

Parameters
[in]beginBeginning of the data to be parsed.
[out]endEnd of the data to be parsed.

Definition at line 239 of file SCPIInstrumentBuffer.h.

Member Function Documentation

◆ begin()

std::vector<char>::const_iterator MTL::Instrument::CSCPIBufferParser::begin ( )
inline

Return the beginning of the data to be parsed.

Definition at line 243 of file SCPIInstrumentBuffer.h.

◆ end()

std::vector<char>::const_iterator MTL::Instrument::CSCPIBufferParser::end ( )
inline

Return the end of the data to be parsed.

Definition at line 249 of file SCPIInstrumentBuffer.h.

◆ GetNext()

bool MTL::Instrument::CSCPIBufferParser::GetNext ( std::vector< char >::const_iterator &  rNextBegin,
std::vector< char >::const_iterator &  rNextEnd,
const char  Separator = ';' 
)
inline

Find the next token.

Attention: When next token is an arbitrary block, it may contain a ';', which causes rNextEnd to be wrong.

Parameters
[out]rNextBeginBeginning of next token.
[out]rNextEndEnd of next token.
[in]SeparatorSeparator between tokens.
Returns
True if successful.

Definition at line 297 of file SCPIInstrumentBuffer.h.

◆ SetNextOffset()

void MTL::Instrument::CSCPIBufferParser::SetNextOffset ( std::vector< char >::const_iterator  Offset)
inline

Manually set the offset to the next token.

When parsing arbitrary block, it is necessary to force offset to skip ';' chars that are not separators.

Parameters
[in]OffsetOffset to next token.

Definition at line 330 of file SCPIInstrumentBuffer.h.

◆ Tokenize()

const tTokens MTL::Instrument::CSCPIBufferParser::Tokenize ( const char  Separator = ';',
size_t  Offset = 0 
)
inline

Split the buffer into tokens.

Parameters
[in]SeparatorSeparator between tokens.
[in]OffsetStarting offset, relative to the beginning of the data to be parsed.
Returns
List of tokens found.

Definition at line 258 of file SCPIInstrumentBuffer.h.


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