From 7ee6a7473b104e1912221714215392306ecf2e0e Mon Sep 17 00:00:00 2001 From: Huynh Tran Date: Fri, 17 Jun 2005 22:11:43 +0000 Subject: Force a user class to use the Storage singleton instead of instantiating DALStorage directly. --- src/dalstorage.h | 45 +++++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/dalstorage.h b/src/dalstorage.h index 0bde7d33..a95ede9f 100644 --- a/src/dalstorage.h +++ b/src/dalstorage.h @@ -37,23 +37,18 @@ namespace tmwserv /** * A storage class that relies on DAL. + * + * Notes: + * - this class cannot be instanciated nor duplicated in order to force + * a user class to use the Storage singleton. */ class DALStorage: public Storage { - public: - /** - * Constructor. - */ - DALStorage(void); - - - /** - * Destructor. - */ - ~DALStorage(void) - throw(); + // friend so that Storage can call the constructor. + friend class Storage; + public: /** * Save changes to the database permanently. */ @@ -82,6 +77,32 @@ class DALStorage: public Storage private: + /** + * Constructor. + */ + DALStorage(void); + + + /** + * Destructor. + */ + ~DALStorage(void) + throw(); + + + /** + * Copy constructor. + */ + DALStorage(const DALStorage& rhs); + + + /** + * Assignment operator. + */ + DALStorage& + operator=(const DALStorage& rhs); + + /** * Connect to the database and initialize it if necessary. */ -- cgit v1.2.3-60-g2f50