AntHocNet 2.0.0
Paper-faithful ant-colony ad hoc routing: the shared core and its adapters
Loading...
Searching...
No Matches
ahn_web::Node Class Reference

One AntHocNet node: the core logic plus the adapter state around it. More...

#include <ahn_web/sim.h>

Inheritance diagram for ahn_web::Node:
anthocnet::core::IClock anthocnet::core::IRng anthocnet::core::IRouterObserver

Public Member Functions

 Node (World &w, int id, std::uint64_t seed)
 Created by World::addNode(); seed derives the node's streams.
 
anthocnet::core::Time now () const override
 IClock: the world's simulated time.
 
double uniform () override
 IRng: this node's own stream (independent of every other node's).
 
int uniformInt (int n) override
 IRng: uniform integer in [0, n).
 
void onRouteChanged (NodeAddress dest, NodeAddress nb, bool added) override
 IRouterObserver: report-only – route changes feed the event log.
 
int id () const
 This node's address (its index in the World).
 
anthocnet::core::AntRouterLogic & logic ()
 The core state machine (valid after World::start()).
 
const anthocnet::core::AntRouterLogic & logic () const
 The core state machine, read-only (inspection).
 
- Public Member Functions inherited from anthocnet::core::IClock
virtual ~IClock ()=default
 
- Public Member Functions inherited from anthocnet::core::IRng
virtual ~IRng ()=default
 
- Public Member Functions inherited from anthocnet::core::IRouterObserver
virtual ~IRouterObserver ()=default
 
virtual void onAntSent (AntType, AntDirection, bool)
 This node put an ant on the medium (origination or forwarding).
 
virtual void onAntReceived (AntType, AntDirection)
 This node processed a (non-duplicate) received ant.
 
virtual void onRouteChanged (NodeAddress, NodeAddress, bool)
 A neighbour/route entry was added (true) or removed (false).
 

Friends

class World
 

Detailed Description

One AntHocNet node: the core logic plus the adapter state around it.

Definition at line 166 of file sim.h.

Constructor & Destructor Documentation

◆ Node()

ahn_web::Node::Node ( World &  w,
int  id,
std::uint64_t  seed 
)

Created by World::addNode(); seed derives the node's streams.

Member Function Documentation

◆ now()

anthocnet::core::Time ahn_web::Node::now ( ) const
overridevirtual

IClock: the world's simulated time.

Implements anthocnet::core::IClock.

◆ uniform()

double ahn_web::Node::uniform ( )
inlineoverridevirtual

IRng: this node's own stream (independent of every other node's).

Implements anthocnet::core::IRng.

Definition at line 176 of file sim.h.

References ahn_web::SplitMix64::uniform().

◆ uniformInt()

int ahn_web::Node::uniformInt ( int  n)
inlineoverridevirtual

IRng: uniform integer in [0, n).

Implements anthocnet::core::IRng.

Definition at line 178 of file sim.h.

References ahn_web::SplitMix64::uniformInt().

◆ onRouteChanged()

void ahn_web::Node::onRouteChanged ( NodeAddress  dest,
NodeAddress  nb,
bool  added 
)
override

IRouterObserver: report-only – route changes feed the event log.

◆ id()

int ahn_web::Node::id ( ) const
inline

This node's address (its index in the World).

Definition at line 184 of file sim.h.

◆ logic() [1/2]

anthocnet::core::AntRouterLogic & ahn_web::Node::logic ( )
inline

The core state machine (valid after World::start()).

Definition at line 186 of file sim.h.

◆ logic() [2/2]

const anthocnet::core::AntRouterLogic & ahn_web::Node::logic ( ) const
inline

The core state machine, read-only (inspection).

Definition at line 188 of file sim.h.

Friends And Related Symbol Documentation

◆ World

friend class World
friend

Definition at line 191 of file sim.h.


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