14#include "ns3/q2ns-qnet-device.h"
16#include "ns3/q2ns-qchannel.h"
24NS_LOG_COMPONENT_DEFINE(
"QNetDevice");
25NS_OBJECT_ENSURE_REGISTERED(QNetDevice);
30 static ns3::TypeId tid = ns3::TypeId(
"q2ns::QNetDevice")
31 .SetParent<ns3::NetDevice>()
57 return channel_->SendFrom(
this, std::move(q));
66 NS_ASSERT_MSG(
networker_,
"ReceiveFromChannel called without a bound networker");
Minimal quantum net device that bridges a QChannel and a QNetworker.
void BindNetworker(QNetworker &networker)
Bind the owning networker.
QNetDevice()
Default constructor.
ns3::Ptr< ns3::Node > GetNode() const override
Get the owning ns-3 node.
bool Send(std::shared_ptr< Qubit > q)
Send a qubit through the attached channel.
std::uint32_t GetIfIndex() const override
Get the interface index assigned by the owning node.
ns3::Ptr< ns3::Node > node_
Owning ns-3 node.
std::uint32_t ifIndex_
Interface index.
void SetNode(ns3::Ptr< ns3::Node > node) override
Set the owning ns-3 node.
void SetIfIndex(std::uint32_t i) override
Set the interface index assigned by the owning node.
ns3::Ptr< QChannel > channel_
Attached quantum channel.
ns3::Ptr< ns3::Channel > GetChannel() const override
Return the attached channel.
QNetworker * networker_
Bound networker, not owned.
void ReceiveFromChannel(std::shared_ptr< Qubit > q, const QMapInstance &map={})
Receive a qubit from the attached channel and forward it upward.
void AttachChannel(ns3::Ptr< QChannel > ch)
Attach this device to a quantum channel.
static ns3::TypeId GetTypeId(void)
Get the ns-3 TypeId.
Internal helper owned by QNode for node-local quantum networking.
void ReceiveFromDevice(std::shared_ptr< Qubit > q, const QMapInstance &map)
Handle a qubit delivered from a channel.
std::function< void(QNode &, std::shared_ptr< Qubit > &)> QMapInstance
Per-transmission quantum map callable applied to a received qubit.
Declares q2ns::QNetworker, an internal per-node networking component for quantum transmission and rec...