Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TDTS04Lab4cpp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christoffer Lundell
TDTS04Lab4cpp
Commits
313fa15e
Commit
313fa15e
authored
1 year ago
by
Christoffer Lundell
Browse files
Options
Downloads
Patches
Plain Diff
Minor improvements
parent
6046bab6
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/RouterNode.h
+1
-1
1 addition, 1 deletion
include/RouterNode.h
src/GuiTextArea.cpp
+1
-1
1 addition, 1 deletion
src/GuiTextArea.cpp
src/RouterSimulator.cpp
+6
-6
6 additions, 6 deletions
src/RouterSimulator.cpp
with
8 additions
and
8 deletions
include/RouterNode.h
+
1
−
1
View file @
313fa15e
...
@@ -11,7 +11,7 @@ class RouterSimulator;
...
@@ -11,7 +11,7 @@ class RouterSimulator;
class
RouterNode
{
class
RouterNode
{
public:
public:
RouterNode
(
const
RouterNode
&
)
=
delete
;
RouterNode
(
const
RouterNode
&
)
=
delete
;
// std::vector
requires RouterNode to be
move
-
construct
ible
// std::vector
<RouterNode> in RouterSimulator.h requires
move
construct
or
RouterNode
(
RouterNode
&&
)
=
default
;
RouterNode
(
RouterNode
&&
)
=
default
;
RouterNode
&
operator
=
(
const
RouterNode
&
)
=
delete
;
RouterNode
&
operator
=
(
const
RouterNode
&
)
=
delete
;
RouterNode
&
operator
=
(
RouterNode
&&
)
=
delete
;
RouterNode
&
operator
=
(
RouterNode
&&
)
=
delete
;
...
...
This diff is collapsed.
Click to expand it.
src/GuiTextArea.cpp
+
1
−
1
View file @
313fa15e
...
@@ -17,7 +17,7 @@ GuiTextArea::GuiTextArea(string const& title)
...
@@ -17,7 +17,7 @@ GuiTextArea::GuiTextArea(string const& title)
textedit
->
setFont
(
font
);
textedit
->
setFont
(
font
);
textedit
->
setReadOnly
(
true
);
textedit
->
setReadOnly
(
true
);
myGUI
->
setCentralWidget
(
textedit
);
myGUI
->
setCentralWidget
(
textedit
);
myGUI
->
set
Fixed
Size
(
600
,
600
);
myGUI
->
set
Minimum
Size
(
600
,
600
);
myGUI
->
setWindowTitle
(
QString
::
fromStdString
(
title
));
myGUI
->
setWindowTitle
(
QString
::
fromStdString
(
title
));
myGUI
->
show
();
myGUI
->
show
();
}
}
...
...
This diff is collapsed.
Click to expand it.
src/RouterSimulator.cpp
+
6
−
6
View file @
313fa15e
...
@@ -26,8 +26,9 @@
...
@@ -26,8 +26,9 @@
* This version strives to stay as close as possible to the original Java and
* This version strives to stay as close as possible to the original Java and
* Python code with a few differences:
* Python code with a few differences:
* - Windowing system is initialized in RouterSimulator::main
* - Windowing system is initialized in RouterSimulator::main
* - Events and packets need to be `delete`d from the heap since C++ does not
* - Events and packets are `delete`d from the heap in
* have garbage collection.
* RouterSimulator::runSimulation since C++ does not have garbage
* collection.
* - Long option "--poison" is now called "--poisonreverse"
* - Long option "--poison" is now called "--poisonreverse"
*
*
* Entry point: RouterSimulator::main(argc, argv)
* Entry point: RouterSimulator::main(argc, argv)
...
@@ -361,8 +362,7 @@ void RouterSimulator::toLayer2(RouterPacket& packet) {
...
@@ -361,8 +362,7 @@ void RouterSimulator::toLayer2(RouterPacket& packet) {
}
}
void
RouterSimulator
::
initialize
(
int
argc
,
char
*
argv
[])
{
void
RouterSimulator
::
initialize
(
int
argc
,
char
*
argv
[])
{
string
inputInfo
=
"./RouterSimulator "
string
inputInfo
=
"-c, --change <LINKCHANGE (bool)> "
"-c, --change <LINKCHANGE (bool)> "
"-n, --nodes <NODES (int)> "
"-n, --nodes <NODES (int)> "
"-p, --poisonreverse <POISONREVERSE (bool)> "
"-p, --poisonreverse <POISONREVERSE (bool)> "
"-s, --seed <SEED (long)> "
"-s, --seed <SEED (long)> "
...
@@ -415,13 +415,13 @@ void RouterSimulator::initialize(int argc, char* argv[]) {
...
@@ -415,13 +415,13 @@ void RouterSimulator::initialize(int argc, char* argv[]) {
RouterSimulator
::
TRACE
=
stoi
(
optarg
);
RouterSimulator
::
TRACE
=
stoi
(
optarg
);
}
break
;
}
break
;
default
:
{
default
:
{
cerr
<<
inputInfo
;
cerr
<<
argv
[
0
]
<<
inputInfo
;
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
break
;
}
break
;
}
}
}
}
}
catch
(
invalid_argument
&
)
{
}
catch
(
invalid_argument
&
)
{
cerr
<<
inputInfo
<<
endl
;
cerr
<<
argv
[
0
]
<<
inputInfo
<<
endl
;
exit
(
2
);
exit
(
2
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment