/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file Node.h14/// @author Jakub Sevcik (RICE)15/// @author Jan Prikryl (RICE)16/// @date 2019-12-1517///18/// @note based on work 2017 Ahmad Khaled, Ahmad Essam, Omnia Zakaria, Mary Nader19///20// Representation of electric circuit nodes, i.e. wire junctions and connection points.21/****************************************************************************/22#pragma once23#include <config.h>2425#include <vector>26#include <string>272829// ===========================================================================30// class declarations31// ===========================================================================32class Element;333435// ===========================================================================36// class definitions37// ===========================================================================38class Node {3940private:41bool isground;42bool isremovable;43std::string name; // unique property, each object has distinctive and unique name44int id; // a sequential ID number, might be useful when making the equation45int num_matrixRow; // number of matrix row during solving the equations46int num_matrixCol; // number of matrix column during solving the equations47double voltage;48std::vector<Element*>* elements; // too lazy to implement a linked list49// each node is connected to one or more element, an element is a resistor or voltage/current source5051public:52// A constructor, same functionality as "init" functions53Node(std::string name, int id);5455// connects an element to the node56void addElement(Element* element);57// disconnects an element to the node58void eraseElement(Element* element);59// getters and setters60double getVoltage();61void setVoltage(double volt);62int getNumOfElements();63// iterates through the vector of the node's elements and returns the first, which is not equal to "element" in the argument of the function64Element* getAnOtherElement(Element* element);65std::string& getName();66bool isGround();67bool isRemovable() const {68return isremovable;69}70void setGround(bool isground);71int getId();72void setNumMatrixRow(int num);73int getNumMatrixRow();74void setNumMatrixCol(int num);75int getNumMatrixCol();76void setId(int id);77std::vector<Element*>* getElements();78void setRemovability(bool isremovable);79};808182