Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
a43c842e
Unverified
Commit
a43c842e
authored
Jun 27, 2019
by
Luca Boccassi
Committed by
GitHub
Jun 27, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3556 from ssbl/better-names
Problem: variable and type names are not descriptive
parents
68b744fa
d1e6fe19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
36 deletions
+37
-36
radix_tree.cpp
src/radix_tree.cpp
+0
-0
radix_tree.hpp
src/radix_tree.hpp
+37
-36
No files found.
src/radix_tree.cpp
View file @
a43c842e
This diff is collapsed.
Click to expand it.
src/radix_tree.hpp
View file @
a43c842e
...
...
@@ -60,54 +60,55 @@
// The link to each child is looked up using its index, e.g. the child
// with index 0 will have its first byte and node pointer at the start
// of the chunk of first bytes and node pointers respectively.
struct
node
struct
node
_t
{
unsigned
char
*
data_
;
explicit
node
(
unsigned
char
*
data
);
explicit
node
_t
(
unsigned
char
*
data
);
bool
operator
==
(
node
other
)
const
;
bool
operator
!=
(
node
other
)
const
;
bool
operator
==
(
node
_t
other
)
const
;
bool
operator
!=
(
node
_t
other
)
const
;
inline
uint32_t
refcount
();
inline
uint32_t
prefix_length
();
inline
uint32_t
edgecount
();
inline
unsigned
char
*
prefix
();
inline
unsigned
char
*
first_bytes
();
inline
unsigned
char
first_byte_at
(
size_t
i
);
inline
unsigned
char
*
node_p
t
rs
();
inline
node
node_at
(
size_t
i
);
inline
unsigned
char
first_byte_at
(
size_t
i
ndex
);
inline
unsigned
char
*
node_p
ointe
rs
();
inline
node
_t
node_at
(
size_t
index
);
inline
void
set_refcount
(
uint32_t
value
);
inline
void
set_prefix_length
(
uint32_t
value
);
inline
void
set_edgecount
(
uint32_t
value
);
inline
void
set_prefix
(
const
unsigned
char
*
prefix
);
inline
void
set_first_bytes
(
const
unsigned
char
*
bytes
);
inline
void
set_first_byte_at
(
size_t
i
,
unsigned
char
byte
);
inline
void
set_node_ptrs
(
const
unsigned
char
*
ptrs
);
inline
void
set_node_at
(
size_t
i
,
node
n
);
inline
void
set_edge_at
(
size_t
i
,
unsigned
char
byte
,
node
n
);
inline
void
set_first_byte_at
(
size_t
index
,
unsigned
char
byte
);
inline
void
set_node_pointers
(
const
unsigned
char
*
pointers
);
inline
void
set_node_at
(
size_t
index
,
node_t
node
);
inline
void
set_edge_at
(
size_t
index
,
unsigned
char
first_byte
,
node_t
node
);
void
resize
(
size_t
prefix_length
,
size_t
edgecount
);
};
node
make_node
(
size_t
refcount
,
size_t
prefix_length
,
size_t
nedges
);
node
_t
make_node
(
size_t
refcount
,
size_t
prefix_length
,
size_t
edgecount
);
struct
match_result
struct
match_result
_t
{
size_t
nkey
;
size_t
nprefix
;
size_t
key_bytes_matched
;
size_t
prefix_bytes_matched
;
size_t
edge_index
;
size_t
gp
_edge_index
;
node
current_node
;
node
parent_node
;
node
grandparent_node
;
match_result
(
size_t
i
,
size_t
j
,
size_t
edge_index
,
size_t
gp
_edge_index
,
node
current
,
node
parent
,
node
grandparent
);
size_t
parent
_edge_index
;
node
_t
current_node
;
node
_t
parent_node
;
node
_t
grandparent_node
;
match_result
_t
(
size_t
key_bytes_matched
,
size_t
prefix_bytes_matched
,
size_t
edge_index
,
size_t
parent
_edge_index
,
node_t
current
,
node_t
parent
,
node_t
grandparent
);
};
namespace
zmq
...
...
@@ -120,26 +121,26 @@ class radix_tree
// Add key to the tree. Returns true if this was a new key rather
// than a duplicate.
bool
add
(
const
unsigned
char
*
prefix_
,
size_t
size_
);
bool
add
(
const
unsigned
char
*
key_
,
size_t
key_
size_
);
// Remove key from the tree. Returns true if
he item is ac
ually
// Remove key from the tree. Returns true if
the item is act
ually
// removed from the tree.
bool
rm
(
const
unsigned
char
*
prefix_
,
size_t
size_
);
bool
rm
(
const
unsigned
char
*
key_
,
size_t
key_
size_
);
// Check whether particular key is in the tree.
bool
check
(
const
unsigned
char
*
prefix
,
size_t
size_
);
bool
check
(
const
unsigned
char
*
key_
,
size_t
key_
size_
);
// Apply the function supplied to each key in the tree.
void
apply
(
void
(
*
func
)
(
unsigned
char
*
data_
,
size_t
size_
,
void
*
arg_
),
void
*
arg
);
void
apply
(
void
(
*
func
_
)
(
unsigned
char
*
data
,
size_t
size
,
void
*
arg
),
void
*
arg
_
);
size_t
size
()
const
;
private
:
inline
match_result
match
(
const
unsigned
char
*
key
,
size_t
size
,
bool
check
)
const
;
inline
match_result
_t
match
(
const
unsigned
char
*
key
,
size_t
key_size
,
bool
is_lookup
)
const
;
node
root_
;
node
_t
root_
;
size_t
size_
;
};
}
...
...
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