| THM1176InstrumentDriver 1.2 C++ API for Metrolab THM1176

Loading...
Searching...
No Matches
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< sToken > | tTokens
| List of tokens.

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

## Detailed Description

SCPI buffer parser.

Class to help parse SCPI reponse strings.

Definition at line 216 of file SCPIInstrumentBuffer.h.

## Member Typedef Documentation

## ◆ tTokens

typedef std::vector<sToken> MTL::Instrument::CSCPIBufferParser::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] | begin | Beginning of the data to be parsed.
  [out] | end | End 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] | rNextBegin | Beginning of next token.
  [out] | rNextEnd | End of next token.
  [in] | Separator | Separator 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] | Offset | Offset 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] | Separator | Separator between tokens.
  [in] | Offset | Starting 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:

- Common/SCPI/include/SCPIInstrumentBuffer.h