BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PDBRecords.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_FORMAT_PDBRECORDS_H
6 #define BALL_FORMAT_PDBRECORDS_H
7 
8 #include <vector>
9 #include <stdexcept>
10 
11 #ifndef BALL_DATATYPE_HASHMAP_H
12 # include <BALL/DATATYPE/hashMap.h>
13 #endif
14 
15 #ifndef BALL_CONCEPT_PERSISTENCEMANAGER_H
17 #endif
18 
19 namespace BALL
20 {
21 
32  : public PersistentObject
33  {
34  public:
35 
36  /* STL compatibility typedefs */
37  typedef std::vector<String>::iterator Iterator;
38  typedef std::vector<String>::iterator iterator;
39  typedef std::vector<String>::const_iterator ConstIterator;
40  typedef std::vector<String>::const_iterator const_iterator;
41  typedef std::vector<String>::reverse_iterator ReverseIterator;
42  typedef std::vector<String>::reverse_iterator reverse_iterator;
43  typedef std::vector<String>::const_reverse_iterator ConstReverseIterator;
44  typedef std::vector<String>::const_reverse_iterator const_reverse_iterator;
45  typedef String value_type;
46  typedef String ValueType;
47  typedef String& reference;
48  typedef String& Reference;
49  typedef const String& const_reference;
50  typedef const String& ConstReference;
51  typedef std::vector<String>::difference_type difference_type;
52  typedef std::vector<String>::difference_type DifferenceType;
53  typedef std::vector<String>::size_type size_type;
54  typedef std::vector<String>::size_type SizeType;
55 
57 
58 
60 
61  PDBRecords() ;
63  PDBRecords(const PDBRecords& pdbi) ;
65  virtual ~PDBRecords() ;
67 
71 
72  PDBRecords& operator = (const PDBRecords& rhs);
74 
80 
81  ConstIterator begin() const { return records_.begin(); }
83  Iterator begin() { return records_.begin(); }
85  ConstIterator end() const { return records_.end(); }
87  Iterator end() { return records_.end(); }
89  ConstReverseIterator rbegin() const { return records_.rbegin(); }
91  ReverseIterator rbegin() { return records_.rbegin(); }
93  ConstReverseIterator rend() const { return records_.rend(); }
95  ReverseIterator rend() { return records_.rend(); }
97  SizeType size() const { return records_.size(); }
99  SizeType max_size() const { return records_.max_size(); }
101  SizeType capacity() const { return records_.capacity(); }
103  bool empty() const { return records_.empty(); }
105  void clear() { records_.clear(); }
107  void resize(SizeType sz, ValueType c = ValueType()) { records_.resize(sz, c); }
109  Reference front() { return records_.front(); }
111  ConstReference front() const { return records_.front(); }
113  Reference back() { return records_.back(); }
115  ConstReference back() const { return records_.back(); }
117  void push_back(ConstReference x) { records_.push_back(x); }
119  void insert(Iterator pos, ConstReference value) { records_.insert(pos, value); }
121  void insert(Iterator pos, SizeType n, ConstReference value) { records_.insert(pos, n, value); }
123  void pop_back() { records_.pop_back(); }
125  Iterator erase(Iterator pos) { return records_.erase(pos); }
127  Iterator erase(Iterator first, Iterator last) { return records_.erase(first, last); }
129  bool operator == (const PDBRecords& rhs) const { return records_ == rhs.records_; }
131  bool operator != (const PDBRecords& rhs) const { return records_ != rhs.records_; }
133  bool operator < (const PDBRecords& rhs) const { return records_ < rhs.records_; }
135  bool operator > (const PDBRecords& rhs) const { return records_ > rhs.records_; }
137  bool operator <= (const PDBRecords& rhs) const { return records_ <= rhs.records_; }
139  bool operator >= (const PDBRecords& rhs) const { return records_ >= rhs.records_; }
141  void swap(PDBRecords& rhs) { records_.swap(rhs.records_); }
143  ConstReference operator [] (SizeType n) const { return records_[n]; }
145  Reference operator [] (SizeType n) { return records_[n]; }
149  ConstReference at(SizeType n) const { return records_.at(n); }
153  Reference at(SizeType n) { return records_.at(n); }
155 
159 
162  //void write(PersistenceManager& pm) const;
163  void persistentWrite(PersistenceManager& pm, const char* name) const;
164 
167  //bool read(PersistenceManager& pm);
168  void persistentRead(PersistenceManager& pm);
169 
171 
172  protected:
174  std::vector<String> records_;
175  };
176 
177 } // namespace BALL
178 
179 #endif // BALL_FORMAT_PDBRECORDS_H