libpappsomspp
Library for mass spectrometry
pappso::GrpSubGroupSet Class Reference

#include <grpsubgroupset.h>

Public Member Functions

 GrpSubGroupSet ()
 
 GrpSubGroupSet (const GrpSubGroupSet &other)
 
 ~GrpSubGroupSet ()
 
unsigned int size () const
 
void addAll (const GrpSubGroupSet &other)
 
void remove (GrpSubGroup *p_remove_sub_group)
 
void add (GrpSubGroup *p_add_sub_group)
 
std::list< GrpSubGroup * >::iterator erase (std::list< GrpSubGroup * >::iterator it)
 
std::list< GrpSubGroup * >::const_iterator begin () const
 
std::list< GrpSubGroup * >::const_iterator end () const
 
bool contains (GrpSubGroup *get) const
 
const QString printInfos () const
 

Private Attributes

friend GrpGroup
 
std::list< GrpSubGroup * > m_grpSubGroupPtrList
 

Detailed Description

Definition at line 33 of file grpsubgroupset.h.

Constructor & Destructor Documentation

◆ GrpSubGroupSet() [1/2]

pappso::GrpSubGroupSet::GrpSubGroupSet ( )

Definition at line 30 of file grpsubgroupset.cpp.

31 {
32 }

◆ GrpSubGroupSet() [2/2]

pappso::GrpSubGroupSet::GrpSubGroupSet ( const GrpSubGroupSet other)

Definition at line 34 of file grpsubgroupset.cpp.

35  : m_grpSubGroupPtrList(other.m_grpSubGroupPtrList)
36 {
37 }
std::list< GrpSubGroup * > m_grpSubGroupPtrList

◆ ~GrpSubGroupSet()

pappso::GrpSubGroupSet::~GrpSubGroupSet ( )

Definition at line 39 of file grpsubgroupset.cpp.

40 {
41 }

Member Function Documentation

◆ add()

void pappso::GrpSubGroupSet::add ( GrpSubGroup p_add_sub_group)

Definition at line 112 of file grpsubgroupset.cpp.

113 {
114 
115  std::list<GrpSubGroup *>::iterator it(m_grpSubGroupPtrList.begin()),
116  itEnd(m_grpSubGroupPtrList.end());
117 
118 
119  while(it != itEnd)
120  {
121  if(p_add_sub_group == *it)
122  {
123  // this subgroup is already in list
124  return;
125  }
126  if(p_add_sub_group > *it)
127  {
128  it = m_grpSubGroupPtrList.insert(it, p_add_sub_group);
129  return;
130  }
131  it++;
132  }
133  m_grpSubGroupPtrList.push_back(p_add_sub_group);
134 }

References m_grpSubGroupPtrList.

◆ addAll()

void pappso::GrpSubGroupSet::addAll ( const GrpSubGroupSet other)

Definition at line 45 of file grpsubgroupset.cpp.

46 {
47 
48  std::list<GrpSubGroup *>::iterator it(m_grpSubGroupPtrList.begin());
49  std::list<GrpSubGroup *>::iterator itEnd(m_grpSubGroupPtrList.end());
50  std::list<GrpSubGroup *>::const_iterator itIn(
51  other.m_grpSubGroupPtrList.begin());
52  std::list<GrpSubGroup *>::const_iterator itInEnd(
53  other.m_grpSubGroupPtrList.end());
54 
55  while((itIn != itInEnd) && (it != itEnd))
56  {
57  if(*itIn < *it)
58  {
59  it++;
60  continue;
61  }
62  if(*itIn > *it)
63  {
64  it = m_grpSubGroupPtrList.insert(it, *itIn);
65  it++;
66  itIn++;
67  continue;
68  }
69  if(*itIn == *it)
70  {
71  itIn++;
72  it++;
73  }
74  }
75  while(itIn != itInEnd)
76  {
77  m_grpSubGroupPtrList.push_back(*itIn);
78  itIn++;
79  }
80 }

References m_grpSubGroupPtrList.

Referenced by pappso::GrpMapPeptideToSubGroupSet::getSubGroupSet().

◆ begin()

std::list<GrpSubGroup *>::const_iterator pappso::GrpSubGroupSet::begin ( ) const
inline

Definition at line 58 of file grpsubgroupset.h.

59  {
60  return m_grpSubGroupPtrList.begin();
61  };

References m_grpSubGroupPtrList.

◆ contains()

bool pappso::GrpSubGroupSet::contains ( GrpSubGroup get) const

Definition at line 89 of file grpsubgroupset.cpp.

90 {
91 
92  std::list<GrpSubGroup *>::const_iterator it(m_grpSubGroupPtrList.begin()),
93  itEnd(m_grpSubGroupPtrList.end());
94 
95 
96  while(it != itEnd)
97  {
98  if(p_sub_group == *it)
99  {
100  // this subgroup is already in list
101  return true;
102  }
103  if(p_sub_group > *it)
104  {
105  return false;
106  }
107  it++;
108  }
109  return false;
110 }

References m_grpSubGroupPtrList.

Referenced by pappso::GrpGroup::addSubGroupSp().

◆ end()

std::list<GrpSubGroup *>::const_iterator pappso::GrpSubGroupSet::end ( ) const
inline

Definition at line 63 of file grpsubgroupset.h.

64  {
65  return m_grpSubGroupPtrList.end();
66  };

References m_grpSubGroupPtrList.

◆ erase()

std::list<GrpSubGroup *>::iterator pappso::GrpSubGroupSet::erase ( std::list< GrpSubGroup * >::iterator  it)
inline

Definition at line 53 of file grpsubgroupset.h.

54  {
55  return m_grpSubGroupPtrList.erase(it);
56  };

References m_grpSubGroupPtrList.

Referenced by pappso::GrpGroup::addSubGroupSp().

◆ printInfos()

const QString pappso::GrpSubGroupSet::printInfos ( ) const

Definition at line 138 of file grpsubgroupset.cpp.

139 {
140  QString infos;
141  std::list<GrpSubGroup *>::const_iterator it(m_grpSubGroupPtrList.begin()),
142  itEnd(m_grpSubGroupPtrList.end());
143 
144 
145  while(it != itEnd)
146  {
147  infos.append((*it)->getFirstAccession() + " " +
148  QString("0x%1").arg(
149  (quintptr)*it, QT_POINTER_SIZE * 2, 16, QChar('0')) +
150  "\n");
151  it++;
152  }
153 
154  return infos;
155 }

References m_grpSubGroupPtrList.

Referenced by pappso::GrpGroup::check().

◆ remove()

void pappso::GrpSubGroupSet::remove ( GrpSubGroup p_remove_sub_group)

Definition at line 83 of file grpsubgroupset.cpp.

84 {
85  m_grpSubGroupPtrList.remove(p_remove_sub_group);
86 }

References m_grpSubGroupPtrList.

◆ size()

unsigned int pappso::GrpSubGroupSet::size ( ) const
inline

Definition at line 45 of file grpsubgroupset.h.

46  {
47  return m_grpSubGroupPtrList.size();
48  };

References m_grpSubGroupPtrList.

Member Data Documentation

◆ GrpGroup

friend pappso::GrpSubGroupSet::GrpGroup
private

Definition at line 35 of file grpsubgroupset.h.

◆ m_grpSubGroupPtrList

std::list<GrpSubGroup *> pappso::GrpSubGroupSet::m_grpSubGroupPtrList
private

The documentation for this class was generated from the following files: