1. Joseph Bane
  2. COS 520 Lamport 2

Source

COS 520 Lamport 2 / Request.hpp

/*
 * Request.hpp
 *
 * Author: Joseph Bane
 *
 */

#ifndef REQUEST_HPP_
#define REQUEST_HPP_

#include "types.hpp"
#include "Message.hpp"

class Process;

static const type::time MaximumRequestTTA = 100;

class Request {
  friend bool operator<(const Request &LHS, const Request &RHS);

public:
  // Processes pass a sequential request ID
  Request(Process *p, type::time ts, type::requestID simID);
  Request(Process *p, type::time ts, type::requestID simID, type::time TTA);
  void display() const;
  type::requestID getID() const;
  Process *getOwner() const;
  type::time getTimestamp() const;
  type::time getTTA() const;
  bool hasArrived() const;
  void tick() const;

private:
  type::requestID ID;
  Process *owner;
  type::time timestamp;
  mutable type::time TTA;

};


bool operator<(const Request &LHS, const Request &RHS);

#endif // REQUEST_HPP_