Loading...
Searching...
No Matches
BamTools::SamProgramChain Class Reference

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

`#include <SamProgramChain.h>`

## Public Member Functions

| SamProgramChain ()
| constructor
void | Add (SamProgram &program)
| Appends a program to program chain.
void | Add (std::vector< SamProgram > &programs)
| Appends a batch of programs to the end of the chain.
void | Clear ()
| Clears all program records.
bool | Contains (const SamProgram &program) const
| Returns true if chains has this program record (matching on ID).
bool | Contains (const std::string &programId) const
| Returns true if chains has a program record with this ID.
SamProgram & | First ()
| Fetches first (oldest) record in the chain.
const SamProgram & | First () const
| Fetches first (oldest) record in the chain.
bool | IsEmpty () const
| Returns `true` if chain contains no records.
SamProgram & | Last ()
| Fetches last (newest) record in the chain.
const SamProgram & | Last () const
| Fetches last (newest) record in the chain.
int | Size () const
| Returns number of program records in the chain.
SamProgram & | operator[] (const std::string &programId)
| Retrieves the modifiable SamProgram record that matches programId.
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()

SamProgramChain::SamProgramChain | ( |  | ) |

constructor

## 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] | program | entry 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] | programs | batch of program records to append

See also
  Add()

## Begin() [1/2]

SamProgramIterator SamProgramChain::Begin | ( |  | ) |

Returns
  an STL iterator pointing to the first (oldest) program record

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

## Begin() [2/2]

SamProgramConstIterator SamProgramChain::Begin | ( |  | ) | const

Returns
  an STL const_iterator pointing to the first (oldest) program record

This is an overloaded function.

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

## 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] | program | SamProgram 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] | programId | search for program matching this ID

Returns
  `true` if chain contains a program record with this ID

## End() [1/2]

SamProgramIterator SamProgramChain::End | ( |  | ) |

Returns
  an STL iterator pointing to the imaginary entry after the last (newest) program record

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

## End() [2/2]

SamProgramConstIterator SamProgramChain::End | ( |  | ) | const

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()

## First() [1/2]

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()

## First() [2/2]

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

Fetches first (oldest) record in the chain.

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()

## IsEmpty()

bool SamProgramChain::IsEmpty | ( |  | ) | const

Returns `true` if chain contains no records.

See also
  Size()

## Last() [1/2]

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()

## Last() [2/2]

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

Fetches last (newest) record in the chain.

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()

## 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] | programId | ID 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:

- SamProgramChain.h
- SamProgramChain.cpp