utilize SnapshotAlloc STL allocator
[model-checker.git] / clockvector.h
1 /** @file clockvector.h
2  *  @brief Implements a clock vector.
3  */
4
5 #ifndef __CLOCKVECTOR_H__
6 #define __CLOCKVECTOR_H__
7
8 #include "mymemory.h"
9 #include "modeltypes.h"
10
11 /* Forward declaration */
12 class ModelAction;
13
14 class ClockVector {
15 public:
16         ClockVector(ClockVector *parent = NULL, ModelAction *act = NULL);
17         ~ClockVector();
18         void merge(const ClockVector *cv);
19         bool synchronized_since(const ModelAction *act) const;
20         bool has_synchronized_with(const ClockVector *cv) const;
21
22         void print() const;
23         modelclock_t getClock(thread_id_t thread);
24
25         SNAPSHOTALLOC
26 private:
27         /** @brief Holds the actual clock data, as an array. */
28         modelclock_t *clock;
29
30         /** @brief The number of threads recorded in clock (i.e., its length).  */
31         int num_threads;
32 };
33
34 #endif /* __CLOCKVECTOR_H__ */