OpenStructure
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 
55  bool IsValid() const;
56 
60  ConstSequenceList Take(int n) const;
61 
63  ConstSequenceList Slice(int first, int n) const;
64 
66  int GetMinLength() const;
67  int GetMaxLength() const;
71 protected:
72 
73  void CheckValidity() const;
75 };
76 
81 public:
82 
85  typedef Iterator iterator;
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
116 
117  operator ConstSequenceList() const;
118 protected:
119  void CheckValidity() const;
120 
122 };
123 
126 
127 #if(OST_INFO_ENABLED)
129 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
list of immutable sequences.
impl::SequenceListIterator< ConstSequenceHandle, impl::SequenceImplListIterator > Iterator
int GetCount() const
get number of sequences in list
bool SequencesHaveEqualLength() const
ConstSequenceHandle operator[](int index) const
impl::SequenceListImplPtr & Impl() const
ConstSequenceHandle FindSequence(const String &name) const
void AddSequence(const ConstSequenceHandle &sequence)
ConstSequenceList Take(int n) const
create a sequence list consisting of n first sequences
ConstSequenceList(const impl::SequenceListImplPtr &impl)
ConstSequenceList Slice(int first, int n) const
create a sequence list from the given splice interval
impl::SequenceListImplPtr impl_
mutable sequence handle.
list of sequences.
Iterator begin() const
impl::SequenceListIterator< SequenceHandle, impl::SequenceImplListIterator > Iterator
bool SequencesHaveEqualLength() const
void CheckValidity() const
Iterator end() const
SequenceList(const impl::SequenceListImplPtr &impl)
Iterator End() const
SequenceHandle FindSequence(const String &name) const
impl::SequenceListImplPtr & Impl() const
int GetMaxLength() const
void AddSequence(const SequenceHandle &sequence)
int GetMinLength() const
Iterator Begin() const
impl::SequenceListImplPtr impl_
SequenceHandle operator[](int index) const
SequenceList Take(int n) const
create a sequence list consisting of n first sequences
SequenceList Slice(int first, int n) const
create a sequence list from the given splice interval
std::string String
Definition: base.hh:54
std::vector< SequenceImplPtr > SequenceList
SequenceListImplVector::iterator SequenceImplListIterator
boost::shared_ptr< SequenceListImpl > SequenceListImplPtr
ConstSequenceList DLLEXPORT_OST_SEQ CreateConstSequenceList()
SequenceList DLLEXPORT_OST_SEQ CreateSequenceList()
Definition: base.dox:1
#define DLLEXPORT_OST_SEQ