BamTools  2.5.1
Public Member Functions | List of all members
BamTools::SamProgramChain Class Reference

Sorted container "chain" of SamProgram records. More...

#include <SamProgramChain.h>

Public Member Functions

 SamProgramChain ()
 constructor More...
 
 SamProgramChain (const SamProgramChain &other)
 copy constructor More...
 
 ~SamProgramChain ()
 destructor More...
 
void Add (SamProgram &program)
 Appends a program to program chain. More...
 
void Add (std::vector< SamProgram > &programs)
 Appends a batch of programs to the end of the chain. More...
 
void Clear ()
 Clears all program records. More...
 
bool Contains (const SamProgram &program) const
 Returns true if chains has this program record (matching on ID). More...
 
bool Contains (const std::string &programId) const
 Returns true if chains has a program record with this ID. More...
 
SamProgramFirst ()
 Fetches first (oldest) record in the chain. More...
 
const SamProgramFirst () const
 
bool IsEmpty () const
 Returns true if chain contains no records. More...
 
SamProgramLast ()
 Fetches last (newest) record in the chain. More...
 
const SamProgramLast () const
 
int Size () const
 Returns number of program records in the chain. More...
 
SamProgramoperator[] (const std::string &programId)
 Retrieves the modifiable SamProgram record that matches programId. More...
 
SamProgramIterator Begin ()
 
SamProgramConstIterator Begin () const
 
SamProgramConstIterator ConstBegin () const
 
SamProgramIterator End ()
 
SamProgramConstIterator End () const
 
SamProgramConstIterator ConstEnd () const
 

Detailed Description

Sorted container "chain" of SamProgram records.

Provides methods for operating on a collection of SamProgram records.

Note
Underlying container is NOT ordered by linkage, but by order of appearance in SamHeader and subsequent Add() calls. Using the current iterators will not allow you to step through the header's program history. Instead use First()/Last() to access oldest/newest records, respectively.

Constructor & Destructor Documentation

◆ SamProgramChain() [1/2]

SamProgramChain::SamProgramChain ( )

constructor

◆ SamProgramChain() [2/2]

SamProgramChain::SamProgramChain ( const SamProgramChain other)

copy constructor

◆ ~SamProgramChain()

SamProgramChain::~SamProgramChain ( )

destructor

Member Function Documentation

◆ Add() [1/2]

void SamProgramChain::Add ( SamProgram program)

Appends a program to program chain.

Duplicate entries are silently discarded.

Note
Underlying container is NOT ordered by linkage, but by order of appearance in SamHeader and subsequent Add() calls. Using the current iterators will not allow you to step through the header's program history. Instead use First()/Last() to access oldest/newest records, respectively.
Parameters
[in]programentry to be appended

◆ Add() [2/2]

void SamProgramChain::Add ( std::vector< SamProgram > &  programs)

Appends a batch of programs to the end of the chain.

This is an overloaded function.

Parameters
[in]programsbatch of program records to append
See also
Add()

◆ Begin() [1/2]

SamProgramConstIterator SamProgramChain::Begin ( )
Returns
an STL iterator pointing to the first (oldest) program record
See also
ConstBegin(), End(), First()
Returns
an STL const_iterator pointing to the first (oldest) program record

This is an overloaded function.

See also
ConstBegin(), End(), First()

◆ Begin() [2/2]

SamProgramConstIterator BamTools::SamProgramChain::Begin ( ) const

◆ Clear()

void SamProgramChain::Clear ( )

Clears all program records.

◆ ConstBegin()

SamProgramConstIterator SamProgramChain::ConstBegin ( ) const
Returns
an STL const_iterator pointing to the first (oldest) program record
See also
Begin(), ConstEnd(), First()

◆ ConstEnd()

SamProgramConstIterator SamProgramChain::ConstEnd ( ) const
Returns
an STL const_iterator pointing to the imaginary entry after the last (newest) program record
See also
ConstBegin(), End(), Last()

◆ Contains() [1/2]

bool SamProgramChain::Contains ( const SamProgram program) const

Returns true if chains has this program record (matching on ID).

This is an overloaded function.

Parameters
[in]programSamProgram to search for
Returns
true if chain contains program (matching on ID)

◆ Contains() [2/2]

bool SamProgramChain::Contains ( const std::string &  programId) const

Returns true if chains has a program record with this ID.

Parameters
[in]programIdsearch for program matching this ID
Returns
true if chain contains a program record with this ID

◆ End() [1/2]

SamProgramConstIterator SamProgramChain::End ( )
Returns
an STL iterator pointing to the imaginary entry after the last (newest) program record
See also
Begin(), ConstEnd(), Last()
Returns
an STL const_iterator pointing to the imaginary entry after the last (newest) program record

This is an overloaded function.

See also
Begin(), ConstEnd(), Last()

◆ End() [2/2]

SamProgramConstIterator BamTools::SamProgramChain::End ( ) const

◆ First() [1/2]

const SamProgram & SamProgramChain::First ( )

Fetches first (oldest) record in the chain.

Warning
This function will fail if the chain is empty. If this is possible, check the result of IsEmpty() before calling this function.
Returns
a modifiable reference to the first (oldest) program entry
See also
Begin(), Last()

This is an overloaded function.

Warning
This function will fail if the chain is empty. If this is possible, check the result of IsEmpty() before calling this function.
Returns
a read-only reference to the first (oldest) program entry
See also
Begin(), ConstBegin(), Last()

◆ First() [2/2]

const SamProgram& BamTools::SamProgramChain::First ( ) const

◆ IsEmpty()

bool SamProgramChain::IsEmpty ( ) const

Returns true if chain contains no records.

See also
Size()

◆ Last() [1/2]

const SamProgram & SamProgramChain::Last ( )

Fetches last (newest) record in the chain.

Warning
This function will fail if the chain is empty. If this is possible, check the result of IsEmpty() before calling this function.
Returns
a modifiable reference to the last (newest) program entry
See also
End(), First()

This is an overloaded function.

Warning
This function will fail if the chain is empty. If this is possible, check the result of IsEmpty() before calling this function.
Returns
a read-only reference to the last (newest) program entry
See also
End(), ConstEnd(), First()

◆ Last() [2/2]

const SamProgram& BamTools::SamProgramChain::Last ( ) const

◆ operator[]()

SamProgram & SamProgramChain::operator[] ( const std::string &  programId)

Retrieves the modifiable SamProgram record that matches programId.

Warning
If the chain contains no read group matching this ID, this function will print an error and terminate. Check the return value of Contains() if this may be possible.
Parameters
[in]programIdID of program record to retrieve
Returns
a modifiable reference to the SamProgram associated with the ID

◆ Size()

int SamProgramChain::Size ( ) const

Returns number of program records in the chain.

See also
IsEmpty()

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