Unverified Commit 369e4a22 authored by Robert Kimball's avatar Robert Kimball Committed by GitHub

Remove uuid since it is not used (#2756)

parent f9bed8c4
//*****************************************************************************
// Copyright 2017-2019 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//*****************************************************************************
#pragma once
#include <array>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <random>
#include <sstream>
#include <string>
static std::mt19937_64 random_generator;
namespace ngraph
{
class uuid_type;
}
class ngraph::uuid_type
{
public:
uuid_type()
{
m_data[0] = random_generator();
m_data[1] = random_generator();
uint8_t* p = reinterpret_cast<uint8_t*>(m_data);
p[6] = (p[6] & 0x0F) | 0x40;
p[8] = (p[8] & 0x3F) | 0x80;
}
std::string to_string() const
{
std::stringstream ss;
const uint8_t* p = reinterpret_cast<const uint8_t*>(m_data);
for (int i = 0; i < 4; i++)
{
ss << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(*p++);
}
ss << "-";
for (int i = 0; i < 2; i++)
{
ss << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(*p++);
}
ss << "-";
for (int i = 0; i < 2; i++)
{
ss << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(*p++);
}
ss << "-";
for (int i = 0; i < 2; i++)
{
ss << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(*p++);
}
ss << "-";
for (int i = 0; i < 6; i++)
{
ss << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(*p++);
}
return ss.str();
}
static uuid_type zero()
{
uuid_type rc;
rc.m_data[0] = 0;
rc.m_data[1] = 0;
return rc;
}
bool operator==(const uuid_type& other) const { return memcmp(m_data, other.m_data, 16) == 0; }
bool operator!=(const uuid_type& other) const { return !(*this == other); }
friend std::ostream& operator<<(std::ostream& out, const uuid_type& id)
{
out << id.to_string();
return out;
}
private:
uint64_t m_data[2];
};
......@@ -66,7 +66,6 @@ set(SRC
tensor.cpp
type_prop.cpp
util.cpp
uuid.cpp
zero_dim_tensor_elimination.cpp
)
......
//*****************************************************************************
// Copyright 2017-2019 Intel Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//*****************************************************************************
#include <sstream>
#include <string>
#include <vector>
#include "gtest/gtest.h"
#include "ngraph/uuid.hpp"
using namespace std;
using namespace ngraph;
TEST(uuid, zero)
{
uuid_type zero = uuid_type::zero();
stringstream ss;
ss << zero;
std::string expected = "00000000-0000-0000-0000-000000000000";
EXPECT_STREQ(expected.c_str(), ss.str().c_str());
}
TEST(uuid, eq)
{
uuid_type z1 = uuid_type::zero();
uuid_type z2 = uuid_type::zero();
EXPECT_EQ(z1, z2);
}
TEST(uuid, ne)
{
uuid_type u1;
uuid_type u2;
EXPECT_NE(u1, u2);
}
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