INET Framework for OMNeT++/OMNEST
inet::PimBase::AssertMetric Struct Reference

#include <PimBase.h>

Public Member Functions

 AssertMetric ()
 
 AssertMetric (int preference, int metric, Ipv4Address address)
 
 AssertMetric (bool rptBit, int preference, int metric, Ipv4Address address=Ipv4Address::UNSPECIFIED_ADDRESS)
 
bool isInfinite () const
 
bool operator== (const AssertMetric &other) const
 
bool operator!= (const AssertMetric &other) const
 
bool operator< (const AssertMetric &other) const
 
AssertMetric setAddress (Ipv4Address address) const
 

Public Attributes

short rptBit
 
short preference
 
int metric
 
Ipv4Address address
 

Static Public Attributes

static const AssertMetric PIM_INFINITE
 

Constructor & Destructor Documentation

◆ AssertMetric() [1/3]

inet::PimBase::AssertMetric::AssertMetric ( )
inline
39 : rptBit(1), preference(-1), metric(0) {}

◆ AssertMetric() [2/3]

inet::PimBase::AssertMetric::AssertMetric ( int  preference,
int  metric,
Ipv4Address  address 
)
inline
40  :

◆ AssertMetric() [3/3]

inet::PimBase::AssertMetric::AssertMetric ( bool  rptBit,
int  preference,
int  metric,
Ipv4Address  address = Ipv4Address::UNSPECIFIED_ADDRESS 
)
inline
43  : rptBit(rptBit ? 1 : 0), preference(preference), metric(metric), address(address) { ASSERT(preference >= 0); }

Member Function Documentation

◆ isInfinite()

bool inet::PimBase::AssertMetric::isInfinite ( ) const
inline
44 { return preference == -1; }

Referenced by operator<().

◆ operator!=()

bool inet::PimBase::AssertMetric::operator!= ( const AssertMetric other) const
213 {
214  return rptBit != other.rptBit || preference != other.preference ||
215  metric != other.metric || address != other.address;
216 }

◆ operator<()

bool inet::PimBase::AssertMetric::operator< ( const AssertMetric other) const
219 {
220  if (isInfinite())
221  return false;
222  if (other.isInfinite())
223  return true;
224  if (rptBit != other.rptBit)
225  return rptBit < other.rptBit;
226  if (preference != other.preference)
227  return preference < other.preference;
228  if (metric != other.metric)
229  return metric < other.metric;
230  return address > other.address;
231 }

◆ operator==()

bool inet::PimBase::AssertMetric::operator== ( const AssertMetric other) const
207 {
208  return rptBit == other.rptBit && preference == other.preference &&
209  metric == other.metric && address == other.address;
210 }

◆ setAddress()

AssertMetric inet::PimBase::AssertMetric::setAddress ( Ipv4Address  address) const
inline

Member Data Documentation

◆ address

Ipv4Address inet::PimBase::AssertMetric::address

◆ metric

int inet::PimBase::AssertMetric::metric

◆ PIM_INFINITE

const PimBase::AssertMetric inet::PimBase::AssertMetric::PIM_INFINITE
static

◆ preference

short inet::PimBase::AssertMetric::preference

◆ rptBit

short inet::PimBase::AssertMetric::rptBit

The documentation for this struct was generated from the following files:
inet::PimBase::AssertMetric::metric
int metric
Definition: PimBase.h:34
inet::PimBase::AssertMetric::preference
short preference
Definition: PimBase.h:33
inet::PimBase::AssertMetric::address
Ipv4Address address
Definition: PimBase.h:35
inet::PimBase::AssertMetric::AssertMetric
AssertMetric()
Definition: PimBase.h:39
inet::PimBase::AssertMetric::rptBit
short rptBit
Definition: PimBase.h:32
inet::PimBase::AssertMetric::isInfinite
bool isInfinite() const
Definition: PimBase.h:44