1
0
Fork 0

re-added ConstructionGuard

This commit is contained in:
jsteemann 2017-03-17 15:12:14 +01:00
parent fa26d8ca6c
commit a2a14652b2
2 changed files with 10 additions and 3 deletions

View File

@ -75,10 +75,10 @@ std::unique_ptr<ViewImplementation> LoggerView::creator(
LogicalView* view, arangodb::velocypack::Slice const& info) { LogicalView* view, arangodb::velocypack::Slice const& info) {
LOG_TOPIC(INFO, Logger::FIXME) << "called LoggerView::creator"; LOG_TOPIC(INFO, Logger::FIXME) << "called LoggerView::creator";
return std::make_unique<LoggerView>(view, info); return std::make_unique<LoggerView>(ConstructionGuard(), view, info);
} }
LoggerView::LoggerView(LogicalView* logical, LoggerView::LoggerView(ConstructionGuard const&, LogicalView* logical,
arangodb::velocypack::Slice const& info) arangodb::velocypack::Slice const& info)
: ViewImplementation(logical, info) { : ViewImplementation(logical, info) {
VPackSlice properties = info.get("properties"); VPackSlice properties = info.get("properties");

View File

@ -42,8 +42,15 @@ class LoggerView final : public ViewImplementation {
static std::unique_ptr<ViewImplementation> creator( static std::unique_ptr<ViewImplementation> creator(
LogicalView*, arangodb::velocypack::Slice const&); LogicalView*, arangodb::velocypack::Slice const&);
private:
// private struct that does not do anything
// we require it in the constructor of LoggerView so we
// can ensure any constructor calls are coming from the
// LoggerView's creator method
struct ConstructionGuard {};
public: public:
LoggerView(LogicalView* logical, LoggerView(ConstructionGuard const&, LogicalView* logical,
arangodb::velocypack::Slice const& info); arangodb::velocypack::Slice const& info);
~LoggerView() = default; ~LoggerView() = default;