nns.c
1.0.1
Nanowire Network simulator
|
Defines the structure of the nanowire-network device interface to the external world. More...
Go to the source code of this file.
Classes | |
struct | interface |
Interface between the nanowire-network device and external systems. More... | |
Functions | |
int | itcmp (const void *e1, const void *e2) |
Compare two network interfaces according to the number of sources, grounds, and loads. More... | |
interface | copy_interface (const interface it) |
Create a deep copy of an interface. More... | |
void | destroy_interface (interface it) |
Destroy an interface memorized in the stack. This function practically frees the masks and weights of the interface. The arrays to be freed must have been allocated in the heap with malloc/calloc. More... | |
Defines the structure of the nanowire-network device interface to the external world.
This file defines the data structures and functions for interfacing with a nanowire-network device. It includes functionality for comparing, copying, and destroying interfaces.
The interface is represented by the interface
structure, which holds information about sources, grounds, loads and weights, and index of the nanowire they are connected to. The provided functions allow for the comparison of interfaces, creation of deep copies, and proper cleanup of allocated resources.
interface
uses dynamically allocated memory that must be managed using the provided functions. Create a deep copy of an interface.
[in] | it | The interface to copy. |
void destroy_interface | ( | interface | it | ) |
Destroy an interface memorized in the stack. This function practically frees the masks and weights of the interface. The arrays to be freed must have been allocated in the heap with malloc/calloc.
[in,out] | it | The interface to destroy. |
int itcmp | ( | const void * | e1, |
const void * | e2 | ||
) |
Compare two network interfaces according to the number of sources, grounds, and loads.
[in] | e1 | Pointer to the first element to compare. |
[in] | e2 | Pointer to the second element to compare. |