Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
R
RcppUUID
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Artem Klevtsov
RcppUUID
Commits
a1682755
Verified
Commit
a1682755
authored
May 01, 2020
by
Artem Klevtsov
😹
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cosmetics
parent
817834ea
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
16 deletions
+12
-16
src/uuid_name.cpp
src/uuid_name.cpp
+3
-2
src/uuid_nil.cpp
src/uuid_nil.cpp
+2
-2
src/uuid_random.cpp
src/uuid_random.cpp
+2
-2
src/uuid_valid.cpp
src/uuid_valid.cpp
+5
-5
src/wrap.cpp
src/wrap.cpp
+0
-5
No files found.
src/uuid_name.cpp
View file @
a1682755
...
...
@@ -4,7 +4,8 @@
#include <Rcpp.h>
using
namespace
Rcpp
;
using
namespace
boost
;
using
boost
::
uuids
::
name_generator_sha1
;
using
boost
::
uuids
::
ns
::
x500dn
;
using
boost
::
uuids
::
uuid
;
//' @title Generate UUIDs Version 5
...
...
@@ -34,7 +35,7 @@ using boost::uuids::uuid;
// [[Rcpp::export(rng=false)]]
StringVector
uuid_generate_name
(
StringVector
x
)
{
std
::
vector
<
uuid
>
res
(
x
.
size
());
uuids
::
name_generator_sha1
gen
(
uuids
::
ns
::
x500dn
());
name_generator_sha1
gen
(
x500dn
());
std
::
transform
(
x
.
begin
(),
x
.
end
(),
res
.
begin
(),
gen
);
return
wrap
(
res
);
}
src/uuid_nil.cpp
View file @
a1682755
...
...
@@ -4,7 +4,7 @@
#include <Rcpp.h>
using
namespace
Rcpp
;
using
namespace
boost
;
using
boost
::
uuids
::
nil_generator
;
using
boost
::
uuids
::
uuid
;
//' @title Generrates Nil UUIDs
...
...
@@ -27,6 +27,6 @@ using boost::uuids::uuid;
// [[Rcpp::export(rng=false)]]
StringVector
uuid_generate_nil
(
size_t
n
=
1
)
{
std
::
vector
<
uuid
>
res
(
n
);
std
::
generate
(
res
.
begin
(),
res
.
end
(),
uuids
::
nil_generator
());
std
::
generate
(
res
.
begin
(),
res
.
end
(),
nil_generator
());
return
wrap
(
res
);
}
src/uuid_random.cpp
View file @
a1682755
...
...
@@ -4,7 +4,7 @@
#include <Rcpp.h>
using
namespace
Rcpp
;
using
namespace
boost
;
using
boost
::
uuids
::
random_generator_pure
;
using
boost
::
uuids
::
uuid
;
//' @title Generate UUIDs Version 4
...
...
@@ -27,6 +27,6 @@ using boost::uuids::uuid;
// [[Rcpp::export(rng=false)]]
StringVector
uuid_generate_random
(
size_t
n
=
1
)
{
std
::
vector
<
uuid
>
res
(
n
);
std
::
generate
(
res
.
begin
(),
res
.
end
(),
uuids
::
random_generator
());
std
::
generate
(
res
.
begin
(),
res
.
end
(),
random_generator_pure
());
return
wrap
(
res
);
}
src/uuid_valid.cpp
View file @
a1682755
#include "wrap.h"
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/
uuid_generators
.hpp>
#include <boost/uuid/
string_generator
.hpp>
#include <Rcpp.h>
using
namespace
Rcpp
;
using
namespace
boost
;
using
boost
::
uuids
::
string_generator
;
using
boost
::
uuids
::
uuid
;
inline
bool
try_uuid
(
const
char
*
s
)
{
try
{
uuids
::
string_generator
gen
;
uuid
s
::
uuid
id
=
gen
(
s
);
return
id
.
is_nil
()
||
id
.
version
()
!=
uuid
s
::
uuid
::
version_unknown
;
string_generator
gen
;
uuid
id
=
gen
(
s
);
return
id
.
is_nil
()
||
id
.
version
()
!=
uuid
::
version_unknown
;
}
catch
(...)
{
return
false
;
}
...
...
src/wrap.cpp
View file @
a1682755
...
...
@@ -7,11 +7,6 @@
namespace
Rcpp
{
using
boost
::
uuids
::
uuid
;
template
<
>
SEXP
wrap
(
const
uuid
&
u
)
{
return
wrap
(
to_string
(
u
));
}
template
<
>
SEXP
wrap
(
const
std
::
vector
<
uuid
>&
x
)
{
StringVector
res
=
no_init
(
x
.
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