My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
node.cpp
Go to the documentation of this file.
1 /*
2  * node.cpp - node class implementation
3  *
4  * Copyright (C) 2003, 2004 Stefan Jahn <stefan@lkcc.org>
5  *
6  * This is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2, or (at your option)
9  * any later version.
10  *
11  * This software is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this package; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
19  * Boston, MA 02110-1301, USA.
20  *
21  * $Id: node.cpp 1825 2011-03-11 20:42:14Z ela $
22  *
23  */
24 
25 #if HAVE_CONFIG_H
26 # include <config.h>
27 #endif
28 
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <string.h>
32 
33 #include "complex.h"
34 #include "object.h"
35 #include "node.h"
36 
37 // Constructor creates an unnamed instance of the node class.
38 node::node () : object () {
39  internal = port = nNode = 0;
40  _circuit = NULL;
41 }
42 
43 // Constructor creates a named instance of the node class.
44 node::node (char * n) : object (n) {
45  internal = port = nNode = 0;
46  _circuit = NULL;
47 }
48 
49 /* The copy constructor creates a new instance of the node class based
50  on the given node object. */
51 node::node (const node & n) : object (n) {
52  internal = n.internal;
53  port = n.port;
54  nNode = n.nNode;
55  _circuit = n._circuit;
56 }
57 
58 // Destructor destroys a node object.
59 node::~node () {
60 }
61 
62 
63 // Sets the unique number of this node.
64 void node::setNode (int n) {
65  nNode = n;
66 }
67 
68 // Returns the unique number of this node.
69 int node::getNode (void) {
70  return nNode;
71 }
72 
73 // Sets the port number of this node.
74 void node::setPort (int n) {
75  port = n;
76 }
77 
78 // Returns the port number of this node.
79 int node::getPort (void) {
80  return port;
81 }
82 
83 // Sets this node's circuit.
85  _circuit = c;
86 }
87 
88 // Returns this node's circuit.
90  return _circuit;
91 }