bpp-seq3  3.0.0
PositionedContainer.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_SEQ_CONTAINER_POSITIONEDCONTAINER_H
6 #define BPP_SEQ_CONTAINER_POSITIONEDCONTAINER_H
7 
8 #include <Bpp/Clonable.h>
9 
10 // From the STL:
11 
12 #include <memory>
13 
14 namespace bpp
15 {
26 template<class T>
28  public virtual Clonable
29 {
30 public:
33 
34 public:
38  virtual size_t getSize() const = 0;
39 
40  virtual void setSize(size_t size) {}
41 
42  virtual void clear() = 0;
43 
50  virtual const std::shared_ptr<T> getObject(size_t objectIndex) const = 0;
51 
58  virtual std::shared_ptr<T> getObject(size_t objectIndex) = 0;
59 
66  virtual const T& object(size_t objectIndex) const = 0;
67 
74  virtual T& object(size_t objectIndex) = 0;
75 
82  virtual std::shared_ptr<T> removeObject(size_t objectIndex) = 0;
83 
89  virtual void deleteObject(size_t objectIndex) = 0;
90 };
91 } // end of namespace bpp.
92 #endif // BPP_SEQ_CONTAINER_POSITIONEDCONTAINER_H
The PositionedContainer interface.
virtual void deleteObject(size_t objectIndex)=0
Delete an object from the container.
virtual T & object(size_t objectIndex)=0
Get a reference toward an object from the container.
virtual void setSize(size_t size)
virtual std::shared_ptr< T > removeObject(size_t objectIndex)=0
Extract and remove a object from the container.
virtual std::shared_ptr< T > getObject(size_t objectIndex)=0
Retrieve an object from the container.
virtual const std::shared_ptr< T > getObject(size_t objectIndex) const =0
Retrieve an object from the container.
virtual size_t getSize() const =0
the size
virtual const T & object(size_t objectIndex) const =0
Get a reference toward an object from the container.
This alphabet is used to deal NumericAlphabet.