NEURON
spt2queue.h
Go to the documentation of this file.
1 //#ifndef tqueue_h
2 //#define tqueue_h
3 
4 // second splay tree for the NetCons and PreSyns with same delay. First
5 // splay tree for others (especially SelfEvents).
6 // forall_callback does one splay tree first and then the other (so
7 // not in time order)
8 #define COLLECT_TQueue_STATISTICS 1
9 struct SPTREE;
10 
11 class TQItem {
12 public:
13  TQItem();
14  virtual ~TQItem();
15  bool check();
16  void clear(){};
17 public:
18  void* data_;
19  double t_;
20  TQItem* left_;
21  TQItem* right_;
22  TQItem* parent_;
23  int cnt_; // reused: -1 means it is in the second splay tree
24 };
25 
26 class TQueue {
27 public:
28  TQueue();
29  virtual ~TQueue();
30 
31 #if FAST_LEAST // must be on
32  TQItem* least() {return least_;}
33  double least_t(){if (least_) { return least_->t_;}else{return 1e15;}}
34 #else
35  TQItem* least(); // does not remove from TQueue
36  double least_t();
37 #endif
38  TQItem* insert(double t, void* data_);
39  TQItem* insert_fifo(double t, void* data_);
40  TQItem* find(double t);
41  void remove(TQItem*);
42  void move(TQItem*, double tnew);
43  void move_least(double tnew);
44  void print();
45  void check(const char* errmess);
46  void statistics();
47  void spike_stat(double*);
48  void forall_callback(void (*)(const TQItem*, int));
49  double q2least_t();
50 private:
53  TQItem* least_;
54 #if COLLECT_TQueue_STATISTICS
55  unsigned long ninsert, nrem, nleast, nbal, ncmplxrem;
56  unsigned long ncompare, nleastsrch, nfind, nfindsrch, nmove, nfastmove;
57  unsigned long nenq1, nenq2;
58 #endif
59 };
60 //#endif
TQItem()
Definition: bbtqueue.cpp:3
void clear()
Definition: spt2queue.h:16
#define print
Definition: redef.h:109
double t_
Definition: bbtqueue.h:18
SPTREE * sptree2_
Definition: spt2queue.h:52
Definition: bbtqueue.h:6
bool check()
Definition: bbtqueue.cpp:30
static double statistics(void *v)
Definition: cvodeobj.cpp:115
SPTREE * sptree_
Definition: spt2queue.h:51
virtual ~TQItem()
Definition: bbtqueue.cpp:9
unsigned long nenq2
Definition: spt2queue.h:57
static double insert(void *v)
Definition: tqueue.cpp:22
virtual void move(const Event &e)
Definition: ocinput.h:19
TQItem * left_
Definition: bbtqueue.h:19
Definition: sptbinq.h:17
TQItem * parent_
Definition: bbtqueue.h:21
static double least(void *v)
Definition: tqueue.cpp:33
int find(const int, const int, const int, const int, const int)
void * data_
Definition: bbtqueue.h:17
double t
Definition: init.cpp:123
int cnt_
Definition: spt2queue.h:23
TQItem * right_
Definition: bbtqueue.h:20
static double spike_stat(void *v)
Definition: ocbbs.cpp:693