PCMContainer.h

Go to the documentation of this file.
00001 
00002 //
00003 // This source file is a part of ParCompMark
00004 // Parallel Compositing Benchmark Framework
00005 //
00006 // for latest info see http://parcompmark.sourceforge.net
00007 
00008 //
00009 // Copyright (C) 2006 IT2 ParCompMark Dev. Team
00010 // 
00011 // This program is free software; you can redistribute it and/or
00012 // modify it under the terms of the GNU General Public License
00013 // as published by the Free Software Foundation; either version 2
00014 // of the License, or (at your option) any later version.
00015 // 
00016 // This program is distributed in the hope that it will be useful,
00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00019 // GNU General Public License for more details.
00020 // 
00021 // You should have received a copy of the GNU General Public License
00022 // along with this program; if not, write to the Free Software
00023 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00024 
00027 
00028 #ifndef __PCM_CONTAINER_H__
00029 #  define __PCM_CONTAINER_H__
00030 
00031 //
00032 // Inner includes
00033 //
00034 
00035 #  include "PCMPremeditations.h"
00036 
00037 #  include "PCMLogger.h"
00038 
00039 #  include "PCMException.h"
00040 
00041 //
00042 // Outer includes
00043 //
00044 
00045 #  include <string>
00046 
00047 #  include <map>
00048 
00049 namespace ParCompMark
00050 {
00051 
00055   template < class ElementType, class LockType > class Container
00056   {
00057 
00058         //
00059         // Unit test class
00060         //
00061 #  ifdef PARCOMPMARK_TEST
00062         friend class ParCompMarkTest::TestContainer;
00063 #  endif
00064 
00065         //
00066         // Typedefs
00067         //
00068 
00069    public:
00070 
00072         typedef Pointer < Container < ElementType,
00073         LockType >,
00074         LockType > Pointer;
00075 
00077         typedef typename ElementType::Pointer ElementPointer;
00078 
00080         typedef std::map < std::string,
00081         ElementPointer > ElementsMap;
00082 
00084         typedef typename ElementsMap::iterator Iterator;
00085 
00086         //
00087         // Variables
00088         //
00089 
00091 
00092 
00093    protected:
00094 
00100         ElementsMap mElements;
00101 
00103 
00104         //
00105         // Constructors & destructor
00106         //
00107 
00109 
00110 
00111    public:
00112 
00116         Container();
00117 
00121         virtual ~ Container();
00122 
00124 
00125         //
00126         // Methods
00127         //
00128 
00130 
00131 
00132    public:
00133 
00139         virtual void add(std::string name, ElementPointer element);
00140 
00146         virtual ElementPointer get(const std::string & name);
00147 
00153         virtual bool has(const std::string & name);
00154 
00159         virtual void remove(const std::string & name);
00160 
00165         virtual u32 getSize();
00166 
00171         virtual bool isEmpty();
00172 
00177         virtual Iterator begin();
00178 
00183         virtual Iterator end();
00184 
00186 
00187   };
00188 
00189   //
00190   // Include header implementation
00191   //
00192 
00193 #  include "PCMContainer_impl.h"
00194 
00195 }
00196 
00197 #endif