PDBRecords.h

Go to the documentation of this file.
00001 // -*- Mode: C++; tab-width: 2; -*-
00002 // vi: set ts=2:
00003 //
00004 // $Id: PDBRecords.h,v 1.2 2005/12/23 17:01:45 amoll Exp $
00005 //
00006 
00007 #ifndef BALL_FORMAT_PDBRECORDS_H
00008 #define BALL_FORMAT_PDBRECORDS_H
00009 
00010 #include <vector>
00011 #include <stdexcept>
00012 
00013 #ifndef BALL_DATATYPE_HASHMAP_H
00014 # include <BALL/DATATYPE/hashMap.h>
00015 #endif
00016 
00017 namespace BALL 
00018 {
00019   
00029   class BALL_EXPORT PDBRecords
00030   {
00031     public:
00032     
00033     /* STL compatibility typedefs */
00034     typedef std::vector<String>::iterator Iterator;
00035     typedef std::vector<String>::iterator iterator;
00036     typedef std::vector<String>::const_iterator ConstIterator;
00037     typedef std::vector<String>::const_iterator const_iterator;
00038     typedef std::vector<String>::reverse_iterator ReverseIterator;
00039     typedef std::vector<String>::reverse_iterator reverse_iterator;
00040     typedef std::vector<String>::const_reverse_iterator ConstReverseIterator;
00041     typedef std::vector<String>::const_reverse_iterator const_reverse_iterator;
00042     typedef String value_type;
00043     typedef String ValueType;
00044     typedef String& reference;
00045     typedef String& Reference;
00046     typedef const String& const_reference;
00047     typedef const String& ConstReference;
00048     typedef std::vector<String>::difference_type difference_type;
00049     typedef std::vector<String>::difference_type DifferenceType;
00050     typedef std::vector<String>::size_type size_type;
00051     typedef std::vector<String>::size_type SizeType;
00052     
00055 
00056     PDBRecords() ;
00058     PDBRecords(const PDBRecords& pdbi) ;
00060     virtual ~PDBRecords() ;
00062 
00066 
00067     PDBRecords& operator = (const PDBRecords& rhs);
00069 
00075 
00076     ConstIterator begin() const { return records_.begin(); }
00078     Iterator begin() { return records_.begin(); }
00080     ConstIterator end() const { return records_.end(); }
00082     Iterator end() { return records_.end(); }
00084     ConstReverseIterator rbegin() const { return records_.rbegin(); }
00086     ReverseIterator rbegin() { return records_.rbegin(); }
00088     ConstReverseIterator rend() const { return records_.rend(); }
00090     ReverseIterator rend() { return records_.rend(); }
00092     SizeType size() const { return records_.size(); }
00094     SizeType max_size() const { return records_.max_size(); }
00096     SizeType capacity() const { return records_.capacity(); }
00098     bool empty() const { return records_.empty(); }
00100     void clear() { records_.clear(); }
00102     void resize(SizeType sz, ValueType c = ValueType()) { records_.resize(sz, c); }
00104     Reference front() { return records_.front(); }
00106     ConstReference front() const { return records_.front(); }
00108     Reference back() { return records_.back(); }
00110     ConstReference back() const { return records_.back(); }
00112     void push_back(ConstReference x) { records_.push_back(x); }
00114     void insert(Iterator pos, ConstReference value) { records_.insert(pos, value); }
00116     void insert(Iterator pos, SizeType n, ConstReference value) { records_.insert(pos, n, value); }
00118     void pop_back() { records_.pop_back(); }
00120     Iterator erase(Iterator pos) { return records_.erase(pos); }
00122     Iterator erase(Iterator first, Iterator last) { return records_.erase(first, last); }
00124     bool operator == (const PDBRecords& rhs) const { return records_ == rhs.records_; }
00126     bool operator != (const PDBRecords& rhs) const { return records_ != rhs.records_; }
00128     bool operator < (const PDBRecords& rhs) const { return records_ < rhs.records_; }
00130     bool operator > (const PDBRecords& rhs) const { return records_ > rhs.records_; }
00132     bool operator <= (const PDBRecords& rhs) const { return records_ <= rhs.records_; }
00134     bool operator >= (const PDBRecords& rhs) const { return records_ >= rhs.records_; }
00136     void swap(PDBRecords& rhs) { records_.swap(rhs.records_); }
00138     ConstReference operator [] (SizeType n) const { return records_[n]; }
00140     Reference operator [] (SizeType n) { return records_[n]; }
00142     ConstReference at(SizeType n) const throw(std::out_of_range) { return records_.at(n); }
00144     Reference at(SizeType n) throw(std::out_of_range) { return records_.at(n); }
00146 
00147     protected:
00149     std::vector<String> records_;
00150   };
00151   
00152 } // namespace BALL
00153 
00154 #endif // BALL_FORMAT_PDBRECORDS_H