Class AgentID

Class Documentation

class AgentID

A unique identifier for each Agent.

The unique identifier permits ordering to allow AgentIDs to be used as keys for std::map. The unique identifier is unique for the session, however, AgentIDs are not guaranteed to be unique from session-to-session.

See also

Agent

Public Functions

AgentID()

Constructs a new unique identifier.

std::string to_string() const

Convert the identifier to a human-readable string.

Returns

a human-readable form of the AgentID as std::string.

Friends

friend bool operator==(const AgentID &lhs, const AgentID &rhs)

Test if two AgentID instances are equal.

Parameters
  • lhs – is the left-hand side of the equality test.

  • rhs – is the right-hand side of the equality test.

Returns

true is they are equal and false if not.

friend bool operator!=(const AgentID &lhs, const AgentID &rhs)

Test if two AgentID instances are not equal.

Parameters
  • lhs – is the left-hand side of the equality test.

  • rhs – is the right-hand side of the equality test.

Returns

true is they are not equal and false if they are.

friend bool operator<(const AgentID &lhs, const AgentID &rhs)

Test if one AgentID is less than another.

Due to the way AgentID instances are used internally, the AgentID must be orderable. The < operator provides a basic ordering sufficient for std::map.

Parameters
  • lhs – is the left-hand side of the ordering test.

  • rhs – is the right-hand side of the ordering test.

Returns

true if lhs is “less than” rhs as determined by the underlying implementation of the AgentID.

friend std::ostream &operator<<(std::ostream &lhs, const AgentID &rhs)

Output an AgentID to the specified output stream.

The form of the output will be the same as that produced by the to_string() member function.

Parameters
  • lhs – is the stream to output the AgentID to

  • rhs – is the AgentID to output

Returns

the output stream for reuse