MercuryDPM  0.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
WallHandler.h
Go to the documentation of this file.
1 //Copyright (c) 2013-2014, The MercuryDPM Developers Team. All rights reserved.
2 //For the list of developers, see <http://www.MercuryDPM.org/Team>.
3 //
4 //Redistribution and use in source and binary forms, with or without
5 //modification, are permitted provided that the following conditions are met:
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above copyright
9 // notice, this list of conditions and the following disclaimer in the
10 // documentation and/or other materials provided with the distribution.
11 // * Neither the name MercuryDPM nor the
12 // names of its contributors may be used to endorse or promote products
13 // derived from this software without specific prior written permission.
14 //
15 //THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 //ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 //WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 //DISCLAIMED. IN NO EVENT SHALL THE MERCURYDPM DEVELOPERS TEAM BE LIABLE FOR ANY
19 //DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 //(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 //LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 //ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 //(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 //SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 
26 #ifndef WALLHANDLER_H
27 #define WALLHANDLER_H
28 
29 #include <iostream>
30 #include <vector>
31 
32 class BaseWall;
33 
37 {
38 public:
40  WallHandler();
41 
43  WallHandler(const WallHandler& BH);
44 
47 
49  ~WallHandler();
50 
52  void copyAndAddWall(const BaseWall& B);
53 
55  void copyAndAddWall(const BaseWall* B);
56 
58  void addWall(BaseWall* W);
59 
61  void removeWall(unsigned const int id);
62 
64  void removeLastWall();
65 
67  void clear();
68 
70  void readWall(std::istream& is);
71 
73  BaseWall* getWall(const unsigned int id) const;
74 
76  BaseWall* getLastWall() const;
77 
79  unsigned int getNumberOfWalls() const;
80 
82  unsigned int getStorageCapacity() const;
83 
85  void setStorageCapacity(const unsigned int N);
86 
88  const std::vector<BaseWall*>::const_iterator begin() const;
89 
91  const std::vector<BaseWall*>::iterator begin();
92 
94  const std::vector<BaseWall*>::const_iterator end() const;
95 
97  const std::vector<BaseWall*>::iterator end();
98 
99 private:
101  std::vector<BaseWall*> walls_;
102 };
103 
104 #endif
105 
unsigned int getStorageCapacity() const
Gets the storage capacity of this WallHandler.
Definition: WallHandler.cc:230
void readWall(std::istream &is)
Reads BaseWall into the WallHandler from restart data.
Definition: WallHandler.cc:133
std::vector< BaseWall * > walls_
The actual list of Wall pointers.
Definition: WallHandler.h:101
void setStorageCapacity(const unsigned int N)
Sets the storage capacity of this WallHandler.
Definition: WallHandler.cc:236
BaseWall * getLastWall() const
Gets a pointer to the last BaseWall in this WallHandler.
Definition: WallHandler.cc:218
void removeLastWall()
Removes the last BaseWall from the WallHandler.
Definition: WallHandler.cc:119
const std::vector< BaseWall * >::const_iterator begin() const
Gets the begin of the const_iterator over all BaseWall in this WallHandler.
Definition: WallHandler.cc:242
const std::vector< BaseWall * >::const_iterator end() const
Gets the end of the const_iterator over all BaseWall in this WallHandler.
Definition: WallHandler.cc:254
void copyAndAddWall(const BaseWall &B)
Creates a copy of a BaseWall and adds it to the WallHandler.
Definition: WallHandler.cc:84
unsigned int getNumberOfWalls() const
Gets the number of BaseWalls in this WallHandler.
Definition: WallHandler.cc:224
WallHandler()
Default WallHandler constructor, it simply creates an empty WallHandler.
Definition: WallHandler.cc:37
void addWall(BaseWall *W)
Adds a new BaseWall to the WallHandler.
Definition: WallHandler.cc:97
Container to store all BaseWall.
Definition: WallHandler.h:36
WallHandler operator=(const WallHandler &rhs)
Assigns one WallHandler to another WallHandler.
Definition: WallHandler.cc:59
~WallHandler()
Destructor, it simply destructs the WallHandler and all BaseWall it contains.
Definition: WallHandler.cc:75
BaseWall * getWall(const unsigned int id) const
Gets a pointer to the BaseWall at the specified index in the WallHandler.
Definition: WallHandler.cc:203
void clear()
Empties the whole WallHandler by removing all BaseWall.
Definition: WallHandler.cc:127
void removeWall(unsigned const int id)
Removes a BaseWall from the WallHandler.
Definition: WallHandler.cc:104