From b99891a2d93c419ea848c7b6bff85c63cc99ea07 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 16 Sep 2015 10:21:01 +0100 Subject: Add doxygen comments --- libadhocutil/factory.h | 25 ++++++++++++++++++++++++- libadhocutil/scopeExit.h | 2 ++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/libadhocutil/factory.h b/libadhocutil/factory.h index 28fce62..f1998a7 100644 --- a/libadhocutil/factory.h +++ b/libadhocutil/factory.h @@ -5,24 +5,47 @@ #include "visibility.h" namespace AdHoc { + /** + * Base class for factories creating instances of Base. + */ template class DLL_PUBLIC Factory { public: virtual ~Factory() = 0; - virtual Base * create(const Params & ...) const = 0; + /** + * Create a new instance of Base, overridden in a subclass to construct a new specific class. + * @param p The parameters passed to Impl constructor. + */ + virtual Base * create(const Params & ... p) const = 0; + /** + * A factory for a concrete implementation of Base + */ template > class DLL_PUBLIC For : public _ { public: + /** + * Create a new instance of Base implemented in Impl. + * @param p The parameters passed to Impl constructor. + */ Base * create(const Params & ... p) const override { return new Impl(p...); } }; + /** + * Helper to get the factory for a specific implementation. + * @param name The name of the implementation. + */ static const Factory * get(const std::string & name); + /** + * Helper to create a new instance from a specific factory. + * @param name The name of the implementation. + * @param p The parameters to pass to the constructor. + */ static Base * create(const std::string & name, const Params & ... p); }; } diff --git a/libadhocutil/scopeExit.h b/libadhocutil/scopeExit.h index 17618a4..73c2ca2 100644 --- a/libadhocutil/scopeExit.h +++ b/libadhocutil/scopeExit.h @@ -26,7 +26,9 @@ class DLL_PUBLIC ScopeExit { ScopeExit(const Event & pre, const Event & success = Event(), const Event & failure = Event(), const Event & post = Event()); ~ScopeExit(); + /// Copying construction is disabled ScopeExit(const ScopeExit &) = delete; + /// Assignment is disabled void operator=(const ScopeExit &) = delete; /// @cond -- cgit v1.2.3