F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
SizedContainer.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title SizedContainer
3 // \author bocchino
4 // \brief An abstract base class representing a sized container
5 // ======================================================================
6 
7 #ifndef Fw_SizedContainer_HPP
8 #define Fw_SizedContainer_HPP
9 
10 #include "Fw/FPrimeBasicTypes.hpp"
11 
12 namespace Fw {
13 
15  private:
16  // ----------------------------------------------------------------------
17  // Private constructors
18  // ----------------------------------------------------------------------
19 
22  SizedContainer(const SizedContainer&) = delete;
23 
24  protected:
25  // ----------------------------------------------------------------------
26  // Protected constructors and destructors
27  // ----------------------------------------------------------------------
28 
31 
33  virtual ~SizedContainer() = default;
34 
35  private:
36  // ----------------------------------------------------------------------
37  // Private member functions
38  // ----------------------------------------------------------------------
39 
43  SizedContainer& operator=(const SizedContainer&) = delete;
44 
45  public:
46  // ----------------------------------------------------------------------
47  // Public member functions
48  // ----------------------------------------------------------------------
49 
51  virtual void clear() = 0;
52 
55  virtual FwSizeType getSize() const = 0;
56 
59  virtual FwSizeType getCapacity() const = 0;
60 
63  bool isEmpty() const { return this->getSize() == 0; }
64 
67  bool isFull() const { return this->getSize() >= this->getCapacity(); }
68 };
69 
70 } // namespace Fw
71 
72 #endif
bool isEmpty() const
PlatformSizeType FwSizeType
virtual FwSizeType getSize() const =0
virtual ~SizedContainer()=default
Destructor.
SizedContainer()
Zero-argument constructor.
virtual FwSizeType getCapacity() const =0
virtual void clear()=0
Clear the container.