File: Tracker.h

package info (click to toggle)
pymol 3.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 74,084 kB
  • sloc: cpp: 482,660; python: 89,328; ansic: 29,512; javascript: 6,792; sh: 84; makefile: 25
file content (84 lines) | stat: -rw-r--r-- 2,542 bytes parent folder | download | duplicates (3)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84


/* 
A* -------------------------------------------------------------------
B* This file contains source code for the PyMOL computer program
C* Copyright (c) Schrodinger, LLC. 
D* -------------------------------------------------------------------
E* It is unlawful to modify or remove this copyright notice.
F* -------------------------------------------------------------------
G* Please see the accompanying LICENSE file for further information. 
H* -------------------------------------------------------------------
I* Additional authors of this source file include:
-* 
-* 
-*
Z* -------------------------------------------------------------------
*/

#ifndef _H_Tracker
#define _H_Tracker

#include "PyMOLGlobals.h"


/* Tracker is a generic data structure for tracking lists of
   candidates in a manner that:

   (1) is robust with respect to creation and deletion of candidates and lists
   (2) enables efficient iteration over the lists to which a candidate belongs
   (3) enables efficient iteration over the candidates to which a list belongs
   (4) is double-linked so that insertion and deletion take constant time
   (5) keeps running counts so that length determination takes constant time

*/

struct CTracker;

typedef void *TrackerRef;

CTracker *TrackerNew(PyMOLGlobals * G);
void TrackerFree(CTracker * I);


/* creating and deleting candidates, lists, and iterators */

int TrackerNewCand(CTracker * I, TrackerRef * ref);
int TrackerDelCand(CTracker * I, int cand_id);

int TrackerNewList(CTracker * I, TrackerRef * ref);
int TrackerDelList(CTracker * I, int list_id);
int TrackerNewListCopy(CTracker * I, int list_id, TrackerRef * ref);

int TrackerNewIter(CTracker * I, int cand_id, int list_id);
int TrackerDelIter(CTracker * I, int iter_id);


/* creating and destroying links */

int TrackerLink(CTracker * I, int cand_id, int list_id, int priority);
int TrackerUnlink(CTracker * I, int cand_id, int list_id);


/* querying */

int TrackerGetNList(CTracker * I);
int TrackerGetNCand(CTracker * I);
int TrackerGetNLink(CTracker * I);
int TrackerGetNIter(CTracker * I);
int TrackerGetNListForCand(CTracker * I, int cand_id);
int TrackerGetNCandForList(CTracker * I, int list_id);

int TrackerGetCandRef(CTracker * I, int cand_id, TrackerRef ** ref_ret);


/* iterating */

int TrackerIterNextCandInList(CTracker * I, int iter_id, TrackerRef ** ref_ret);
int TrackerIterNextListInCand(CTracker * I, int iter_id, TrackerRef ** ref_ret);

#ifdef TRACKER_UNIT_TEST
int TrackerUnitTest(PyMOLGlobals * G);
#endif

#endif