From 4dffeedd1c59bd0ec2d1cd3b7831cac3b8a7df96 Mon Sep 17 00:00:00 2001 From: DennisOSRM Date: Wed, 17 Jul 2013 14:47:13 +0200 Subject: [PATCH] (partially) adding new fingerprint objects --- Util/UUID.cpp | 40 ++++++++++++++++++++++++++++++++++++++++ Util/UUID.h | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 Util/UUID.cpp create mode 100644 Util/UUID.h diff --git a/Util/UUID.cpp b/Util/UUID.cpp new file mode 100644 index 000000000..64a316708 --- /dev/null +++ b/Util/UUID.cpp @@ -0,0 +1,40 @@ +/* + open source routing machine + Copyright (C) Dennis Luxen, others 2010 + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU AFFERO General Public License as published by +the Free Software Foundation; either version 3 of the License, or +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +or see http://www.gnu.org/licenses/agpl.txt. + */ + +#include "UUID.h" + +UUID::UUID() { + boost::uuids::name_generator gen(named_uuid); + named_uuid = gen(std::string(__DATE__).append(__TIME__)); +} + +UUID::~UUID() { + +} + +const boost::uuids::uuid & UUID::GetUUID() const { + return named_uuid; +} + +/*static UUID & UUID::GetInstance() { + static UUID instance; + return instance; +}*/ + diff --git a/Util/UUID.h b/Util/UUID.h new file mode 100644 index 000000000..c580ab514 --- /dev/null +++ b/Util/UUID.h @@ -0,0 +1,47 @@ +/* + open source routing machine + Copyright (C) Dennis Luxen, others 2010 + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU AFFERO General Public License as published by +the Free Software Foundation; either version 3 of the License, or +any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +or see http://www.gnu.org/licenses/agpl.txt. + */ + +#ifndef UUID_H +#define UUID_H + +#include +#include // uuid class +#include // generators +#include // streaming operators etc. + +#include +#include + +//implements a singleton, i.e. there is one and only one conviguration object +class UUID : boost::noncopyable { +public: + static UUID & GetInstance() { + static UUID instance; + return instance; + } + ~UUID(); + const boost::uuids::uuid & GetUUID() const; +private: + UUID(); + // initialize to {6ba7b810-9dad-11d1-80b4-00c04fd430c8} + boost::uuids::uuid named_uuid; +}; + +#endif /* UUID_H */ \ No newline at end of file