libStatGen Software 1
Loading...
Searching...
No Matches
PosList.h
1/*
2 * Copyright (C) 2011 Regents of the University of Michigan
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __POSLIST_H__
19#define __POSLIST_H__
20
21#include <vector>
22
23/// Store refID/position, but does not store values < 0.
25{
26public:
27 /// Constructor
28 PosList();
29
30 /// Reserves space for numRefs reference ids and numPositions for each id.
31 PosList(int numRefs, int numPositions);
32
33 /// Destructor
34 virtual ~PosList();
35
36 /// Add the specified reference id/position (negative values will not be
37 /// added).
38 void addPosition(int refID, int refPosition);
39
40 /// Return whether or not this list contains the specified reference ID
41 /// and position (negative values will automatically return false).
42 bool hasPosition(int refID, int refPosition);
43
44protected:
45 PosList(const PosList& p);
46
47 void initVars();
48
49 // 2-D vector.
50 // indexed by [referenceID][position].
51 std::vector < std::vector<bool> > myPosList;
52
53 int myNumRefs;
54 int myNumPos;
55};
56
57
58#endif
Store refID/position, but does not store values < 0.
Definition PosList.h:25
bool hasPosition(int refID, int refPosition)
Return whether or not this list contains the specified reference ID and position (negative values wil...
Definition PosList.cpp:81
virtual ~PosList()
Destructor.
Definition PosList.cpp:36
PosList()
Constructor.
Definition PosList.cpp:21
void addPosition(int refID, int refPosition)
Add the specified reference id/position (negative values will not be added).
Definition PosList.cpp:42