14#include "ns3/q2ns-qubit.h"
16#include "ns3/q2ns-qstate-registry.h"
17#include "ns3/q2ns-qstate.h"
25NS_LOG_COMPONENT_DEFINE(
"Qubit");
31 : registry_(registry), stateId_(stateId), indexInState_(indexInState),
32 label_(std::move(label)) {}
93 NS_LOG_WARN(
"SetLocationNode rejected: lost qubits cannot be moved back to a node.");
105 NS_LOG_WARN(
"SetLocationChannel rejected: lost qubits cannot be moved onto a channel.");
Internal registry that owns backend states and tracks qubit membership and location.
void SetLocation(const std::shared_ptr< Qubit > &q, Location loc)
Set the tracked location for a qubit handle.
Location GetLocation(const std::shared_ptr< Qubit > &q) const
Get the tracked location for a qubit handle.
QubitId GetQubitId() const
Get the stable qubit id.
std::string label_
Optional human-readable label.
void SetLabel(std::string label)
Set the application-level label.
void SetLocationLost()
Mark this qubit as lost.
Location GetLocation() const
Return the registry-tracked current location of this qubit.
void SetIndexInState(unsigned int index)
Update the current index within the backend state.
StateId GetStateId() const
Get the current backend state id.
Qubit(QStateRegistry ®istry, StateId stateId, unsigned int index, std::string label="")
Construct a qubit handle bound to a registry, state id, and index.
unsigned int indexInState_
Current zero-based index within the state.
void Rebind(StateId newStateId, std::size_t newIndex)
Rebind this handle to a different state id and index.
unsigned int GetIndexInState() const
Get the current index within the backend state.
QubitId qubitId_
Stable qubit id assigned by the registry.
const std::string & GetLabel() const
Get the application-level label.
void SetLocationNode(uint32_t nodeId)
Mark this qubit as local to a node.
void SetQubitId(QubitId id)
Assign the stable qubit id.
void SetStateId(StateId stateId)
Update the current backend state id.
void SetLocationChannel(uint32_t channelId)
Mark this qubit as in transit on a channel.
QStateRegistry & registry_
Backing state registry.
StateId stateId_
Current backend state id.
std::uint64_t QubitId
Stable identifier for a registered qubit handle.
std::uint64_t StateId
Stable identifier for a registered backend state.
@ Node
Qubit is local to a node identified by node id.
@ Channel
Qubit is in transit on a channel identified by channel id.
@ Lost
Qubit was lost and is no longer accessible.
Current tracked location of a qubit.