SDNSim
A software-defined network simulator in C++
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Device Class Reference

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.
 

Detailed Description

Represents a network device (like a router or switch) in the SDN simulation.

Stores device name, neighbors, and active state.

Definition at line 11 of file Device.h.

Constructor & Destructor Documentation

◆ Device()

Device::Device ( const std::string &  deviceName)

Constructs a Device with the given name.

Parameters
deviceNameName to assign to this device.

Initializes the device with the specified identifier.

Parameters
deviceNameThe name assigned to this device.

Definition at line 12 of file Device.cpp.

Member Function Documentation

◆ addNeighbor()

void Device::addNeighbor ( const std::string &  neighborName)

Adds a neighbor to this device.

Adds a neighbor to this device's list.

Parameters
neighborNameThe name of the neighboring device to connect.
Parameters
neighborNameThe name of the device to connect as a neighbor.

Definition at line 43 of file Device.cpp.

◆ getName()

std::string Device::getName ( ) const

Gets the name of the device.

Retrieves the name of the device.

Returns
A copy of the device name.
Returns
The name of the device as a string.

Definition at line 22 of file Device.cpp.

◆ getNeighbors()

const std::vector< std::string > & Device::getNeighbors ( ) const

Gets a reference to the list of neighbors.

Gets the list of neighboring device names.

Returns
Const reference to the vector of neighbor names.
Returns
A const reference to a vector of neighbor names.

Definition at line 33 of file Device.cpp.

◆ isActive()

bool Device::isActive ( ) const

Checks if the device is currently active.

Returns
True if active, false if inactive.
Returns
True if the device is active, false otherwise.

Definition at line 53 of file Device.cpp.

◆ setActive()

void Device::setActive ( bool  status)

Sets the device's active status.

Parameters
statusTrue to activate, false to deactivate.
Parameters
statusTrue to mark the device as active, false for inactive.

Definition at line 63 of file Device.cpp.


The documentation for this class was generated from the following files: