pub struct LogicNetwork<Node> { /* private fields */ }Expand description
An implementation of logic networks which is parameterized with the type of the logic node.
Implementations§
Source§impl<Node> LogicNetwork<Node>
impl<Node> LogicNetwork<Node>
Source§impl<Node> LogicNetwork<Node>
impl<Node> LogicNetwork<Node>
Sourcepub fn get_node(&self, node_id: NodeId) -> GeneralNode<&Node>
pub fn get_node(&self, node_id: NodeId) -> GeneralNode<&Node>
Get the node value of the given node_id.
Sourcepub fn get_logic_node_mut(&mut self, node_id: NodeId) -> Option<&mut Node>
pub fn get_logic_node_mut(&mut self, node_id: NodeId) -> Option<&mut Node>
Get a mutable reference to the logic node with the given ID.
Returns None if the node is an input, a constant or non-existent.
Trait Implementations§
Source§impl<Node> BooleanSystem for LogicNetwork<Node>where
Node: NetworkNode<NodeId = NodeId>,
impl<Node> BooleanSystem for LogicNetwork<Node>where
Node: NetworkNode<NodeId = NodeId>,
Source§impl<Node: Clone> Clone for LogicNetwork<Node>
impl<Node: Clone> Clone for LogicNetwork<Node>
Source§fn clone(&self) -> LogicNetwork<Node>
fn clone(&self) -> LogicNetwork<Node>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<Node: Default> Default for LogicNetwork<Node>
impl<Node: Default> Default for LogicNetwork<Node>
Source§fn default() -> LogicNetwork<Node>
fn default() -> LogicNetwork<Node>
Returns the “default value” for a type. Read more
Source§impl<Node> Network for LogicNetwork<Node>where
Node: NetworkNode<NodeId = NodeId>,
impl<Node> Network for LogicNetwork<Node>where
Node: NetworkNode<NodeId = NodeId>,
Source§type Signal = NodeId
type Signal = NodeId
Type which represents the outputs of network nodes, e.g. signals. In contrast to a
NodeId a Signal might also encode a logic inversion.Source§type LogicValue = bool
type LogicValue = bool
Type of signal values. Typically this might be
bool.Source§type NodeFunction = SmallTruthTable
type NodeFunction = SmallTruthTable
Type which represents the logic function of nodes in the network.
Source§fn num_primary_inputs(&self) -> usize
fn num_primary_inputs(&self) -> usize
Number of input into the network.
Source§fn num_primary_outputs(&self) -> usize
fn num_primary_outputs(&self) -> usize
Number of outputs from the network.
Source§fn foreach_gate(&self, f: impl Fn(Self::Signal))
fn foreach_gate(&self, f: impl Fn(Self::Signal))
Visit all network gates in an undefined order.
Each gate is visited exactly once.
Source§fn foreach_node(&self, f: impl Fn(&Self::Node))
fn foreach_node(&self, f: impl Fn(&Self::Node))
Visit all logic nodes.
Source§fn get_constant(&self, value: Self::LogicValue) -> Self::Signal
fn get_constant(&self, value: Self::LogicValue) -> Self::Signal
Get a graph signal which represents the constant
value.Source§fn get_constant_value(&self, signal: Self::Signal) -> Option<Self::LogicValue>
fn get_constant_value(&self, signal: Self::Signal) -> Option<Self::LogicValue>
Get the value of a signal if it is a constant.
Source§fn get_node_input(
&self,
node: &Self::Signal,
input_index: usize,
) -> Self::Signal
fn get_node_input( &self, node: &Self::Signal, input_index: usize, ) -> Self::Signal
Get an input value of a node.
Source§fn get_source_node(&self, signal: &Self::Signal) -> Self::NodeId
fn get_source_node(&self, signal: &Self::Signal) -> Self::NodeId
Get the node which computes a signal.
Source§fn get_primary_input(&self, index: usize) -> Self::Signal
fn get_primary_input(&self, index: usize) -> Self::Signal
Get a primary input by its index.
Source§fn get_primary_output(&self, index: usize) -> Self::Signal
fn get_primary_output(&self, index: usize) -> Self::Signal
Get a primary output by its index.
Source§fn is_constant(&self, signal: Self::Signal) -> bool
fn is_constant(&self, signal: Self::Signal) -> bool
Tell if the signal is directly connected to a constant.
Source§fn node_function(&self, node: Self::Signal) -> Self::NodeFunction
fn node_function(&self, node: Self::Signal) -> Self::NodeFunction
Get the logic function implemented by the given node.
Source§fn num_node_inputs(&self, node: &Self::Signal) -> usize
fn num_node_inputs(&self, node: &Self::Signal) -> usize
Number of inputs into the given node.
Source§fn get_node_output(&self, node: &Self::NodeId) -> Self::Signal
fn get_node_output(&self, node: &Self::NodeId) -> Self::Signal
Get the output signal of a node.
Source§impl<Node> NetworkEdit for LogicNetwork<Node>where
Node: NetworkNode<NodeId = NodeId> + Hash + Eq + MutNetworkNodeWithReferenceCount + IntoIterator<Item = NodeId>,
impl<Node> NetworkEdit for LogicNetwork<Node>where
Node: NetworkNode<NodeId = NodeId> + Hash + Eq + MutNetworkNodeWithReferenceCount + IntoIterator<Item = NodeId>,
Source§fn create_primary_input(&mut self) -> Self::Signal
fn create_primary_input(&mut self) -> Self::Signal
Create a new input into the network.
Source§fn create_primary_output(&mut self, signal: Self::Signal) -> Self::Signal
fn create_primary_output(&mut self, signal: Self::Signal) -> Self::Signal
Create an output of the network.
Source§fn substitute(&mut self, old: Self::Signal, new: Self::Signal)
fn substitute(&mut self, old: Self::Signal, new: Self::Signal)
Substitute the
old signal with the new signal in all nodes.Source§fn create_node(&mut self, node: Self::Node) -> Self::NodeId
fn create_node(&mut self, node: Self::Node) -> Self::NodeId
Insert a new node into the network.
Returns the ID of the new node. This function can also return IDs that already existed before.
For example if there is already a node with the same inputs.
Source§fn foreach_node_mut(&mut self, f: impl Fn(&mut Self::Node))
fn foreach_node_mut(&mut self, f: impl Fn(&mut Self::Node))
Visit all logic nodes as mutable references.
Source§impl<Node> NumInputs for LogicNetwork<Node>
impl<Node> NumInputs for LogicNetwork<Node>
Source§fn num_inputs(&self) -> usize
fn num_inputs(&self) -> usize
Get the number of inputs of the boolean function.
Source§impl<Node> NumOutputs for LogicNetwork<Node>
impl<Node> NumOutputs for LogicNetwork<Node>
Source§fn num_outputs(&self) -> usize
fn num_outputs(&self) -> usize
Get the number of outputs of the boolean function.
Source§impl<Node> PartialBooleanSystem for LogicNetwork<Node>where
Node: NetworkNode<NodeId = NodeId>,
impl<Node> PartialBooleanSystem for LogicNetwork<Node>where
Node: NetworkNode<NodeId = NodeId>,
Source§impl<Node> ReferenceCounted for LogicNetwork<Node>
impl<Node> ReferenceCounted for LogicNetwork<Node>
Source§fn num_references(&self, a: Self::Signal) -> usize
fn num_references(&self, a: Self::Signal) -> usize
Count the number of nodes which have the signal
a in their fan-in.Auto Trait Implementations§
impl<Node> Freeze for LogicNetwork<Node>
impl<Node> RefUnwindSafe for LogicNetwork<Node>where
Node: RefUnwindSafe,
impl<Node> Send for LogicNetwork<Node>where
Node: Send,
impl<Node> Sync for LogicNetwork<Node>where
Node: Sync,
impl<Node> Unpin for LogicNetwork<Node>where
Node: Unpin,
impl<Node> UnwindSafe for LogicNetwork<Node>where
Node: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> NetworkEditShortcuts for Twhere
T: NetworkEdit,
impl<T> NetworkEditShortcuts for Twhere
T: NetworkEdit,
Source§fn create_primary_inputs<const NUM_INPUTS: usize>(
&mut self,
) -> [Self::Signal; NUM_INPUTS]
fn create_primary_inputs<const NUM_INPUTS: usize>( &mut self, ) -> [Self::Signal; NUM_INPUTS]
Create many inputs at once.