STL Memory Versioning
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Revision Class Reference

Revision class for for keeping track of segment branches. More...

#include <revision.h>

Public Member Functions

 Revision ()
 Construct for the very first Revision. More...
 
 Revision (std::shared_ptr< Segment > root, std::shared_ptr< Segment > current)
 Construct a new Revision for new thread. More...
 

Public Attributes

std::shared_ptr< Segmentroot
 Segment from which this Revision was created. More...
 
std::shared_ptr< Segmentcurrent
 Current Segment of that Revision. More...
 
std::thread thread
 Thread stuct to join that Revision after it is completed. More...
 

Static Public Attributes

static thread_local std::shared_ptr< RevisioncurrentRevision = std::make_shared<Revision>()
 The current Revision for current thread. More...
 

Detailed Description

Revision class for for keeping track of segment branches.

Definition at line 21 of file revision.h.

Constructor & Destructor Documentation

◆ Revision() [1/2]

Revision::Revision ( )

Construct for the very first Revision.

Definition at line 8 of file revision.cpp.

8  {
9  std::shared_ptr<Segment> s = std::make_shared<Segment>();
10  root = s;
11  current = s;
12 }
std::shared_ptr< Segment > current
Current Segment of that Revision.
Definition: revision.h:51
std::shared_ptr< Segment > root
Segment from which this Revision was created.
Definition: revision.h:44

◆ Revision() [2/2]

Revision::Revision ( std::shared_ptr< Segment root,
std::shared_ptr< Segment current 
)

Construct a new Revision for new thread.

Parameters
rootSegment from which new Revision was forked
currentSegemtn that will be the first for new Revision
See also
Segment

Definition at line 14 of file revision.cpp.

14  {
15  root = my_root;
16  current = my_current;
17 }

Member Data Documentation

◆ current

std::shared_ptr<Segment> Revision::current

Current Segment of that Revision.

See also
Segment

Definition at line 51 of file revision.h.

◆ currentRevision

thread_local std::shared_ptr< Revision > Revision::currentRevision = std::make_shared<Revision>()
static

The current Revision for current thread.

It is static and thread_local so that for each thread only one Revision can exist

Definition at line 65 of file revision.h.

◆ root

std::shared_ptr<Segment> Revision::root

Segment from which this Revision was created.

See also
Segment

Definition at line 44 of file revision.h.

◆ thread

std::thread Revision::thread

Thread stuct to join that Revision after it is completed.

Definition at line 57 of file revision.h.


The documentation for this class was generated from the following files: