bpp-seq3  3.0.0
bpp::VectorPositionedContainer< T > Class Template Reference

The template VectorPositionedContainer class. More...

#include <Bpp/Seq/Container/VectorPositionedContainer.h>

+ Inheritance diagram for bpp::VectorPositionedContainer< T >:
+ Collaboration diagram for bpp::VectorPositionedContainer< T >:

Public Member Functions

 VectorPositionedContainer (const std::vector< std::shared_ptr< T >> &vs)
 Build a new container from a set of positions. More...
 
 VectorPositionedContainer (size_t size=0)
 Build a new empty container with specified size. More...
 
 VectorPositionedContainer (const VectorPositionedContainer< T > &vsc)
 
VectorPositionedContainer< T > & operator= (const VectorPositionedContainer< T > &vsc)
 copy where shared_ptr elements are shared More...
 
virtual ~VectorPositionedContainer ()
 
size_t getSize () const override
 the size More...
 
bool isAvailablePosition (size_t objectIndex) const
 
bool hasObjectWithPosition (size_t objectIndex) const
 
void setSize (size_t size) override
 
void clear () override
 Destroys the vector. More...
 
virtual void nullify ()
 Nullify all elements. More...
 
const std::shared_ptr< T > getObject (size_t objectIndex) const override
 Retrieve an object from the container. More...
 
std::shared_ptr< T > getObject (size_t objectIndex) override
 Retrieve an object from the container. More...
 
const T & object (size_t objectIndex) const override
 Get a reference toward an object from the container. More...
 
T & object (size_t objectIndex) override
 Get a reference toward an object from the container. More...
 
void addObject (std::shared_ptr< T > object, size_t objectIndex, bool checkPosition=false)
 Add an object. More...
 
void insertObject (std::shared_ptr< T > object, size_t objectIndex)
 Insert an object. More...
 
std::shared_ptr< T > removeObject (size_t objectIndex) override
 Extract and remove a object from the container. More...
 
void deleteObject (size_t objectIndex) override
 Delete an object from the container. More...
 
void deleteObjects (size_t objectIndex, size_t length)
 
void appendObject (std::shared_ptr< T > object)
 
std::shared_ptr< T > getObject_ (size_t objectIndex) const
 
void addObject_ (std::shared_ptr< T > object, size_t objectIndex, bool checkPosition=false) const
 
The Clonable interface.
VectorPositionedContainer< T > * clone () const override
 

Protected Attributes

std::vector< std::shared_ptr< T > > positions_
 

Detailed Description

template<class T>
class bpp::VectorPositionedContainer< T >

The template VectorPositionedContainer class.

Objects are stored in a std::vector of shared pointers. Object access is hence in $O(1)$.

Definition at line 29 of file VectorPositionedContainer.h.

Constructor & Destructor Documentation

◆ VectorPositionedContainer() [1/3]

template<class T >
bpp::VectorPositionedContainer< T >::VectorPositionedContainer ( const std::vector< std::shared_ptr< T >> &  vs)
inline

Build a new container from a set of positions.

Parameters
vsA std::vector of objects.

Definition at line 42 of file VectorPositionedContainer.h.

◆ VectorPositionedContainer() [2/3]

template<class T >
bpp::VectorPositionedContainer< T >::VectorPositionedContainer ( size_t  size = 0)
inline

Build a new empty container with specified size.

Parameters
sizeNumber of sequences in the container.

Definition at line 51 of file VectorPositionedContainer.h.

◆ VectorPositionedContainer() [3/3]

template<class T >
bpp::VectorPositionedContainer< T >::VectorPositionedContainer ( const VectorPositionedContainer< T > &  vsc)
inline

Definition at line 56 of file VectorPositionedContainer.h.

◆ ~VectorPositionedContainer()

template<class T >
virtual bpp::VectorPositionedContainer< T >::~VectorPositionedContainer ( )
inlinevirtual

Member Function Documentation

◆ addObject()

template<class T >
void bpp::VectorPositionedContainer< T >::addObject ( std::shared_ptr< T >  object,
size_t  objectIndex,
bool  checkPosition = false 
)
inline

◆ addObject_()

template<class T >
void bpp::VectorPositionedContainer< T >::addObject_ ( std::shared_ptr< T >  object,
size_t  objectIndex,
bool  checkPosition = false 
) const
inline

◆ appendObject()

◆ clear()

◆ clone()

template<class T >
VectorPositionedContainer<T>* bpp::VectorPositionedContainer< T >::clone ( ) const
inlineoverridevirtual

◆ deleteObject()

◆ deleteObjects()

◆ getObject() [1/2]

template<class T >
const std::shared_ptr<T> bpp::VectorPositionedContainer< T >::getObject ( size_t  objectIndex) const
inlineoverridevirtual

Retrieve an object from the container.

Parameters
objectIndexThe position of the object.
Returns
A shared pointer toward the Object object with corresponding name.

Implements bpp::PositionedContainerInterface< T >.

Definition at line 127 of file VectorPositionedContainer.h.

References bpp::VectorPositionedContainer< T >::getSize(), and bpp::VectorPositionedContainer< T >::positions_.

Referenced by bpp::TemplateAlignedSequenceContainer< SequenceType, SiteType >::site(), bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::site(), and bpp::TemplateVectorSiteContainer< SiteType, SequenceType >::site_().

◆ getObject() [2/2]

template<class T >
std::shared_ptr<T> bpp::VectorPositionedContainer< T >::getObject ( size_t  objectIndex)
inlineoverridevirtual

Retrieve an object from the container.

Parameters
objectIndexThe position of the object.
Returns
A shared pointer toward the Object object with corresponding name.

Implements bpp::PositionedContainerInterface< T >.

Definition at line 134 of file VectorPositionedContainer.h.

References bpp::VectorPositionedContainer< T >::getSize(), and bpp::VectorPositionedContainer< T >::positions_.

◆ getObject_()

template<class T >
std::shared_ptr<T> bpp::VectorPositionedContainer< T >::getObject_ ( size_t  objectIndex) const
inline

◆ getSize()

◆ hasObjectWithPosition()

template<class T >
bool bpp::VectorPositionedContainer< T >::hasObjectWithPosition ( size_t  objectIndex) const
inline

◆ insertObject()

template<class T >
void bpp::VectorPositionedContainer< T >::insertObject ( std::shared_ptr< T >  object,
size_t  objectIndex 
)
inline

◆ isAvailablePosition()

template<class T >
bool bpp::VectorPositionedContainer< T >::isAvailablePosition ( size_t  objectIndex) const
inline

◆ nullify()

◆ object() [1/2]

template<class T >
const T& bpp::VectorPositionedContainer< T >::object ( size_t  objectIndex) const
inlineoverridevirtual

Get a reference toward an object from the container.

Parameters
objectIndexThe position of the object.
Returns
A reference toward the Object object with corresponding name.

Implements bpp::PositionedContainerInterface< T >.

Definition at line 141 of file VectorPositionedContainer.h.

References bpp::VectorPositionedContainer< T >::getSize(), and bpp::VectorPositionedContainer< T >::positions_.

Referenced by bpp::VectorPositionedContainer< T >::addObject().

◆ object() [2/2]

template<class T >
T& bpp::VectorPositionedContainer< T >::object ( size_t  objectIndex)
inlineoverridevirtual

Get a reference toward an object from the container.

Parameters
objectIndexThe position of the object.
Returns
A reference toward the Object object with corresponding name.

Implements bpp::PositionedContainerInterface< T >.

Definition at line 148 of file VectorPositionedContainer.h.

References bpp::VectorPositionedContainer< T >::getSize(), and bpp::VectorPositionedContainer< T >::positions_.

◆ operator=()

template<class T >
VectorPositionedContainer<T>& bpp::VectorPositionedContainer< T >::operator= ( const VectorPositionedContainer< T > &  vsc)
inline

copy where shared_ptr elements are shared

Definition at line 63 of file VectorPositionedContainer.h.

References bpp::VectorPositionedContainer< T >::positions_.

Referenced by bpp::VectorMappedContainer< T >::operator=().

◆ removeObject()

template<class T >
std::shared_ptr<T> bpp::VectorPositionedContainer< T >::removeObject ( size_t  objectIndex)
inlineoverridevirtual

◆ setSize()

Member Data Documentation

◆ positions_


The documentation for this class was generated from the following file: