00001 /*************************************************************************** 00002 * GContainer.hpp - Container interface class * 00003 * ----------------------------------------------------------------------- * 00004 * copyright (C) 2013-2014 by Juergen Knoedlseder * 00005 * ----------------------------------------------------------------------- * 00006 * * 00007 * This program is free software: you can redistribute it and/or modify * 00008 * it under the terms of the GNU General Public License as published by * 00009 * the Free Software Foundation, either version 3 of the License, or * 00010 * (at your option) any later version. * 00011 * * 00012 * This program is distributed in the hope that it will be useful, * 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00015 * GNU General Public License for more details. * 00016 * * 00017 * You should have received a copy of the GNU General Public License * 00018 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 00019 * * 00020 ***************************************************************************/ 00021 /** 00022 * @file GContainer.hpp 00023 * @brief Definition of interface for container classes 00024 * @author Juergen Knoedlseder 00025 */ 00026 00027 #ifndef GCONTAINER_HPP 00028 #define GCONTAINER_HPP 00029 00030 /* __ Includes ___________________________________________________________ */ 00031 #include "GBase.hpp" 00032 00033 00034 /***********************************************************************//** 00035 * @class GContainer 00036 * 00037 * @brief Interface class for container classes 00038 * 00039 * This class defines the interface for container classes. The usage of the 00040 * interface class imposes on all container classes are coherent interface. 00041 * The following methods are mandatory: 00042 * 00043 * clear - Clear container (inherited from GBase) 00044 * clone - Clones container (inherited from GBase) 00045 * classname - Returns the class name (inherited from GBase) 00046 * print - Print container content (inherited from GBase) 00047 * size - Returns number of objects is container 00048 * is_empty - Checks if container is empty 00049 * remove - Removes an object from the container 00050 * reserve - Reserves space in the container 00051 ***************************************************************************/ 00052 class GContainer : public GBase { 00053 00054 public: 00055 /// @brief Destructor 00056 /// 00057 /// Destroys class. 00058 virtual ~GContainer(void) {} 00059 00060 /// @brief Return number of objects in container 00061 /// 00062 /// @return Number of objects in container. 00063 virtual int size(void) const = 0; 00064 00065 /// @brief Checks if container is empty 00066 /// 00067 /// @return True if no objects are in container, false otherwise. 00068 virtual bool is_empty(void) const = 0; 00069 00070 /// @brief Remove object from container 00071 /// 00072 /// @param[in] index Index. 00073 /// 00074 /// Removes the object with the specified @p index from the container. 00075 virtual void remove(const int& index) = 0; 00076 00077 /// @brief Reserves space in the container 00078 /// 00079 /// @param[in] num Number of objects. 00080 /// 00081 /// Reserves space for @p num objects in the container. 00082 virtual void reserve(const int& num) = 0; 00083 }; 00084 00085 #endif /* GCONTAINER_HPP */