OpFlex Framework  1.3.0
opflex::modb::MAC Class Reference

A MAC address is used to identify devices on an ethernet network. More...

#include <opflex/modb/MAC.h>

Public Member Functions

 MAC ()
 Construct a MAC consisting of all zeroes.
 
 MAC (const std::string &mac)
 Construct a MAC using the given string representation. More...
 
 MAC (uint8_t mac[6])
 Construct a MAC using an array of 6 bytes, in network byte order. More...
 
 ~MAC ()
 Destroy the MAC.
 
std::string toString () const
 Get the MAC represented as a string.
 
void toUIntArray (uint8_t mac[6]) const
 Get the MAC represented as an array of 6 bytes in network byte order.
 

Friends

bool operator== (const MAC &lhs, const MAC &rhs)
 Check for MAC equality.
 
bool operator!= (const MAC &lhs, const MAC &rhs)
 Check for MAC inequality.
 
size_t hash_value (MAC const &mac)
 Compute a hash value for the MAC, making MAC suitable as a key in an unordered_map.
 

Detailed Description

A MAC address is used to identify devices on an ethernet network.

The string representation is a set of 6 hex-encoded bytes separated by colon characters.

Constructor & Destructor Documentation

opflex::modb::MAC::MAC ( const std::string &  mac)
explicit

Construct a MAC using the given string representation.

Parameters
macthe string representation of the mac
Exceptions
std::invalid_argumentif the MAC address is not valid
opflex::modb::MAC::MAC ( uint8_t  mac[6])
explicit

Construct a MAC using an array of 6 bytes, in network byte order.

Parameters
macthe mac represented as an array of 6 bytes

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