Qucs-core
0.0.18
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
qucs-core
src
nodeset.cpp
Go to the documentation of this file.
1
/*
2
* nodeset.cpp - node set class implementation
3
*
4
* Copyright (C) 2004, 2008 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$
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 "
object.h
"
34
#include "
netdefs.h
"
35
#include "
nodeset.h
"
36
37
namespace
qucs
{
38
39
// Constructor creates an unnamed instance of the node set class.
40
nodeset::nodeset
() {
41
name
= NULL;
42
value
= 0.0;
43
next
= NULL;
44
}
45
46
// Constructor creates a named instance of the node set class.
47
nodeset::nodeset
(
char
*
n
) {
48
name
= n ? strdup (n) : NULL;
49
value
= 0.0;
50
next
= NULL;
51
}
52
53
/* This full qualified constructor creates an instance of the node set
54
class containing both the key and the value of the node set. */
55
nodeset::nodeset
(
char
*
n
, nr_double_t val) {
56
name
= n ? strdup (n) : NULL;
57
value
= val;
58
next
= NULL;
59
}
60
61
/* The copy constructor creates a new instance of the node set class
62
based on the given node set object. */
63
nodeset::nodeset
(
const
nodeset
& p) {
64
name
= NULL;
65
if
(p.
name
)
name
= strdup (p.
name
);
66
value
= p.
value
;
67
next
= p.
next
;
68
}
69
70
// Destructor deletes the node set object.
71
nodeset::~nodeset
() {
72
if
(
name
)
free
(
name
);
73
}
74
75
// Sets the name of the node set.
76
void
nodeset::setName
(
char
*
n
) {
77
if
(
name
)
free
(
name
);
78
name
= n ? strdup (n) : NULL;
79
}
80
81
// Returns the name of the node set.
82
char
*
nodeset::getName
(
void
) {
83
return
name
;
84
}
85
86
/* Goes through the chained list of the node sets and looks for a node
87
set matching the given key and returns its value if possible. If
88
there is no such node set the function returns NULL. */
89
nodeset
*
nodeset::findNodeset
(
char
*
n
) {
90
for
(
nodeset
* p =
this
; p != NULL; p = p->
getNext
()) {
91
if
(!strcmp (p->getName (),
n
))
return
p;
92
}
93
return
NULL;
94
}
95
96
// properties
97
PROP_REQ
[] = {
98
{
"U"
,
PROP_REAL
, { 0,
PROP_NO_STR
},
PROP_NO_RANGE
},
PROP_NO_PROP
};
99
PROP_OPT
[] = {
100
PROP_NO_PROP
};
101
struct
define_t
nodeset
::miscdef =
102
{
"NodeSet"
, 1,
PROP_COMPONENT
,
PROP_NO_SUBSTRATE
,
PROP_LINEAR
,
PROP_DEF
};
103
104
}
// namespace qucs
qucs::nodeset::findNodeset
nodeset * findNodeset(char *)
Definition:
nodeset.cpp:89
qucs::nodeset::setName
void setName(char *)
Definition:
nodeset.cpp:76
PROP_DEF
#define PROP_DEF
Definition:
netdefs.h:189
qucs::PROP_OPT
PROP_OPT[]
Definition:
acsolver.cpp:232
PROP_REAL
#define PROP_REAL
Definition:
netdefs.h:174
qucs::nodeset::name
char * name
Definition:
nodeset.h:47
PROP_NO_PROP
#define PROP_NO_PROP
Definition:
netdefs.h:122
nodeset.h
PROP_NO_RANGE
#define PROP_NO_RANGE
Definition:
netdefs.h:126
PROP_NO_STR
#define PROP_NO_STR
Definition:
netdefs.h:125
n
n
Definition:
parse_citi.y:147
PROP_LINEAR
#define PROP_LINEAR
Definition:
netdefs.h:120
qucs::nodeset::getName
char * getName(void)
Definition:
nodeset.cpp:82
qucs::nodeset::PROP_NO_SUBSTRATE
PROP_NO_SUBSTRATE
Definition:
nodeset.cpp:102
netdefs.h
PROP_COMPONENT
#define PROP_COMPONENT
Definition:
netdefs.h:116
qucs::nodeset::next
nodeset * next
Definition:
nodeset.h:49
free
free($1)
qucs
Definition:
applications.h:30
qucs::nodeset::getNext
nodeset * getNext(void)
Definition:
nodeset.h:38
qucs::nodeset
Definition:
nodeset.cpp:101
qucs::nodeset::value
nr_double_t value
Definition:
nodeset.h:48
object.h
qucs::nodeset::nodeset
nodeset(char *)
Definition:
nodeset.cpp:47
qucs::nodeset::~nodeset
virtual ~nodeset()
Definition:
nodeset.cpp:71
qucs::PROP_REQ
PROP_REQ[]
Definition:
acsolver.cpp:229
define_t
Definition:
netdefs.h:102
Generated on Mon Sep 1 2014 20:08:26 for Qucs-core by
1.8.6