Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
codes
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
38
Issues
38
List
Boards
Labels
Milestones
Merge Requests
8
Merge Requests
8
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
codes
codes
Commits
ff49f3cd
Commit
ff49f3cd
authored
Feb 21, 2018
by
Neil McGlohon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Connection Manager: add connection getter by type
parent
2eb33642
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
3 deletions
+39
-3
codes/connection-manager.h
codes/connection-manager.h
+39
-3
No files found.
codes/connection-manager.h
View file @
ff49f3cd
...
...
@@ -176,6 +176,13 @@ public:
*/
vector
<
Connection
>
get_connections_to_group
(
int
dest_group_id
);
/**
* @brief returns a vector of all connections to routers via type specified.
* @param type the type of the connection, CONN_LOCAL, CONN_GLOBAL, or CONN_TERMINAL
* @note this will return connections to same destination on different ports as individual connections
*/
vector
<
Connection
>
get_connections_by_type
(
ConnectionType
type
);
/**
* @brief prints out the state of the connection manager
*/
...
...
@@ -383,6 +390,33 @@ vector< Connection > ConnectionManager::get_connections_to_group(int dest_group_
return
conns_to_group
;
}
vector
<
Connection
>
ConnectionManager
::
get_connections_by_type
(
ConnectionType
type
)
{
map
<
int
,
vector
<
Connection
>
>
theMap
;
switch
(
type
)
{
case
CONN_LOCAL
:
theMap
=
intraGroupConnections
;
break
;
case
CONN_GLOBAL
:
theMap
=
globalConnections
;
break
;
case
CONN_TERMINAL
:
theMap
=
terminalConnections
;
break
;
}
vector
<
Connection
>
retVec
;
map
<
int
,
vector
<
Connection
>
>::
iterator
it
;
for
(
it
=
theMap
.
begin
();
it
!=
theMap
.
end
();
it
++
)
{
retVec
.
insert
(
retVec
.
end
(),
(
*
it
).
second
.
begin
(),
(
*
it
).
second
.
end
());
}
return
retVec
;
}
void
ConnectionManager
::
print_connections
()
{
printf
(
"Connections for Router: %d ---------------------------------------
\n
"
,
_source_id_global
);
...
...
@@ -391,17 +425,17 @@ void ConnectionManager::print_connections()
map
<
int
,
Connection
>::
iterator
it
=
_portMap
.
begin
();
for
(;
it
!=
_portMap
.
end
();
it
++
)
{
if
(
ports_printed
==
0
)
if
(
(
ports_printed
==
0
)
&&
(
_used_intra_ports
>
0
)
)
{
printf
(
" -- Intra-Group Connections --
\n
"
);
printf
(
" Port | Dest_ID | Group
\n
"
);
}
if
(
ports_printed
==
_max_intra_ports
)
if
(
(
ports_printed
==
_used_intra_ports
)
&&
(
_used_inter_ports
>
0
)
)
{
printf
(
" -- Inter-Group Connections --
\n
"
);
printf
(
" Port | Dest_ID | Group
\n
"
);
}
if
(
ports_printed
==
_max_intra_ports
+
_max_inter_ports
)
if
(
(
ports_printed
==
_used_intra_ports
+
_used_inter_ports
)
&&
(
_used_terminal_ports
>
0
)
)
{
printf
(
" -- Terminal Connections --
\n
"
);
printf
(
" Port | Dest_ID | Group
\n
"
);
...
...
@@ -412,4 +446,6 @@ void ConnectionManager::print_connections()
}
}
#endif
/* end of include guard:*/
\ No newline at end of file
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