Verified Commit a1682755 authored by Artem Klevtsov's avatar Artem Klevtsov 😹

Cosmetics

parent 817834ea
......@@ -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);
}
......@@ -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);
}
......@@ -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);
}
#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;
uuids::uuid id = gen(s);
return id.is_nil() || id.version() != uuids::uuid::version_unknown;
string_generator gen;
uuid id = gen(s);
return id.is_nil() || id.version() != uuid::version_unknown;
} catch(...) {
return false;
}
......
......@@ -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());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment