STL Memory Versioning
revision.h
Go to the documentation of this file.
1 
7 #ifndef __REVISION_H__
8 #define __REVISION_H__
9 
10 #include <thread>
11 #include <memory>
12 #include <iostream>
13 #include <functional>
14 
15 class Segment;
16 
21 class Revision
22 {
23 public:
28  Revision();
29 
37  Revision(std::shared_ptr<Segment> root, std::shared_ptr<Segment> current);
38 
44  std::shared_ptr<Segment> root;
45 
51  std::shared_ptr<Segment> current;
52 
57  std::thread thread;
58 
65  thread_local static std::shared_ptr<Revision> currentRevision;
66 };
67 
72 void PrintRevision(std::shared_ptr<Revision> revision);
73 
74 #endif
Revision class for for keeping track of segment branches.
Definition: revision.h:22
static thread_local std::shared_ptr< Revision > currentRevision
The current Revision for current thread.
Definition: revision.h:65
Revision()
Construct for the very first Revision.
Definition: revision.cpp:8
std::shared_ptr< Segment > current
Current Segment of that Revision.
Definition: revision.h:51
std::thread thread
Thread stuct to join that Revision after it is completed.
Definition: revision.h:57
std::shared_ptr< Segment > root
Segment from which this Revision was created.
Definition: revision.h:44
Class to keep track what Versioned variables were changed.
Definition: segment.h:21
void PrintRevision(std::shared_ptr< Revision > revision)
Print revision segments for debugging.
Definition: revision.cpp:19