Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-devel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
143
Issues
143
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
emulab
emulab-devel
Commits
3dbafb46
Commit
3dbafb46
authored
Jul 11, 2003
by
Robert Ricci
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a type-checking prepass for vclasses.
parent
d2666ba7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
4 deletions
+25
-4
assign/assign.cc
assign/assign.cc
+22
-0
assign/common.h
assign/common.h
+1
-0
assign/parse_top.cc
assign/parse_top.cc
+2
-4
No files found.
assign/assign.cc
View file @
3dbafb46
...
...
@@ -57,6 +57,7 @@ name_count_map ptypes;
// List of virtual types by name.
name_count_map
vtypes
;
name_list_map
vclasses
;
// A list of all pclasses.
pclass_list
pclasses
;
...
...
@@ -322,6 +323,7 @@ int type_precheck() {
bool
ok
=
true
;
// First, check the regular types
for
(
name_count_map
::
iterator
vtype_it
=
vtypes
.
begin
();
vtype_it
!=
vtypes
.
end
();
++
vtype_it
)
{
...
...
@@ -341,6 +343,26 @@ int type_precheck() {
}
}
}
// Check the vclasses, too
for
(
name_list_map
::
iterator
vclass_it
=
vclasses
.
begin
();
vclass_it
!=
vclasses
.
end
();
++
vclass_it
)
{
bool
found_match
=
false
;
for
(
vector
<
crope
>::
iterator
vtype_it
=
vclass_it
->
second
.
begin
();
vtype_it
!=
vclass_it
->
second
.
end
();
vtype_it
++
)
{
if
(
ptypes
.
find
(
*
vtype_it
)
!=
ptypes
.
end
())
{
found_match
=
true
;
break
;
}
}
if
(
!
found_match
)
{
cout
<<
" *** No physical nodes can satisfy vclass "
<<
vclass_it
->
first
<<
endl
;
ok
=
false
;
}
}
if
(
ok
)
{
cout
<<
"Type preecheck passed."
<<
endl
;
return
1
;
...
...
assign/common.h
View file @
3dbafb46
...
...
@@ -150,6 +150,7 @@ typedef slist<crope> name_slist;
* Used to count the number of nodes in each ptype and vtype
*/
typedef
hash_map
<
crope
,
int
>
name_count_map
;
typedef
hash_map
<
crope
,
vector
<
crope
>
>
name_list_map
;
/*
* A hash function for pointers
...
...
assign/parse_top.cc
View file @
3dbafb46
...
...
@@ -31,6 +31,7 @@ using namespace boost;
extern
name_vvertex_map
vname2vertex
;
extern
name_name_map
fixed_nodes
;
extern
name_count_map
vtypes
;
extern
name_list_map
vclasses
;
extern
vvertex_vector
virtual_nodes
;
#define top_error(s) errors++;cerr << "TOP:" << line << ": " << s << endl
...
...
@@ -236,10 +237,7 @@ int parse_top(tb_vgraph &VG, istream& i)
vclass_map
[
name
]
=
v
;
for
(
unsigned
int
i
=
3
;
i
<
parsed_line
.
size
();
++
i
)
{
v
->
add_type
(
parsed_line
[
i
]);
// XXX - in order not to break vtypes, we don't put them in the
// vtypes map (otherwise, the type precheck would complain, but the
// top may still be mappable).
//vtypes.push_front(parsed_line[i]);
vclasses
[
name
].
push_back
(
parsed_line
[
i
]);
}
}
}
else
if
(
command
.
compare
(
"fix-node"
)
==
0
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment