Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
adt2amas
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PARTIES
tools
adt2amas
Commits
99d269e8
Commit
99d269e8
authored
6 years ago
by
Giann Karlo Aguirre Samboní
Browse files
Options
Downloads
Patches
Plain Diff
printable node types
parent
ebd72bf3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/CMakeLists.txt
+1
-1
1 addition, 1 deletion
src/CMakeLists.txt
src/adt2amas.cpp
+5
-3
5 additions, 3 deletions
src/adt2amas.cpp
src/node_type.cpp
+18
-0
18 additions, 0 deletions
src/node_type.cpp
src/node_type.hpp
+4
-0
4 additions, 0 deletions
src/node_type.hpp
with
28 additions
and
4 deletions
src/CMakeLists.txt
+
1
−
1
View file @
99d269e8
...
...
@@ -5,7 +5,7 @@ cmake_minimum_required(VERSION 3.0.0)
project
(
adt2amas_exec CXX
)
# Libraries
add_library
(
adt_libs ad_tree.cpp tree_node.cpp node_type.
h
pp
)
add_library
(
adt_libs ad_tree.cpp tree_node.cpp node_type.
c
pp
)
target_include_directories
(
adt_libs PUBLIC
${
CMAKE_CURRENT_LIST_DIR
}
)
# The main programn
...
...
This diff is collapsed.
Click to expand it.
src/adt2amas.cpp
+
5
−
3
View file @
99d269e8
...
...
@@ -41,8 +41,9 @@ int main(){
// Removing...
//node_one->remove_child(node_six, node_one);
node_one
->
remove_parent_pos
(
0
,
node_six
);
node_one
->
remove_child_pos
(
0
,
node_ten
);
//
node_one->remove_child_pos(0, node_ten);
// Lineage printing...
cout
<<
"child associated ids of node one:"
<<
endl
;
for
(
auto
&
i
:
node_one
->
get_child_associated_ids
())
// reference to The C++ Programming Language book, p. 899
cout
<<
i
<<
' '
;
...
...
@@ -68,7 +69,8 @@ int main(){
delete
tree
;
NodeType
nodeTest
{
NodeType
::
Defence
};
cout
<<
"node type = "
<<
static_cast
<
int
>
(
nodeTest
)
<<
endl
;
NodeType
nodeTest
{
NodeType
::
Attack
};
cout
<<
"node type = "
<<
to_string
(
nodeTest
)
<<
endl
;
}
This diff is collapsed.
Click to expand it.
src/node_type.cpp
0 → 100644
+
18
−
0
View file @
99d269e8
#include
"node_type.hpp"
string
to_string
(
NodeType
nt
){
string
_nt
=
""
;
switch
(
nt
)
{
case
NodeType
::
Defence
:
_nt
=
"Defence"
;
break
;
case
NodeType
::
Attack
:
_nt
=
"Attack"
;
default:
break
;
}
return
_nt
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/node_type.hpp
+
4
−
0
View file @
99d269e8
...
...
@@ -2,6 +2,7 @@
#define NODE_TYPE_HPP
#include
<iostream>
#include
<string>
using
namespace
std
;
...
...
@@ -10,4 +11,7 @@ enum class NodeType
Defence
,
// 0
Attack
// 1
};
string
to_string
(
NodeType
nt
);
#endif
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