2 * "adp" container -- list of aging parms
8 /*--------------------------------------------------------------------------*/
14 /*--------------------------------------------------------------------------*/
20 /*--------------------------------------------------------------------------*/
21 class INTERFACE ADP_LIST
{ // cardlist, needed?
23 const ADP_LIST
* _parent
;
24 mutable NODE_MAP
* _nm
;
25 mutable PARAM_LIST
* _params
;
27 std::list
<ADP_CARD
*> _al
;
30 typedef std::list
<ADP_CARD
*>::iterator iterator
;
31 typedef std::list
<ADP_CARD
*>::const_iterator const_iterator
;
37 explicit fat_iterator() {unreachable();}
39 fat_iterator(const fat_iterator
& p
)
40 : _list(p
._list
), _iter(p
._iter
) {}
41 explicit fat_iterator(ADP_LIST
* l
, iterator i
)
42 : _list(l
), _iter(i
) {}
43 bool is_end()const {return _iter
== _list
->end();}
44 ADP_CARD
* operator*() {return (is_end()) ? NULL
: *_iter
;}
45 fat_iterator
& operator++() {assert(!is_end()); ++_iter
; return *this;}
46 fat_iterator
operator++(int)
47 {assert(!is_end()); fat_iterator
t(*this); ++_iter
; return t
;}
48 bool operator==(const fat_iterator
& x
)const
49 {unreachable(); assert(_list
==x
._list
); return (_iter
==x
._iter
);}
50 bool operator!=(const fat_iterator
& x
)const
51 {assert(_list
==x
._list
); return (_iter
!=x
._iter
);}
52 iterator
iter()const {return _iter
;}
53 ADP_LIST
* list()const {return _list
;}
54 fat_iterator
end()const {return fat_iterator(_list
, _list
->end());}
56 //void insert(ADP_CARD* c) {list()->insert(iter(),c);}
60 bool is_empty()const {return _al
.empty();}
61 const ADP_LIST
* parent()const {return _parent
;}
62 const LANGUAGE
* language()const {untested(); return _language
;}
65 iterator
begin() {return _al
.begin();}
66 iterator
end() {return _al
.end();}
67 iterator
find_again(const std::string
& short_name
, iterator
);
68 iterator
find_(const std::string
& short_name
)
69 {return find_again(short_name
, begin());}
71 ADP_LIST
& erase(iterator i
);
72 ADP_LIST
& erase(ADP_CARD
* c
);
73 ADP_LIST
& erase_all();
75 ADP_LIST
& do_forall( void (ADP_CARD::*thing
)( void ) );
78 // return a const_iterator
79 const_iterator
begin()const {return _al
.begin();}
80 const_iterator
end()const {return _al
.end();}
81 const_iterator
find_again(const std::string
& short_name
, const_iterator
)const;
82 const_iterator
find_(const std::string
& short_name
)const
83 {return find_again(short_name
, begin());}
89 ADP_LIST
& push_front(ADP_CARD
* c
) {_al
.push_front(c
); return *this;}
90 ADP_LIST
& push_back(ADP_CARD
* c
) {_al
.push_back(c
); return *this;}
93 TIME_PAIR
tt_review() const;
94 ADP_LIST
& tr_accept();
96 TIME_PAIR
tt_preview();
100 NODE_MAP
* nodes()const {assert(_nm
); return _nm
;}
101 PARAM_LIST
* params();
102 PARAM_LIST
* params()const;
104 // more complex stuff
105 void attach_params(PARAM_LIST
* p
, const ADP_LIST
* scope
);
106 void shallow_copy(const ADP_LIST
*);
107 void map_subckt_nodes(const ADP_CARD
* model
, const ADP_CARD
* owner
);
110 ADP_LIST(const ADP_CARD
* model
, ADP_CARD
* owner
, const ADP_LIST
* scope
,
114 explicit ADP_LIST(const ADP_LIST
&) {unreachable(); incomplete();}
116 static ADP_LIST adp_list
; // in globals.cc
118 /*--------------------------------------------------------------------------*/
119 /*--------------------------------------------------------------------------*/
120 /*--------------------------------------------------------------------------*/
121 class INTERFACE ADP_NODE_LIST
{
123 const ADP_NODE_LIST
* _parent
;
124 mutable NODE_MAP
* _nm
;
125 mutable PARAM_LIST
* _params
;
127 std::list
<ADP_NODE
*> _al
;
130 typedef std::list
<ADP_NODE
*>::iterator iterator
;
131 typedef std::list
<ADP_NODE
*>::const_iterator const_iterator
;
134 ADP_NODE_LIST
* _list
;
137 explicit fat_iterator() {unreachable();}
139 fat_iterator(const fat_iterator
& p
)
140 : _list(p
._list
), _iter(p
._iter
) {}
141 explicit fat_iterator(ADP_NODE_LIST
* l
, iterator i
)
142 : _list(l
), _iter(i
) {}
143 bool is_end()const {return _iter
== _list
->end();}
144 ADP_NODE
* operator*() {return (is_end()) ? NULL
: *_iter
;}
145 fat_iterator
& operator++() {assert(!is_end()); ++_iter
; return *this;}
146 fat_iterator
operator++(int)
147 {assert(!is_end()); fat_iterator
t(*this); ++_iter
; return t
;}
148 bool operator==(const fat_iterator
& x
)const
149 {unreachable(); assert(_list
==x
._list
); return (_iter
==x
._iter
);}
150 bool operator!=(const fat_iterator
& x
)const
151 {assert(_list
==x
._list
); return (_iter
!=x
._iter
);}
152 iterator
iter()const {return _iter
;}
153 ADP_NODE_LIST
* list()const {return _list
;}
154 fat_iterator
end()const {return fat_iterator(_list
, _list
->end());}
156 //void insert(ADP_NODE* c) {list()->insert(iter(),c);}
160 bool is_empty()const {return _al
.empty();}
161 const ADP_NODE_LIST
* parent()const {return _parent
;}
162 const LANGUAGE
* language()const {untested(); return _language
;}
164 // return an iterator
165 iterator
begin() {return _al
.begin();}
166 iterator
end() {return _al
.end();}
167 iterator
find_again(const std::string
& short_name
, iterator
);
168 iterator
find_(const std::string
& short_name
)
169 {return find_again(short_name
, begin());}
171 ADP_NODE_LIST
& erase(iterator i
);
172 ADP_NODE_LIST
& erase(ADP_NODE
* c
);
173 ADP_NODE_LIST
& erase_all();
174 ADP_NODE_LIST
& expand();
175 ADP_NODE_LIST
& do_forall( void (ADP_NODE::*thing
)( void ) );
180 // return a const_iterator
181 const_iterator
begin()const {return _al
.begin();}
182 const_iterator
end()const {return _al
.end();}
183 const_iterator
find_again(const std::string
& short_name
, const_iterator
)const;
184 const_iterator
find_(const std::string
& short_name
)const
185 {return find_again(short_name
, begin());}
190 //ADP_NODE_LIST& insert(ADP::iterator i, ADP_NODE* c) {
191 // _al.insert(i, c); return *this;
194 ADP_NODE_LIST
& push_front(ADP_NODE
* c
) {_al
.push_front(c
); return *this;}
195 ADP_NODE_LIST
& push_back(ADP_NODE
* c
) {_al
.push_back(c
); return *this;}
198 TIME_PAIR
tt_review();
200 TIME_PAIR
tt_preview();
202 ADP_NODE_LIST
& save();
204 NODE_MAP
* nodes()const {assert(_nm
); return _nm
;}
205 PARAM_LIST
* params();
206 PARAM_LIST
* params()const;
208 // more complex stuff
209 void attach_params(PARAM_LIST
* p
, const ADP_NODE_LIST
* scope
);
210 void shallow_copy(const ADP_NODE_LIST
*);
211 void map_subckt_nodes(const ADP_NODE
* model
, const ADP_NODE
* owner
);
213 explicit ADP_NODE_LIST();
214 ADP_NODE_LIST(const ADP_NODE
* model
, ADP_NODE
* owner
, const ADP_NODE_LIST
* scope
,
218 explicit ADP_NODE_LIST(const ADP_NODE_LIST
&) {unreachable(); incomplete();}
220 static ADP_NODE_LIST adp_node_list
; // in globals.cc
222 /*--------------------------------------------------------------------------*/
223 /*--------------------------------------------------------------------------*/