bpp-seq3  3.0.0
bpp::NamedContainer< T > Class Template Referenceabstract

A Container template for objects that are accessible through names. More...

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

+ Inheritance diagram for bpp::NamedContainer< T >:

Public Member Functions

 NamedContainer ()
 
virtual ~NamedContainer ()
 
virtual size_t getSize () const =0
 Get the number of objects in the container. More...
 
virtual void clear ()=0
 Delete all objects in the container. More...
 

Protected Member Functions

virtual const std::shared_ptr< T > getObject (const std::string &name) const =0
 Retrieve an object from the container. More...
 
virtual std::shared_ptr< T > getObject (const std::string &name)=0
 
virtual bool hasObject (const std::string &name) const =0
 Check if a object with a given name is present in the container. More...
 
virtual std::shared_ptr< T > removeObject (const std::string &name)=0
 Extract and remove a object from the container. More...
 
virtual void deleteObject (const std::string &name)=0
 Remove a object from the container. More...
 
virtual std::vector< std::string > getObjectNames () const =0
 Get all the names of the objects in the container. More...
 

Detailed Description

template<class T>
class bpp::NamedContainer< T >

A Container template for objects that are accessible through names.

The objects are all stored as shared pointers.

Definition at line 62 of file NamedContainer.h.

Constructor & Destructor Documentation

◆ NamedContainer()

template<class T >
bpp::NamedContainer< T >::NamedContainer ( )
inline

Definition at line 65 of file NamedContainer.h.

◆ ~NamedContainer()

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

Definition at line 66 of file NamedContainer.h.

Member Function Documentation

◆ clear()

◆ deleteObject()

template<class T >
virtual void bpp::NamedContainer< T >::deleteObject ( const std::string &  name)
protectedpure virtual

Remove a object from the container.

Parameters
nameThe name of the object.

Implemented in bpp::VectorMappedContainer< T >, bpp::VectorMappedContainer< Sequence >, bpp::VectorMappedContainer< ProbabilisticSequence >, and bpp::MappedNamedContainer< T >.

◆ getObject() [1/2]

template<class T >
virtual const std::shared_ptr<T> bpp::NamedContainer< T >::getObject ( const std::string &  name) const
protectedpure virtual

Retrieve an object from the container.

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

Implemented in bpp::VectorMappedContainer< T >, bpp::VectorMappedContainer< Sequence >, bpp::VectorMappedContainer< ProbabilisticSequence >, and bpp::MappedNamedContainer< T >.

◆ getObject() [2/2]

template<class T >
virtual std::shared_ptr<T> bpp::NamedContainer< T >::getObject ( const std::string &  name)
protectedpure virtual

◆ getObjectNames()

template<class T >
virtual std::vector<std::string> bpp::NamedContainer< T >::getObjectNames ( ) const
protectedpure virtual

Get all the names of the objects in the container.

Returns
A vector of strings with all object names.

Implemented in bpp::VectorMappedContainer< T >, bpp::VectorMappedContainer< Sequence >, bpp::VectorMappedContainer< ProbabilisticSequence >, and bpp::MappedNamedContainer< T >.

◆ getSize()

template<class T >
virtual size_t bpp::NamedContainer< T >::getSize ( ) const
pure virtual

Get the number of objects in the container.

Returns
The number of objects in the container.

Implemented in bpp::VectorMappedContainer< T >, bpp::VectorMappedContainer< Sequence >, bpp::VectorMappedContainer< ProbabilisticSequence >, and bpp::MappedNamedContainer< T >.

◆ hasObject()

template<class T >
virtual bool bpp::NamedContainer< T >::hasObject ( const std::string &  name) const
protectedpure virtual

Check if a object with a given name is present in the container.

Parameters
nameThe name of the object.
Returns
True if a object with the given name is present in the container.

Implemented in bpp::VectorMappedContainer< T >, bpp::VectorMappedContainer< Sequence >, bpp::VectorMappedContainer< ProbabilisticSequence >, and bpp::MappedNamedContainer< T >.

◆ removeObject()

template<class T >
virtual std::shared_ptr<T> bpp::NamedContainer< T >::removeObject ( const std::string &  name)
protectedpure virtual

Extract and remove a object from the container.

Parameters
nameThe name of the object.

Implemented in bpp::VectorMappedContainer< T >, bpp::VectorMappedContainer< Sequence >, bpp::VectorMappedContainer< ProbabilisticSequence >, and bpp::MappedNamedContainer< T >.


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