From cd8d1f59941987f1011d0c18b67e62a7624aed47 Mon Sep 17 00:00:00 2001 From: knodlseder <> Date: Thu, 13 Mar 2008 23:53:01 +0000 Subject: [PATCH] initial default implementation --- include/GData.hpp | 29 +++++++++++++++++------------ src/data/GData.cpp | 117 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 131 insertions(+), 15 deletions(-) diff --git a/include/GData.hpp b/include/GData.hpp index d64a807..8b5a294 100644 --- a/include/GData.hpp +++ b/include/GData.hpp @@ -10,41 +10,46 @@ * (at your option) any later version. * * * ***************************************************************************/ +/** + * @file GData.hpp + * @brief GData abstract base class definition. + * @author J. Knodlseder + */ #ifndef GDATA_HPP #define GDATA_HPP /* __ Includes ___________________________________________________________ */ -//#include "GVector.hpp" /* __ Namespaces _________________________________________________________ */ -using namespace std; -/*************************************************************************** - * GData class definition * +/***********************************************************************//** + * @class GData + * + * @brief Abstract GData class interface defintion ***************************************************************************/ class GData { -// Public methods public: // Constructors and destructors - //GData(); - //GData(const GData& d); - //virtual ~GData(); + GData(); + GData(const GData& d); + virtual ~GData(); // Operators + GData& operator= (const GData& data); // Methods -// Methods and data that are available to derived classes protected: // Protected methods + void init_members(void); + void copy_members(const GData& data); + void free_members(void); + virtual GData* clone(void) const = 0; // Protected data area - // this is a test - -// Methods that are available to the base class only private: }; diff --git a/src/data/GData.cpp b/src/data/GData.cpp index 9602cbf..0ba091f 100644 --- a/src/data/GData.cpp +++ b/src/data/GData.cpp @@ -11,13 +11,17 @@ * * * ----------------------------------------------------------------------- * ***************************************************************************/ +/** + * @file GData.cpp + * @brief GData abstract base class implementation. + * @author J. Knodlseder + */ /* __ Includes ___________________________________________________________ */ #include "GException.hpp" #include "GData.hpp" /* __ Namespaces _________________________________________________________ */ -using namespace std; /* __ Method name definitions ____________________________________________ */ @@ -35,6 +39,49 @@ using namespace std; = = ==========================================================================*/ +/***********************************************************************//** + * @brief Constructor + ***************************************************************************/ +GData::GData() +{ + // Initialise class members for clean destruction + init_members(); + + // Return + return; +} + + +/***********************************************************************//** + * @brief Copy constructor + * + * @param data GData instance which should be used for construction + ***************************************************************************/ +GData::GData(const GData& data) +{ + // Initialise class members for clean destruction + init_members(); + + // Copy members + copy_members(data); + + // Return + return; +} + + +/***********************************************************************//** + * @brief Destructor + ***************************************************************************/ +GData::~GData() +{ + // Free members + free_members(); + + // Return + return; +} + /*========================================================================== = = @@ -42,20 +89,84 @@ using namespace std; = = ==========================================================================*/ +/***********************************************************************//** + * @brief Assignment operator + * + * @param[in] data GData instance to be assigned + ***************************************************************************/ +GData& GData::operator= (const GData& data) +{ + // Execute only if object is not identical + if (this != &data) { + + // Free members + free_members(); + + // Initialise private members for clean destruction + init_members(); + + // Copy members + copy_members(data); + + } // endif: object was not identical + + // Return this object + return *this; +} + /*========================================================================== = = - = GData methods = + = GData public methods = = = ==========================================================================*/ /*========================================================================== = = - = GData private functions = + = GData private methods = = = ==========================================================================*/ +/***********************************************************************//** + * @brief Initialise class members + ***************************************************************************/ +void GData::init_members(void) +{ + // Initialise members + + // Return + return; +} + + +/***********************************************************************//** + * @brief Copy class members + * + * @param[in] data GData instance from which members should be copied + ***************************************************************************/ +void GData::copy_members(const GData& data) +{ + // Copy attributes + + // Return + return; +} + + +/***********************************************************************//** + * @brief Delete class members + ***************************************************************************/ +void GData::free_members(void) +{ + // Free memory + + // Mark memory as free + + // Return + return; +} + /*========================================================================== = = -- libgit2 0.21.4