File: RecordKeyVector.h

package info (click to toggle)
bedtools 2.26.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 55,328 kB
  • sloc: cpp: 37,989; sh: 6,930; makefile: 2,225; python: 163
file content (65 lines) | stat: -rw-r--r-- 1,485 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
 * RecordKeyVector.h
 *
 *  Created on: Dec 14, 2012
 *      Author: nek3d
 */

#ifndef KEYVECTOR_H_
#define KEYVECTOR_H_


#include "Record.h"
#include <vector>

using namespace std;


class RecordKeyVector {
public:
	typedef Record * elemType;
	typedef vector<Record *> vecType;
	typedef vecType::iterator iterator_type;
	RecordKeyVector();
    RecordKeyVector(elemType item);
    RecordKeyVector(elemType item, vecType *vector);
    ~RecordKeyVector();

    const RecordKeyVector &operator=(const RecordKeyVector &other);
    iterator_type begin();
    iterator_type next();
    iterator_type end();
    void erase();
    size_t size() const ;
    bool empty() const ; //only checks whether list is empty. Doesn't check key.
    void push_back(elemType item);
    elemType getKey() const ;
    void setKey(elemType key);

    //setVectorNoCopy will make our list share the nodes of another
    //list, not copy them.
    void setVector(vecType *vec);

    // WARNING! clearVector will NOT delete records pointed to by list nodes. Caller must do that separately, since the RecordKeyVector
    // does not have it's own RecordMgr member.
    void clearVector();

    void clearAll() {
    	setKey(NULL);
    	clearVector();
    }
    bool allClear() { return (_key == NULL && empty()); }

    void sortVector();
    void swap(RecordKeyVector &other);


private:
    elemType _key;
    vecType *_recVec;
    int _currPos;
    bool _mustDeleteVec;
};


#endif /* RECORDKEYLIST_H_ */