bpp-seq3  3.0.0
bpp::NamedContainerInterface< 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::NamedContainerInterface< T >:
+ Collaboration diagram for bpp::NamedContainerInterface< T >:

Public Member Functions

 NamedContainerInterface ()
 
virtual ~NamedContainerInterface ()
 
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...
 
virtual Clonableclone () const=0
 

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 const T & object (const std::string &name) const =0
 
virtual T & object (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::NamedContainerInterface< T >

A Container template for objects that are accessible through names.

The objects are all stored as shared pointers.

Definition at line 22 of file NamedContainer.h.

Constructor & Destructor Documentation

◆ NamedContainerInterface()

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

Definition at line 26 of file NamedContainer.h.

◆ ~NamedContainerInterface()

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

Definition at line 27 of file NamedContainer.h.

Member Function Documentation

◆ clear()

template<class T >
virtual void bpp::NamedContainerInterface< T >::clear ( )
pure virtual

◆ deleteObject()

template<class T >
virtual void bpp::NamedContainerInterface< 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< bpp::Sequence >, bpp::VectorMappedContainer< SequenceType >, and bpp::MappedNamedContainer< T >.

◆ getObject() [1/2]

template<class T >
virtual const std::shared_ptr<T> bpp::NamedContainerInterface< 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::MappedNamedContainer< T >.

◆ getObject() [2/2]

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

◆ getObjectNames()

template<class T >
virtual std::vector<std::string> bpp::NamedContainerInterface< 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< bpp::Sequence >, bpp::VectorMappedContainer< SequenceType >, and bpp::MappedNamedContainer< T >.

◆ getSize()

template<class T >
virtual size_t bpp::NamedContainerInterface< 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< bpp::Sequence >, bpp::VectorMappedContainer< SequenceType >, and bpp::MappedNamedContainer< T >.

◆ hasObject()

template<class T >
virtual bool bpp::NamedContainerInterface< 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::MappedNamedContainer< T >.

◆ object() [1/2]

template<class T >
virtual const T& bpp::NamedContainerInterface< T >::object ( const std::string &  name) const
protectedpure virtual

◆ object() [2/2]

template<class T >
virtual T& bpp::NamedContainerInterface< T >::object ( const std::string &  name)
protectedpure virtual

◆ removeObject()

template<class T >
virtual std::shared_ptr<T> bpp::NamedContainerInterface< 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< bpp::Sequence >, bpp::VectorMappedContainer< SequenceType >, and bpp::MappedNamedContainer< T >.


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