-
Notifications
You must be signed in to change notification settings - Fork 0
/
Resistor.h
47 lines (33 loc) · 1.06 KB
/
Resistor.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#ifndef RESISTOR_H
#define RESISTOR_H
#include <string>
#include <iostream>
#include <iomanip>
using namespace std;
class ResistorList;
class NodeList;
class Resistor
{
private:
double resistance; // resistance (in Ohms)
string name; // C++ string holding the label
int endpointNodeIDs[2]; // IDs of nodes it attaches to
Resistor* nextR;
int resID;
float xleftR, ybottomR, xrightR, ytopR;
public:
Resistor(string name_,double resistance_,int endpoints_[2], int resID_);
// endpoints_ holds the node indices to which this resistor connects
~Resistor();
friend class ResistorList;
friend class NodeList;
double getResistance();
int getOtherEnd(int node);
Resistor* getNextR();
void getCoords(float& xleft, float& ybottom, float& xright, float& ytop);
void setCoords(float xleft, float ybottom, float xright, float ytop);
// you *may* create either of the below to print your resistor
//void print ();
friend ostream& operator<<(ostream&,const Resistor&);
};
#endif /* RESISTOR_H */