Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3281914
D3524.id10726.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D3524.id10726.diff
View Options
diff --git a/services/tunnelbroker/src/Database/DatabaseEntitiesTools.h b/services/tunnelbroker/src/Database/DatabaseEntitiesTools.h
--- a/services/tunnelbroker/src/Database/DatabaseEntitiesTools.h
+++ b/services/tunnelbroker/src/Database/DatabaseEntitiesTools.h
@@ -13,19 +13,10 @@
namespace database {
template <typename T> std::shared_ptr<T> createItemByType() {
- throw std::runtime_error("invalid Item type");
+ static_assert(std::is_base_of<Item, T>::value, "T must inherit from Item");
+ return std::make_shared<T>();
}
-template <>
-std::shared_ptr<DeviceSessionItem> createItemByType<DeviceSessionItem>();
-
-template <>
-std::shared_ptr<SessionSignItem> createItemByType<SessionSignItem>();
-
-template <> std::shared_ptr<PublicKeyItem> createItemByType<PublicKeyItem>();
-
-template <> std::shared_ptr<MessageItem> createItemByType<MessageItem>();
-
} // namespace database
} // namespace network
} // namespace comm
diff --git a/services/tunnelbroker/src/Database/DatabaseEntitiesTools.cpp b/services/tunnelbroker/src/Database/DatabaseEntitiesTools.cpp
deleted file mode 100644
--- a/services/tunnelbroker/src/Database/DatabaseEntitiesTools.cpp
+++ /dev/null
@@ -1,27 +0,0 @@
-#include "DatabaseEntitiesTools.h"
-
-namespace comm {
-namespace network {
-namespace database {
-
-template <>
-std::shared_ptr<DeviceSessionItem> createItemByType<DeviceSessionItem>() {
- return std::make_shared<DeviceSessionItem>();
-}
-
-template <>
-std::shared_ptr<SessionSignItem> createItemByType<SessionSignItem>() {
- return std::make_shared<SessionSignItem>();
-}
-
-template <> std::shared_ptr<PublicKeyItem> createItemByType<PublicKeyItem>() {
- return std::make_shared<PublicKeyItem>();
-}
-
-template <> std::shared_ptr<MessageItem> createItemByType<MessageItem>() {
- return std::make_shared<MessageItem>();
-}
-
-} // namespace database
-} // namespace network
-} // namespace comm
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 17, 10:20 AM (19 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2522247
Default Alt Text
D3524.id10726.diff (1 KB)
Attached To
Mode
D3524: [services] Tunnelbroker - Avoid listing all entities in DatabaseEntities.
Attached
Detach File
Event Timeline
Log In to Comment