SDNSim
A software-defined network simulator in C++
|
Represents a network device (like a router or switch) in the SDN simulation. More...
#include <Device.h>
Public Member Functions | |
Device (const std::string &deviceName) | |
Constructs a Device with the given name. | |
std::string | getName () const |
Gets the name of the device. | |
const std::vector< std::string > & | getNeighbors () const |
Gets a reference to the list of neighbors. | |
void | addNeighbor (const std::string &neighborName) |
Adds a neighbor to this device. | |
bool | isActive () const |
Checks if the device is currently active. | |
void | setActive (bool status) |
Sets the device's active status. | |
Represents a network device (like a router or switch) in the SDN simulation.
Stores device name, neighbors, and active state.
Device::Device | ( | const std::string & | deviceName | ) |
Constructs a Device with the given name.
deviceName | Name to assign to this device. |
Initializes the device with the specified identifier.
deviceName | The name assigned to this device. |
Definition at line 12 of file Device.cpp.
void Device::addNeighbor | ( | const std::string & | neighborName | ) |
Adds a neighbor to this device.
Adds a neighbor to this device's list.
neighborName | The name of the neighboring device to connect. |
neighborName | The name of the device to connect as a neighbor. |
Definition at line 43 of file Device.cpp.
std::string Device::getName | ( | ) | const |
Gets the name of the device.
Retrieves the name of the device.
Definition at line 22 of file Device.cpp.
const std::vector< std::string > & Device::getNeighbors | ( | ) | const |
Gets a reference to the list of neighbors.
Gets the list of neighboring device names.
Definition at line 33 of file Device.cpp.
bool Device::isActive | ( | ) | const |
Checks if the device is currently active.
Definition at line 53 of file Device.cpp.
void Device::setActive | ( | bool | status | ) |
Sets the device's active status.
status | True to activate, false to deactivate. |
status | True to mark the device as active, false for inactive. |
Definition at line 63 of file Device.cpp.