CPN
Computational Process Networks
Public Member Functions | Private Attributes | List of all members
D4R::Tag Class Reference

#include <D4RTag.h>

+ Collaboration diagram for D4R::Tag:

Public Member Functions

 Tag (uint64_t k)
 
 Tag ()
 
bool operator< (const Tag &t) const
 
bool operator>= (const Tag &t) const
 
bool operator<= (const Tag &t) const
 
bool operator> (const Tag &t) const
 
bool operator== (const Tag &t) const
 
bool operator!= (const Tag &t) const
 
const uint128_tLabel () const
 
const uint128_tLabel (const uint128_t &l)
 
const uint128_tPriority () const
 
const uint128_tPriority (const uint128_t &p)
 
uint64_t Count () const
 
uint64_t Count (uint64_t c)
 
uint64_t Key () const
 
uint64_t Key (uint64_t k)
 
uint64_t QueueSize () const
 
uint64_t QueueSize (uint64_t qs)
 
uint64_t QueueKey () const
 
uint64_t QueueKey (uint64_t k)
 

Private Attributes

uint128_t label
 
uint128_t priority
 

Detailed Description

A class to encapsulate the D4R tag.

This is implemented with keys as the lower order bits and the counters and queue size as the higher order bits as suggested in the literature. This gives a total order to the Tags so that one and only one of the nodes in the deadlock will detect the deadlock.

Definition at line 42 of file D4RTag.h.

Constructor & Destructor Documentation

D4R::Tag::Tag ( uint64_t  k)
inline

Definition at line 44 of file D4RTag.h.

44 : label(0, k), priority(uint64_t(-1), k) {}
uint128_t priority
Definition: D4RTag.h:80
uint128_t label
Definition: D4RTag.h:79
D4R::Tag::Tag ( )
inline

Definition at line 45 of file D4RTag.h.

45 : label(), priority() {}
uint128_t priority
Definition: D4RTag.h:80
uint128_t label
Definition: D4RTag.h:79

Member Function Documentation

uint64_t D4R::Tag::Count ( ) const
inline

The D4R algorithm count

Definition at line 58 of file D4RTag.h.

References uint128_t::high, and label.

Referenced by D4R::Node::Block(), CPN::PseudoNode::LogState(), and D4R::Node::Transmit().

58 { return label.high; }
uint64_t high
Definition: uint128_t.h:35
uint128_t label
Definition: D4RTag.h:79

+ Here is the caller graph for this function:

uint64_t D4R::Tag::Count ( uint64_t  c)
inline

Definition at line 59 of file D4RTag.h.

References uint128_t::high, and label.

59 { return label.high = c; }
uint64_t high
Definition: uint128_t.h:35
uint128_t label
Definition: D4RTag.h:79
uint64_t D4R::Tag::Key ( ) const
inline

The key of the tag

Definition at line 62 of file D4RTag.h.

References label, and uint128_t::low.

Referenced by D4R::Node::Block(), CPN::PseudoNode::LogState(), and D4R::Node::Transmit().

62 { return label.low; }
uint64_t low
Definition: uint128_t.h:35
uint128_t label
Definition: D4RTag.h:79

+ Here is the caller graph for this function:

uint64_t D4R::Tag::Key ( uint64_t  k)
inline

Definition at line 63 of file D4RTag.h.

References label, and uint128_t::low.

63 { return label.low = k; }
uint64_t low
Definition: uint128_t.h:35
uint128_t label
Definition: D4RTag.h:79
const uint128_t& D4R::Tag::Label ( ) const
inline

Definition at line 74 of file D4RTag.h.

References label.

74 { return label; }
uint128_t label
Definition: D4RTag.h:79
const uint128_t& D4R::Tag::Label ( const uint128_t l)
inline

Definition at line 75 of file D4RTag.h.

References label.

75 { return label = l; }
uint128_t label
Definition: D4RTag.h:79
bool D4R::Tag::operator!= ( const Tag t) const
inline

Definition at line 55 of file D4RTag.h.

55 { return !(*this == t); }
bool D4R::Tag::operator< ( const Tag t) const

Perform comparison as specified in "A Distributed Deadlock Detection And Resolution Algorithm For Process Networks" by Allen, Zucknick and Evans

Definition at line 28 of file D4RTag.cc.

References label, and priority.

28  {
29  if (label == t.label) {
30  return priority > t.priority;
31  } else {
32  return label < t.label;
33  }
34  }
uint128_t priority
Definition: D4RTag.h:80
uint128_t label
Definition: D4RTag.h:79
bool D4R::Tag::operator<= ( const Tag t) const
inline

Definition at line 52 of file D4RTag.h.

52 { return !(t < *this); }
bool D4R::Tag::operator== ( const Tag t) const

Definition at line 36 of file D4RTag.cc.

References label, and priority.

36  {
37  return (label == t.label && priority == t.priority);
38  }
uint128_t priority
Definition: D4RTag.h:80
uint128_t label
Definition: D4RTag.h:79
bool D4R::Tag::operator> ( const Tag t) const
inline

Definition at line 53 of file D4RTag.h.

53 { return (t < *this); }
bool D4R::Tag::operator>= ( const Tag t) const
inline

Definition at line 51 of file D4RTag.h.

51 { return !(*this < t); }
const uint128_t& D4R::Tag::Priority ( ) const
inline

Definition at line 76 of file D4RTag.h.

References priority.

Referenced by D4R::Node::Transmit().

76 { return priority; }
uint128_t priority
Definition: D4RTag.h:80

+ Here is the caller graph for this function:

const uint128_t& D4R::Tag::Priority ( const uint128_t p)
inline

Definition at line 77 of file D4RTag.h.

References priority.

77 { return priority = p; }
uint128_t priority
Definition: D4RTag.h:80
uint64_t D4R::Tag::QueueKey ( ) const
inline

The key of the node blocked on the queue, this provides a total order to the tags.

Definition at line 71 of file D4RTag.h.

References uint128_t::low, and priority.

Referenced by CPN::PseudoNode::LogState(), and D4R::Node::Transmit().

71 { return priority.low; }
uint128_t priority
Definition: D4RTag.h:80
uint64_t low
Definition: uint128_t.h:35

+ Here is the caller graph for this function:

uint64_t D4R::Tag::QueueKey ( uint64_t  k)
inline

Definition at line 72 of file D4RTag.h.

References uint128_t::low, and priority.

72 { return priority.low = k; }
uint128_t priority
Definition: D4RTag.h:80
uint64_t low
Definition: uint128_t.h:35
uint64_t D4R::Tag::QueueSize ( ) const
inline

The queue size of the tag.

Definition at line 66 of file D4RTag.h.

References uint128_t::high, and priority.

Referenced by D4R::Node::Block(), CPN::PseudoNode::LogState(), and D4R::Node::Transmit().

66 { return priority.high; }
uint64_t high
Definition: uint128_t.h:35
uint128_t priority
Definition: D4RTag.h:80

+ Here is the caller graph for this function:

uint64_t D4R::Tag::QueueSize ( uint64_t  qs)
inline

Definition at line 67 of file D4RTag.h.

References uint128_t::high, and priority.

67 { return priority.high = qs; }
uint64_t high
Definition: uint128_t.h:35
uint128_t priority
Definition: D4RTag.h:80

Member Data Documentation

uint128_t D4R::Tag::label
private

Definition at line 79 of file D4RTag.h.

Referenced by Count(), Key(), Label(), operator<(), and operator==().

uint128_t D4R::Tag::priority
private

Definition at line 80 of file D4RTag.h.

Referenced by operator<(), operator==(), Priority(), QueueKey(), and QueueSize().


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