OpenStructure
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
sequence_list.hh
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // This file is part of the OpenStructure project <www.openstructure.org>
3 //
4 // Copyright (C) 2008-2020 by the OpenStructure authors
5 //
6 // This library is free software; you can redistribute it and/or modify it under
7 // the terms of the GNU Lesser General Public License as published by the Free
8 // Software Foundation; either version 3.0 of the License, or (at your option)
9 // any later version.
10 // This library is distributed in the hope that it will be useful, but WITHOUT
11 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13 // details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with this library; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 //------------------------------------------------------------------------------
19 #ifndef OST_SEQ_SEQUENCE_LIST_HH
20 #define OST_SEQ_SEQUENCE_LIST_HH
21 
25 
26 namespace ost { namespace seq {
27 
28 class SequenceList;
29 
34 public:
35  friend class SequenceList;
38  typedef Iterator iterator;
40 
41  void AddSequence(const ConstSequenceHandle& sequence);
42 
44  int GetCount() const;
45 
46  ConstSequenceHandle operator[](int index) const;
47  Iterator Begin() const;
48  Iterator End() const;
49 
50  // for stl compat
51  Iterator begin() const { return Begin(); }
52  Iterator end() const { return End(); }
53 
54  bool SequencesHaveEqualLength() const;
55  bool IsValid() const;
56 
60  ConstSequenceList Take(int n) const;
61 
63  ConstSequenceList Slice(int first, int n) const;
64 
65  ConstSequenceHandle FindSequence(const String& name) const;
66  int GetMinLength() const;
67  int GetMaxLength() const;
69  impl::SequenceListImplPtr& Impl() const;
71 protected:
72 
73  void CheckValidity() const;
75 };
76 
81 public:
82 
85  typedef Iterator iterator;
86  SequenceList();
87  void AddSequence(const SequenceHandle& sequence);
88 
89  bool SequencesHaveEqualLength() const;
90  // \brief get number of sequences
91  int GetCount() const;
92  SequenceHandle operator[](int index) const;
93  Iterator Begin() const;
94  Iterator End() const;
95 
99  SequenceList Take(int n) const;
100 
102  SequenceList Slice(int first, int n) const;
103  // for stl compat
104  Iterator begin() const { return Begin(); }
105  Iterator end() const { return End(); }
106 
107  bool IsValid() const;
108 
109  int GetMinLength() const;
110  int GetMaxLength() const;
111 
112  SequenceHandle FindSequence(const String& name) const;
113  // \internal
114  impl::SequenceListImplPtr& Impl() const;
116 
117  operator ConstSequenceList() const;
118 protected:
119  void CheckValidity() const;
120 
122 };
123 
126 
127 #if(OST_INFO_ENABLED)
128 void DLLEXPORT_OST_SEQ SequenceListToInfo(const ConstSequenceList& seq_list,
130  info::InfoGroup& group);
131 
133 SequenceList DLLEXPORT_OST_SEQ SequenceListFromInfo(info::InfoGroup& group);
134 #endif
135 }}
136 
137 #endif
#define DLLEXPORT_OST_SEQ
mutable sequence handle.
SequenceListImplVector::iterator SequenceImplListIterator
boost::shared_ptr< SequenceListImpl > SequenceListImplPtr
std::string String
Definition: base.hh:54
list of immutable sequences.
impl::SequenceListIterator< SequenceHandle, impl::SequenceImplListIterator > Iterator
std::vector< SequenceImplPtr > SequenceList
SequenceList DLLEXPORT_OST_SEQ CreateSequenceList()
Iterator begin() const
Iterator end() const
impl::SequenceListImplPtr impl_
list of sequences.
ConstSequenceList DLLEXPORT_OST_SEQ CreateConstSequenceList()
impl::SequenceListImplPtr impl_
impl::SequenceListIterator< ConstSequenceHandle, impl::SequenceImplListIterator > Iterator