Rename RMI Exposer to Gateway
authorSangwan Kwon <sangwan.kwon@samsung.com>
Wed, 18 Dec 2019 09:22:31 +0000 (18:22 +0900)
committer권상완/Security 2Lab(SR)/Engineer/삼성전자 <sangwan.kwon@samsung.com>
Mon, 23 Dec 2019 02:42:16 +0000 (11:42 +0900)
Also Stringfy is changed to Stringify

Signed-off-by: Sangwan Kwon <sangwan.kwon@samsung.com>
13 files changed:
src/vist/client/virtual-table.cpp
src/vist/common/stringfy.cpp
src/vist/common/tests/stringfy.cpp
src/vist/rmi/CMakeLists.txt
src/vist/rmi/exposer.cpp [deleted file]
src/vist/rmi/exposer.hpp [deleted file]
src/vist/rmi/gateway.cpp [new file with mode: 0644]
src/vist/rmi/gateway.hpp [new file with mode: 0644]
src/vist/rmi/tests/rmi.cpp
src/vist/sdk/policy-value.hpp
src/vist/sdk/tests/sdk.cpp
src/vist/service/vist.cpp
src/vist/stringfy.hpp

index b8deacfe3932f772de16c97c391ede25defb3b10..714e17d70b3613aeeb1f2e8a7f729624758170ce 100644 (file)
@@ -100,7 +100,7 @@ Member VirtualRow<T>::at(Member Struct::* field) const
        }
 
        if (std::is_same<T, Policy<int>>::value && key == "value")
-               return static_cast<Member>(Stringfy::Restore(value));
+               return static_cast<Member>(Stringify::Restore(value));
 
        try {
                return boost::lexical_cast<Member>(value);
index 7f0cce3b8a5250a240edd8a1642b7eb30ba8a75f..3dbde567602318afd8e5bc8dad868244d1b6505d 100644 (file)
 
 namespace vist {
 
-Stringfy::Stringfy(int origin) noexcept :
+Stringify::Stringify(int origin) noexcept :
        type(Type::Integer), buffer(convert(origin))
 {
 }
 
-Stringfy::Stringfy(const std::string& origin) noexcept :
+Stringify::Stringify(const std::string& origin) noexcept :
        type(Type::String), buffer(convert(origin))
 {
 }
 
-Stringfy Stringfy::Restore(const std::string& dumped)
+Stringify Stringify::Restore(const std::string& dumped)
 {
-       auto parsed = Stringfy::Parse(dumped);
+       auto parsed = Stringify::Parse(dumped);
        switch (parsed.first) {
        case Type::Integer:
-               return Stringfy(std::stoi(parsed.second));
+               return Stringify(std::stoi(parsed.second));
        case Type::String:
-               return Stringfy(parsed.second);
+               return Stringify(parsed.second);
        case Type::None:
        default:
                THROW(ErrCode::LogicError) << "Invalid format.";
        }
 }
 
-Stringfy::Type Stringfy::GetType(const std::string& dumped)
+Stringify::Type Stringify::GetType(const std::string& dumped)
 {
-       return Stringfy::Parse(dumped).first;
+       return Stringify::Parse(dumped).first;
 }
 
-Stringfy::operator std::string() const
+Stringify::operator std::string() const
 {
-       auto parsed = Stringfy::Parse(this->buffer);
+       auto parsed = Stringify::Parse(this->buffer);
        if (parsed.first != Type::String)
                THROW(ErrCode::TypeUnsafed) << "Type is not safed.";
 
        return parsed.second;
 }
 
-Stringfy::operator int() const
+Stringify::operator int() const
 {
-       auto parsed = Stringfy::Parse(this->buffer);
+       auto parsed = Stringify::Parse(this->buffer);
        if (parsed.first != Type::Integer)
                THROW(ErrCode::TypeUnsafed) << "Type is not safed.";
 
        return std::stoi(parsed.second);
 }
 
-std::pair<Stringfy::Type, std::string> Stringfy::Parse(const std::string& dumped)
+std::pair<Stringify::Type, std::string> Stringify::Parse(const std::string& dumped)
 {
        std::string type = dumped.substr(0, dumped.find('/'));
        std::string data = dumped.substr(dumped.find('/') + 1);
@@ -75,7 +75,7 @@ std::pair<Stringfy::Type, std::string> Stringfy::Parse(const std::string& dumped
        return std::make_pair(static_cast<Type>(type.at(0)), data);
 }
 
-std::string Stringfy::dump() const noexcept
+std::string Stringify::dump() const noexcept
 {
        return this->buffer;
 }
index 01f5e408729c005d55fbe4c1a48d1b543542dd9d..e5375c0053639de4f16a42a908635cbbf9a9b283 100644 (file)
 
 using namespace vist;
 
-TEST(StringfyTests, integer_dump)
+TEST(StringifyTests, integer_dump)
 {
-       EXPECT_EQ("I/-11", Stringfy::Dump(-11));
-       EXPECT_EQ("I/-1", Stringfy::Dump(-1));
-       EXPECT_EQ("I/0", Stringfy::Dump(0));
-       EXPECT_EQ("I/1", Stringfy::Dump(1));
-       EXPECT_EQ("I/11", Stringfy::Dump(11));
+       EXPECT_EQ("I/-11", Stringify::Dump(-11));
+       EXPECT_EQ("I/-1", Stringify::Dump(-1));
+       EXPECT_EQ("I/0", Stringify::Dump(0));
+       EXPECT_EQ("I/1", Stringify::Dump(1));
+       EXPECT_EQ("I/11", Stringify::Dump(11));
 }
 
-TEST(StringfyTests, string_dump)
+TEST(StringifyTests, string_dump)
 {
-       EXPECT_EQ("S/", Stringfy::Dump(""));
-       EXPECT_EQ("S/TEXT", Stringfy::Dump("TEXT"));
+       EXPECT_EQ("S/", Stringify::Dump(""));
+       EXPECT_EQ("S/TEXT", Stringify::Dump("TEXT"));
 }
 
-TEST(StringfyTests, integer_restore)
+TEST(StringifyTests, integer_restore)
 {
-       auto dumped = Stringfy::Dump(-1);
-       EXPECT_EQ(-1, Stringfy::Restore(dumped));
+       auto dumped = Stringify::Dump(-1);
+       EXPECT_EQ(-1, Stringify::Restore(dumped));
 
-       dumped = Stringfy::Dump(0);
-       EXPECT_EQ(0, Stringfy::Restore(dumped));
+       dumped = Stringify::Dump(0);
+       EXPECT_EQ(0, Stringify::Restore(dumped));
 
-       dumped = Stringfy::Dump(1);
-       EXPECT_EQ(1, Stringfy::Restore(dumped));
+       dumped = Stringify::Dump(1);
+       EXPECT_EQ(1, Stringify::Restore(dumped));
 }
 
-TEST(StringfyTests, string_restore)
+TEST(StringifyTests, string_restore)
 {
-       auto dumped = Stringfy::Dump("");
-       EXPECT_EQ(std::string(""), static_cast<std::string>(Stringfy::Restore(dumped)));
+       auto dumped = Stringify::Dump("");
+       EXPECT_EQ(std::string(""), static_cast<std::string>(Stringify::Restore(dumped)));
 
-       dumped = Stringfy::Dump("TEXT");
-       EXPECT_EQ(std::string("TEXT"), static_cast<std::string>(Stringfy::Restore(dumped)));
+       dumped = Stringify::Dump("TEXT");
+       EXPECT_EQ(std::string("TEXT"), static_cast<std::string>(Stringify::Restore(dumped)));
 }
 
-TEST(StringfyTests, get_type)
+TEST(StringifyTests, get_type)
 {
-       auto dumped = Stringfy::Dump(0);
-       EXPECT_EQ(Stringfy::Type::Integer, Stringfy::GetType(dumped));
+       auto dumped = Stringify::Dump(0);
+       EXPECT_EQ(Stringify::Type::Integer, Stringify::GetType(dumped));
 
-       dumped = Stringfy::Dump("Text");
-       EXPECT_EQ(Stringfy::Type::String, Stringfy::GetType(dumped));
+       dumped = Stringify::Dump("Text");
+       EXPECT_EQ(Stringify::Type::String, Stringify::GetType(dumped));
 }
 
-TEST(StringfyTests, type_safety)
+TEST(StringifyTests, type_safety)
 {
        bool raised = false;
-       auto dumped = Stringfy::Dump(1);
+       auto dumped = Stringify::Dump(1);
 
        try {
-               auto failed = static_cast<std::string>(Stringfy::Restore(dumped));
+               auto failed = static_cast<std::string>(Stringify::Restore(dumped));
        } catch (const vist::Exception<ErrCode>& e) {
                raised = true;
                EXPECT_EQ(e.get(), ErrCode::TypeUnsafed);
@@ -81,12 +81,12 @@ TEST(StringfyTests, type_safety)
        EXPECT_TRUE(raised);
 }
 
-TEST(StringfyTests, restore_failed)
+TEST(StringifyTests, restore_failed)
 {
        bool raised = false;
 
        try {
-               auto failed = Stringfy::Restore("Not dumped message");
+               auto failed = Stringify::Restore("Not dumped message");
        } catch (const vist::Exception<ErrCode>& e) {
                raised = true;
                EXPECT_EQ(e.get(), ErrCode::LogicError);
index 9f439e0eb49ef9e8c452e070c84b11fcc1be0f8e..01b8e67a40e239553ceaeafae1a51190feb423c1 100644 (file)
@@ -12,7 +12,7 @@
 #  See the License for the specific language governing permissions and
 #  limitations under the License
 
-ADD_VIST_COMMON_LIBRARY(vist_rmi exposer.cpp
+ADD_VIST_COMMON_LIBRARY(vist_rmi gateway.cpp
                                                                 remote.cpp)
 
 FILE(GLOB RMI_TESTS "tests/*.cpp")
diff --git a/src/vist/rmi/exposer.cpp b/src/vist/rmi/exposer.cpp
deleted file mode 100644 (file)
index 3c2a66b..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- *  Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *  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
- */
-/*
- * @file   exposer.cpp
- * @author Sangwan Kwon (sangwan.kwon@samsung.com)
- * @author Jaemin Ryu (jm77.ryu@samsung.com)
- * @brief  Implementation of Server-side stub for exposing method. 
- */
-
-#include "exposer.hpp"
-
-#include <vist/exception.hpp>
-#include <vist/transport/message.hpp>
-#include <vist/transport/server.hpp>
-
-#include <string>
-
-namespace vist {
-namespace rmi {
-
-using namespace vist::transport;
-
-class Exposer::Impl {
-public:
-       explicit Impl(Exposer& exposer, const std::string& path)
-       {
-               auto dispatcher = [&exposer](auto& message) -> Message {
-                       std::string function = message.signature;
-                       auto iter = exposer.functorMap.find(function);
-                       if (iter == exposer.functorMap.end())
-                               THROW(ErrCode::ProtocolBroken) << "Not found function: " << function;
-
-                       DEBUG(VIST) << "Remote method invokation: " << function;
-
-                       auto functor = iter->second;
-                       auto result = functor->invoke(message.buffer);
-
-                       Message reply(Message::Type::Reply, function);
-                       reply.enclose(result);
-
-                       return reply;
-               };
-
-               this->server = std::make_unique<Server>(path, dispatcher);
-       }
-
-       inline void start()
-       {
-               this->server->run();
-       }
-
-       inline void stop()
-       {
-               this->server->stop();
-       }
-
-private:
-       std::unique_ptr<Server> server;
-};
-
-Exposer::Exposer(const std::string& path) : pImpl(new Impl(*this, path))
-{
-}
-
-Exposer::~Exposer() = default;
-
-void Exposer::start(void)
-{
-       this->pImpl->start();
-}
-
-void Exposer::stop(void)
-{
-       this->pImpl->stop();
-}
-
-} // namespace rmi
-} // namespace vist
diff --git a/src/vist/rmi/exposer.hpp b/src/vist/rmi/exposer.hpp
deleted file mode 100644 (file)
index e4c2a99..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- *  Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *  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
- */
-/*
- * @file   exposer.hpp
- * @author Sangwan Kwon (sangwan.kwon@samsung.com)
- * @author Jaemin Ryu (jm77.ryu@samsung.com)
- * @brief  Server-side stub for exposing method. 
- */
-
-#pragma once
-
-#include <vist/klass/functor.hpp>
-
-#include <memory>
-#include <string>
-
-namespace vist {
-namespace rmi {
-
-class Exposer final {
-public:
-       explicit Exposer(const std::string& path);
-       ~Exposer();
-
-       Exposer(const Exposer&) = delete;
-       Exposer& operator=(const Exposer&) = delete;
-
-       Exposer(Exposer&&) = default;
-       Exposer& operator=(Exposer&&) = default;
-
-       void start(void);
-       void stop(void);
-
-       template<typename O, typename F>
-       void expose(O&& object, const std::string& name, F&& func);
-
-private:
-       class Impl;
-
-       klass::FunctorMap functorMap;
-       std::unique_ptr<Impl> pImpl;
-};
-
-template<typename O, typename F>
-void Exposer::expose(O&& object, const std::string& name, F&& func)
-{
-       auto functor = klass::make_functor_ptr(std::forward<O>(object), std::forward<F>(func));
-       this->functorMap[name] = functor;
-}
-
-} // namespace rmi
-} // namespace vist
diff --git a/src/vist/rmi/gateway.cpp b/src/vist/rmi/gateway.cpp
new file mode 100644 (file)
index 0000000..02b2f06
--- /dev/null
@@ -0,0 +1,91 @@
+/*
+ *  Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  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
+ */
+/*
+ * @file   gateway.cpp
+ * @author Sangwan Kwon (sangwan.kwon@samsung.com)
+ * @author Jaemin Ryu (jm77.ryu@samsung.com)
+ * @brief  Implementation of Server-side stub for exposing method. 
+ */
+
+#include "gateway.hpp"
+
+#include <vist/exception.hpp>
+#include <vist/transport/message.hpp>
+#include <vist/transport/server.hpp>
+
+#include <string>
+
+namespace vist {
+namespace rmi {
+
+using namespace vist::transport;
+
+class Gateway::Impl {
+public:
+       explicit Impl(Gateway& gateway, const std::string& path)
+       {
+               auto dispatcher = [&gateway](auto& message) -> Message {
+                       std::string function = message.signature;
+                       auto iter = gateway.functorMap.find(function);
+                       if (iter == gateway.functorMap.end())
+                               THROW(ErrCode::ProtocolBroken) << "Not found function: " << function;
+
+                       DEBUG(VIST) << "Remote method invokation: " << function;
+
+                       auto functor = iter->second;
+                       auto result = functor->invoke(message.buffer);
+
+                       Message reply(Message::Type::Reply, function);
+                       reply.enclose(result);
+
+                       return reply;
+               };
+
+               this->server = std::make_unique<Server>(path, dispatcher);
+       }
+
+       inline void start()
+       {
+               this->server->run();
+       }
+
+       inline void stop()
+       {
+               this->server->stop();
+       }
+
+private:
+       std::unique_ptr<Server> server;
+};
+
+Gateway::Gateway(const std::string& path) : pImpl(new Impl(*this, path))
+{
+}
+
+Gateway::~Gateway() = default;
+
+void Gateway::start(void)
+{
+       this->pImpl->start();
+}
+
+void Gateway::stop(void)
+{
+       this->pImpl->stop();
+}
+
+} // namespace rmi
+} // namespace vist
diff --git a/src/vist/rmi/gateway.hpp b/src/vist/rmi/gateway.hpp
new file mode 100644 (file)
index 0000000..b8a347b
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ *  Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  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
+ */
+/*
+ * @file   gateway.hpp
+ * @author Sangwan Kwon (sangwan.kwon@samsung.com)
+ * @author Jaemin Ryu (jm77.ryu@samsung.com)
+ * @brief  Server-side stub for exposing method. 
+ */
+
+#pragma once
+
+#include <vist/klass/functor.hpp>
+
+#include <memory>
+#include <string>
+
+namespace vist {
+namespace rmi {
+
+class Gateway final {
+public:
+       explicit Gateway(const std::string& path);
+       ~Gateway();
+
+       Gateway(const Gateway&) = delete;
+       Gateway& operator=(const Gateway&) = delete;
+
+       Gateway(Gateway&&) = default;
+       Gateway& operator=(Gateway&&) = default;
+
+       void start(void);
+       void stop(void);
+
+       template<typename O, typename F>
+       void expose(O&& object, const std::string& name, F&& func);
+
+private:
+       class Impl;
+
+       klass::FunctorMap functorMap;
+       std::unique_ptr<Impl> pImpl;
+};
+
+template<typename O, typename F>
+void Gateway::expose(O&& object, const std::string& name, F&& func)
+{
+       auto functor = klass::make_functor_ptr(std::forward<O>(object), std::forward<F>(func));
+       this->functorMap[name] = functor;
+}
+
+} // namespace rmi
+} // namespace vist
index 08eb727128f9aa6e0a27073968bc444c78644cd4..250bed5e9a6fc48eb716f4b2fb9992af98a7d375 100644 (file)
@@ -20,7 +20,7 @@
  */
 
 
-#include <vist/rmi/exposer.hpp>
+#include <vist/rmi/gateway.hpp>
 #include <vist/rmi/remote.hpp>
 
 #include <iostream>
@@ -32,7 +32,7 @@
 
 using namespace vist::rmi;
 
-// exposer side methods
+// gateway side methods
 struct Foo {
        bool setName(const std::string& name)
        {
@@ -57,17 +57,17 @@ struct Bar {
 
 TEST(RmiTests, positive)
 {
-       std::string sockPath = ("/tmp/test-exposer");
+       std::string sockPath = ("/tmp/test-gateway");
 
-       // exposer-side
-       Exposer exposer(sockPath);
+       // gateway-side
+       Gateway gateway(sockPath);
 
        auto foo = std::make_shared<Foo>();
-       exposer.expose(foo, "Foo::setName", &Foo::setName);
-       exposer.expose(foo, "Foo::getName", &Foo::getName);
+       gateway.expose(foo, "Foo::setName", &Foo::setName);
+       gateway.expose(foo, "Foo::getName", &Foo::getName);
 
        auto bar = std::make_shared<Bar>();
-       exposer.expose(bar, "Bar::plusTwo", &Bar::plusTwo);
+       gateway.expose(bar, "Bar::plusTwo", &Bar::plusTwo);
 
        auto client = std::thread([&]() {
                // caller-side
@@ -83,10 +83,10 @@ TEST(RmiTests, positive)
                int num = remote.invoke<int>("Bar::plusTwo", 3);
                EXPECT_EQ(num, 5);
 
-               exposer.stop();
+               gateway.stop();
        });
 
-       exposer.start();
+       gateway.start();
 
        if (client.joinable())
                client.join();
@@ -94,10 +94,10 @@ TEST(RmiTests, positive)
 
 TEST(RmiTests, not_exist_method)
 {
-       std::string sockPath = ("/tmp/test-exposer");
+       std::string sockPath = ("/tmp/test-gateway");
 
-       // exposer-side
-       Exposer exposer(sockPath);
+       // gateway-side
+       Gateway gateway(sockPath);
 
        auto client = std::thread([&]() {
                // caller-side
@@ -113,10 +113,10 @@ TEST(RmiTests, not_exist_method)
                }
                EXPECT_TRUE(rasied);
 
-               exposer.stop();
+               gateway.stop();
        });
 
-       exposer.start();
+       gateway.start();
 
        if (client.joinable())
                client.join();
index 98269a09955a8f7b2a8a6bfece2fa52e14447c1a..357c72fc8ab915877dd540f79101297aa8ddd202 100644 (file)
@@ -25,9 +25,9 @@ namespace policy {
 
 struct PolicyValue final {
        explicit PolicyValue() noexcept = default;
-       explicit PolicyValue(int value) : stringfied(Stringfy::Dump(value)) {}
+       explicit PolicyValue(int value) : stringfied(Stringify::Dump(value)) {}
        explicit PolicyValue(const std::string& value, bool dumped = false)
-               : stringfied(dumped ? value : Stringfy::Dump(value)) {}
+               : stringfied(dumped ? value : Stringify::Dump(value)) {}
        ~PolicyValue() = default;
 
        PolicyValue(const PolicyValue&) = default;
@@ -41,19 +41,19 @@ struct PolicyValue final {
                return this->stringfied;
        }
 
-       inline Stringfy::Type getType() const
+       inline Stringify::Type getType() const
        {
-               return Stringfy::GetType(this->stringfied);
+               return Stringify::GetType(this->stringfied);
        }
 
        operator int() const
        {
-               return Stringfy::Restore(this->stringfied);
+               return Stringify::Restore(this->stringfied);
        }
 
        operator std::string() const
        {
-               return Stringfy::Restore(this->stringfied);
+               return Stringify::Restore(this->stringfied);
        }
 
 private:
index 9b2ceb7c04d55e6e9bc0471a72078f1e4a374d46..1ccdd6a490d39a6c8e4c0b78d95c6a84041fa7b0 100644 (file)
@@ -51,14 +51,14 @@ public:
 TEST(PolicySDKTests, policy_value_int)
 {
        PolicyValue value(1);
-       EXPECT_EQ(Stringfy::Type::Integer, value.getType());
+       EXPECT_EQ(Stringify::Type::Integer, value.getType());
        EXPECT_EQ(static_cast<int>(value), 1);
 }
 
 TEST(PolicySDKTests, policy_value_string)
 {
        PolicyValue value("TEXT");
-       EXPECT_EQ(Stringfy::Type::String, value.getType());
+       EXPECT_EQ(Stringify::Type::String, value.getType());
        EXPECT_EQ(static_cast<std::string>(value), "TEXT");
 }
 
index 596c4a394b9554961253e17ea4e9510c1d6113ef..8978d042106673c608b646a6443178c5cf333cf8 100644 (file)
@@ -16,7 +16,7 @@
 
 #include "vist.hpp"
 
-#include <vist/rmi/exposer.hpp>
+#include <vist/rmi/gateway.hpp>
 #include <vist/logger.hpp>
 #include <vist/exception.hpp>
 
@@ -37,10 +37,10 @@ Vist::Vist()
 void Vist::start()
 {
        INFO(VIST) << "Vist daemon starts.";
-       rmi::Exposer exposer(SOCK_ADDR);
+       rmi::Gateway gateway(SOCK_ADDR);
 
-       exposer.expose(this, "Vist::query", &Vist::query);
-       exposer.start();
+       gateway.expose(this, "Vist::query", &Vist::query);
+       gateway.start();
 }
 
 Rows Vist::query(const std::string& statement)
index d5b64a5015c0dc5017baf8c84ad25d0c07a79035..117d612eb9decdc31c5706932ebf0771b9d65901 100644 (file)
@@ -21,7 +21,7 @@
  *  EXPECT_EQ(dumped, "I/1000");
  *
  *  /// dumped string to origin type
- *  int origin = Stringfy::Restore(dumped);
+ *  int origin = Stringify::Restore(dumped);
  *  EXPECT_EQ(origin, "1000");
  */
 
@@ -33,7 +33,7 @@
 
 namespace vist {
 
-class Stringfy final {
+class Stringify final {
 public:
        enum class Type : char {
                Integer = 'I',
@@ -43,7 +43,7 @@ public:
 
        template <typename T>
        static std::string Dump(T origin);
-       static Stringfy Restore(const std::string& dumped);
+       static Stringify Restore(const std::string& dumped);
 
        static Type GetType(const std::string& dumped);
 
@@ -51,8 +51,8 @@ public:
        operator int() const;
 
 private:
-       explicit Stringfy(int origin) noexcept;
-       explicit Stringfy(const std::string& origin) noexcept;
+       explicit Stringify(int origin) noexcept;
+       explicit Stringify(const std::string& origin) noexcept;
 
        static std::pair<Type, std::string> Parse(const std::string& dumped);
 
@@ -66,13 +66,13 @@ private:
 };
 
 template <typename T>
-std::string Stringfy::Dump(T origin)
+std::string Stringify::Dump(T origin)
 {
-       return Stringfy(origin).dump();
+       return Stringify(origin).dump();
 }
 
 template <typename T>
-std::string Stringfy::convert(const T& origin) const noexcept
+std::string Stringify::convert(const T& origin) const noexcept
 {
        std::stringstream ss;
        ss << static_cast<char>(this->type) << '/' << origin;