Public Member Functions | Static Public Member Functions | Public Attributes | Static Private Member Functions | List of all members
hebi::MacAddress Class Referencefinal

A simple wrapper class for internal C-API HebiMacAddress objects to allow interfacing with API calls that use MAC addresses. More...

#include <mac_address.hpp>

Public Member Functions

 MacAddress ()
 Creates MAC address 00:00:00:00:00:00. More...
 
uint8_t & operator[] (std::size_t idx)
 
const uint8_t & operator[] (std::size_t idx) const
 
bool setToHexString (std::string mac_str)
 Sets the value of the current MacAddress to the value given in 'mac_str'. More...
 

Static Public Member Functions

static MacAddress fromBytes (uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint8_t e, uint8_t f)
 Creates a MacAddress from individual bytes. More...
 
static bool isHexStringValid (std::string mac_str)
 Is mac_str a valid string of format dd:dd:dd:dd:dd:dd, where 'd' is a hex digit 0-F. Lowercase values accepted. 1 if yes, 0 if no. More...
 

Public Attributes

HebiMacAddress internal_
 

Static Private Member Functions

static uint8_t byteFromHexPair (char c1, char c2)
 
static uint8_t hexToInt (char c)
 
static bool isHexDigitValid (char c)
 

Detailed Description

A simple wrapper class for internal C-API HebiMacAddress objects to allow interfacing with API calls that use MAC addresses.

Definition at line 12 of file mac_address.hpp.

Constructor & Destructor Documentation

hebi::MacAddress::MacAddress ( )

Creates MAC address 00:00:00:00:00:00.

Definition at line 21 of file mac_address.cpp.

Member Function Documentation

uint8_t hebi::MacAddress::byteFromHexPair ( char  c1,
char  c2 
)
staticprivate

Converts a hex pair to a byte (0-255 possible). Assumes valid digits.

Definition at line 16 of file mac_address.cpp.

MacAddress hebi::MacAddress::fromBytes ( uint8_t  a,
uint8_t  b,
uint8_t  c,
uint8_t  d,
uint8_t  e,
uint8_t  f 
)
static

Creates a MacAddress from individual bytes.

Definition at line 31 of file mac_address.cpp.

uint8_t hebi::MacAddress::hexToInt ( char  c)
staticprivate

Converts a hex digit to a byte (highest value possible is 15). Assumes valid digit.

Definition at line 5 of file mac_address.cpp.

bool hebi::MacAddress::isHexDigitValid ( char  c)
staticprivate

Definition at line 66 of file mac_address.cpp.

bool hebi::MacAddress::isHexStringValid ( std::string  mac_str)
static

Is mac_str a valid string of format dd:dd:dd:dd:dd:dd, where 'd' is a hex digit 0-F. Lowercase values accepted. 1 if yes, 0 if no.

Returns
'true' if mac_str is valid, 'false' otherwise.

Definition at line 74 of file mac_address.cpp.

uint8_t & hebi::MacAddress::operator[] ( std::size_t  idx)

Definition at line 56 of file mac_address.cpp.

const uint8_t & hebi::MacAddress::operator[] ( std::size_t  idx) const

Definition at line 61 of file mac_address.cpp.

bool hebi::MacAddress::setToHexString ( std::string  mac_str)

Sets the value of the current MacAddress to the value given in 'mac_str'.

This value must be a valid string of format dd:dd:dd:dd:dd:dd, where 'd' is a hex digit (0-F, uppercase or lowercase).

Returns
'true' on success (valid mac_str), 'false' on failure.

Definition at line 43 of file mac_address.cpp.

Member Data Documentation

HebiMacAddress hebi::MacAddress::internal_

C-style mac address object; this is a plain struct, so it is OK to rely on default copy/move constructors. NOTE: this should not be used except by library functions!

Definition at line 21 of file mac_address.hpp.


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


hebiros
Author(s): Xavier Artache , Matthew Tesch
autogenerated on Thu Sep 3 2020 04:11:00