Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

utility_AMOS.hh File Reference

Include file for AMOS utilities, #defines, inttypes and exceptions. More...

#include "inttypes_AMOS.hh"
#include "exceptions_AMOS.hh"
#include <new>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <cassert>
#include <errno.h>

Include dependency graph for utility_AMOS.hh:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Namespaces

namespace  AMOS

Defines

#define __utility_AMOS_HH   1
#define HASHMAP   std

Functions

void * SafeCalloc (size_t num, size_t size)
 Safe calloc wrapper.
void * SafeMalloc (size_t size)
 Safe malloc wrapper.
void * SafeRealloc (void *P, size_t size)
 Safe realloc wrapper.
char * SafeStrdup (const char *str)
 Safe strdup wrapper.
char Complement (char ch)
 Returns the DNA complement of an IUPAC character.
void ReverseComplement (std::string &str)
 Takes the DNA reverse complement of an IUPAC string.
void ReverseComplement (char *str)
 Takes the DNA reverse complement of an IUPAC string.
void Reverse (std::string &str)
 Reverses the contents of a string.
void Reverse (char *str)
 Reverses the contents of a string.
void writeLE (std::ostream &out, const uint8_t *i)
 Writes an 8-bit int in little-endian byte order.
void writeLE (std::ostream &out, const int8_t *i)
void writeLE (std::ostream &out, const BankFlags_t *i)
void writeLE (std::ostream &out, const uint16_t *i)
 Writes a 16-bit int in little-endian byte order.
void writeLE (std::ostream &out, const int16_t *i)
void writeLE (std::ostream &out, const uint32_t *i)
 Writes a 32-bit int in little-endian byte order.
void writeLE (std::ostream &out, const int32_t *i)
void writeLE (std::ostream &out, const uint64_t *i)
 Writes a 64-bit int in little-endian byte order.
void writeLE (std::ostream &out, const int64_t *i)
void readLE (std::istream &in, uint8_t *i)
 Reads a little-endian 8-bit int.
void readLE (std::istream &in, int8_t *i)
void readLE (std::istream &in, BankFlags_t *i)
void readLE (std::istream &in, uint16_t *i)
 Reads a little-endian 16-bit int.
void readLE (std::istream &in, int16_t *i)
void readLE (std::istream &in, uint32_t *i)
 Reads a little-endian 32-bit int.
void readLE (std::istream &in, int32_t *i)
void readLE (std::istream &in, uint64_t *i)
 Reads a little-endian 64-bit int.
void readLE (std::istream &in, int64_t *i)


Detailed Description

Include file for AMOS utilities, #defines, inttypes and exceptions.

Author:
Adam M Phillippy
Date:
07/27/2004

Definition in file utility_AMOS.hh.


Define Documentation

#define __utility_AMOS_HH   1
 

Definition at line 11 of file utility_AMOS.hh.

#define HASHMAP   std
 

Definition at line 40 of file utility_AMOS.hh.


Function Documentation

char AMOS::Complement char  ch  ) 
 

Returns the DNA complement of an IUPAC character.

Complement-able IUPAC characters are ACGTUMRWSYKVHDB, while NX*- are also acceptable but are self-complementary. Characters other than these will throw an exception.

Parameters:
ch The character to take the complement of
Exceptions:
ArgumentException_t if ch is an invalid character
Returns:
void
Definition at line 20 of file utility_AMOS.cc.

References AMOS_THROW_ARGUMENT.

Referenced by AMOS::ReverseComplement().

void readLE std::istream &  in,
int64_t *  i
[inline]
 

Definition at line 357 of file utility_AMOS.hh.

References AMOS::readLE().

Referenced by main().

void readLE std::istream &  in,
uint64_t *  i
[inline]
 

Reads a little-endian 64-bit int.

Parameters:
in The istream to read from
i A pointer to the int storage
Precondition:
Same preconditions as istream::read
Returns:
void
Definition at line 351 of file utility_AMOS.hh.

References ltoh64.

void readLE std::istream &  in,
int32_t *  i
[inline]
 

Definition at line 337 of file utility_AMOS.hh.

References AMOS::readLE().

void readLE std::istream &  in,
uint32_t *  i
[inline]
 

Reads a little-endian 32-bit int.

Parameters:
in The istream to read from
i A pointer to the int storage
Precondition:
Same preconditions as istream::read
Returns:
void
Definition at line 331 of file utility_AMOS.hh.

References ltoh32.

void readLE std::istream &  in,
int16_t *  i
[inline]
 

Definition at line 317 of file utility_AMOS.hh.

References AMOS::readLE().

void readLE std::istream &  in,
uint16_t *  i
[inline]
 

Reads a little-endian 16-bit int.

Parameters:
in The istream to read from
i A pointer to the int storage
Precondition:
Same preconditions as istream::read
Returns:
void
Definition at line 311 of file utility_AMOS.hh.

References ltoh16.

void readLE std::istream &  in,
BankFlags_t *  i
[inline]
 

Definition at line 296 of file utility_AMOS.hh.

References AMOS::readLE().

void readLE std::istream &  in,
int8_t *  i
[inline]
 

Definition at line 292 of file utility_AMOS.hh.

References AMOS::readLE().

void readLE std::istream &  in,
uint8_t *  i
[inline]
 

Reads a little-endian 8-bit int.

Parameters:
in The istream to read from
i A pointer to the int storage
Precondition:
Same preconditions as istream::read
Returns:
void
Definition at line 288 of file utility_AMOS.hh.

Referenced by AMOS::Bank_t::concat(), AMOS::Bank_t::fetchBID(), AMOS::BankStream_t::ignore(), AMOS::BankStream_t::operator>>(), AMOS::readLE(), AMOS::Sequence_t::readRecord(), AMOS::Scaffold_t::readRecord(), AMOS::Read_t::readRecord(), AMOS::Overlap_t::readRecord(), AMOS::Link_t::readRecord(), AMOS::Layout_t::readRecord(), AMOS::Kmer_t::readRecord(), AMOS::Index_t::readRecord(), AMOS::Group_t::readRecord(), AMOS::Fragment_t::readRecord(), AMOS::Feature_t::readRecord(), AMOS::IEdge_t::readRecord(), AMOS::Tile_t::readRecord(), AMOS::Distribution_t::readRecord(), AMOS::Contig_t::readRecord(), and AMOS::Bank_t::removeBID().

void AMOS::Reverse char *  str  ) 
 

Reverses the contents of a string.

Parameters:
str The string to reverse
Returns:
void
Definition at line 96 of file utility_AMOS.cc.

void AMOS::Reverse std::string &  str  ) 
 

Reverses the contents of a string.

Simply calls the STL reverse "algorithm" but in an AMOS way

Parameters:
str The string to reverse
Returns:
void
Definition at line 89 of file utility_AMOS.cc.

Referenced by AMOS::Sequence_t::getQualString(), AMOS::Contig_t::getUngappedQualString(), and AMOS::ReverseComplement().

void AMOS::ReverseComplement char *  str  ) 
 

Takes the DNA reverse complement of an IUPAC string.

Complement-able IUPAC characters are ACGTUMRWSYKVHDB, while NX*- are also acceptable but are self-complementary. Characters other than these will throw an exception.

Parameters:
str The string to reverse complement
Exceptions:
ArgumentException_t if invalid characters are found
Returns:
void
Definition at line 78 of file utility_AMOS.cc.

References AMOS::Complement(), and AMOS::Reverse().

void AMOS::ReverseComplement std::string &  str  ) 
 

Takes the DNA reverse complement of an IUPAC string.

Complement-able IUPAC characters are ACGTUMRWSYKVHDB, while NX*- are also acceptable but are self-complementary. Characters other than these will throw an exception.

Parameters:
str The string to reverse complement
Exceptions:
ArgumentException_t if invalid characters are found
Returns:
void
Definition at line 67 of file utility_AMOS.cc.

References AMOS::Complement(), and AMOS::Reverse().

Referenced by AMOS::Sequence_t::getSeqString(), and AMOS::Contig_t::getUngappedSeqString().

void* SafeCalloc size_t  num,
size_t  size
[inline]
 

Safe calloc wrapper.

Detects calloc failure and throws AMOS::AllocException_t exception instead of returning a NULL pointer.

Parameters:
num Number of elements to allocate
size Number of bytes per element
Postcondition:
The memory is allocated
Exceptions:
AllocException_t on memory exhaustion
Returns:
Pointer to the new memory block
Definition at line 60 of file utility_AMOS.hh.

References AMOS_THROW_ALLOC.

void* SafeMalloc size_t  size  )  [inline]
 

Safe malloc wrapper.

Detects malloc failure and throws AMOS::AllocException_t exception instead of returning a NULL pointer.

Parameters:
size Number of bytes to allocate
Postcondition:
The memory is allocated
Exceptions:
AllocException_t on memory exhaustion
Returns:
Pointer to the new memory block
Definition at line 81 of file utility_AMOS.hh.

References AMOS_THROW_ALLOC.

Referenced by AMOS::Bank_t::BankPartition_t::BankPartition_t(), and AMOS::Bank_t::concat().

void* SafeRealloc void *  P,
size_t  size
[inline]
 

Safe realloc wrapper.

Detects realloc failure and throws AMOS::AllocException_t exception instead of returning a NULL pointer. This helps prevent memory leaks by preventing the original memory block from being lost when the realloc function returns NULL.

Parameters:
P The memory block to re-allocate
size Number of bytes to allocate
Postcondition:
The memory is allocated
Exceptions:
AllocException_t on memory exhaustion
Returns:
Pointer to the new memory block
Definition at line 105 of file utility_AMOS.hh.

References AMOS_THROW_ALLOC.

Referenced by AMOS::Bank_t::concat(), AMOS::Sequence_t::operator=(), AMOS::Kmer_t::operator=(), AMOS::Sequence_t::readRecord(), AMOS::Kmer_t::readRecord(), AMOS::Kmer_t::setSeqString(), AMOS::Sequence_t::setSequence(), and AMOS::Sequence_t::uncompress().

char* SafeStrdup const char *  str  )  [inline]
 

Safe strdup wrapper.

Detects malloc failure and throws AMOS::AllocException_t exception instead of returning a NULL pointer.

Parameters:
str The string to copy
Postcondition:
The memory is allocated and the string is copied
Exceptions:
AllocException_t on memory exhaustion
Returns:
Pointer to the new string copy
Definition at line 126 of file utility_AMOS.hh.

References AMOS_THROW_ALLOC.

void writeLE std::ostream &  out,
const int64_t *  i
[inline]
 

Definition at line 274 of file utility_AMOS.hh.

References AMOS::writeLE().

Referenced by main().

void writeLE std::ostream &  out,
const uint64_t *  i
[inline]
 

Writes a 64-bit int in little-endian byte order.

Parameters:
out The ostream to write to
i A pointer to the int to write
Precondition:
Same preconditions as ostream::write
Returns:
void
Definition at line 268 of file utility_AMOS.hh.

References htol64.

void writeLE std::ostream &  out,
const int32_t *  i
[inline]
 

Definition at line 254 of file utility_AMOS.hh.

References AMOS::writeLE().

void writeLE std::ostream &  out,
const uint32_t *  i
[inline]
 

Writes a 32-bit int in little-endian byte order.

Parameters:
out The ostream to write to
i A pointer to the int to write
Precondition:
Same preconditions as ostream::write
Returns:
void
Definition at line 248 of file utility_AMOS.hh.

References htol32.

void writeLE std::ostream &  out,
const int16_t *  i
[inline]
 

Definition at line 234 of file utility_AMOS.hh.

References AMOS::writeLE().

void writeLE std::ostream &  out,
const uint16_t *  i
[inline]
 

Writes a 16-bit int in little-endian byte order.

Parameters:
out The ostream to write to
i A pointer to the int to write
Precondition:
Same preconditions as ostream::write
Returns:
void
Definition at line 228 of file utility_AMOS.hh.

References htol16.

void writeLE std::ostream &  out,
const BankFlags_t *  i
[inline]
 

Definition at line 213 of file utility_AMOS.hh.

References AMOS::writeLE().

void writeLE std::ostream &  out,
const int8_t *  i
[inline]
 

Definition at line 209 of file utility_AMOS.hh.

References AMOS::writeLE().

void writeLE std::ostream &  out,
const uint8_t *  i
[inline]
 

Writes an 8-bit int in little-endian byte order.

Parameters:
out The ostream to write to
i A pointer to the int to write
Precondition:
Same preconditions as ostream::write
Returns:
void
Definition at line 205 of file utility_AMOS.hh.

Referenced by AMOS::Bank_t::appendBID(), AMOS::Bank_t::concat(), AMOS::BankStream_t::operator<<(), AMOS::Bank_t::removeBID(), AMOS::Bank_t::replaceBID(), AMOS::writeLE(), AMOS::Sequence_t::writeRecord(), AMOS::Scaffold_t::writeRecord(), AMOS::Read_t::writeRecord(), AMOS::Overlap_t::writeRecord(), AMOS::Link_t::writeRecord(), AMOS::Layout_t::writeRecord(), AMOS::Kmer_t::writeRecord(), AMOS::Index_t::writeRecord(), AMOS::Group_t::writeRecord(), AMOS::Fragment_t::writeRecord(), AMOS::Feature_t::writeRecord(), AMOS::IEdge_t::writeRecord(), AMOS::Tile_t::writeRecord(), AMOS::Distribution_t::writeRecord(), and AMOS::Contig_t::writeRecord().


Generated on Tue May 17 15:19:40 2005 for libAMOS by doxygen 1.3.8