GTIRB  v2.2.0
GrammaTech Intermediate Representation for Binaries: C++ API
Public Member Functions | Friends | List of all members
gtirb::Context Class Reference

The context under which GTIRB operations occur. More...

#include <Context.hpp>

Public Member Functions

 Context ()
 
 ~Context ()
 
template<typename NodeTy , typename... Args>
NodeTy * Create (Args &&... TheArgs)
 Create an object of type T. More...
 
void ForgetAllocations ()
 Forgets all arena allocations held by this Context object. This can be useful under circumstances where leaking the memory is acceptable, such as when shutting a program down. More...
 

Friends

class Node
 Represents the base of the Node class hierarchy. More...
 

Detailed Description

The context under which GTIRB operations occur.

This object is responsible for holding serialization and serialization state, allowing for control over when Node memory can be released and providing a mechanism for ensuring thread safety.

Any API that requires a Context object may potentially allocate memory within that context. Destroying the Context object will release that memory. In a multithreaded environment, sharing a Context object across multiple threads can introduce data races, so protecting the object with a locking primitive is recommended.

Constructor & Destructor Documentation

◆ Context()

gtirb::Context::Context ( )

◆ ~Context()

gtirb::Context::~Context ( )

Member Function Documentation

◆ Create()

template<typename NodeTy , typename... Args>
NodeTy* gtirb::Context::Create ( Args &&...  TheArgs)
inline

Create an object of type T.

Template Parameters
NodeTyThe type of object for which to allocate memory.
ArgsThe types of the constructor arguments.
Parameters
TheArgsThe constructor arguments.
Returns
A newly created object, allocated within the Context.

◆ ForgetAllocations()

void gtirb::Context::ForgetAllocations ( )

Forgets all arena allocations held by this Context object. This can be useful under circumstances where leaking the memory is acceptable, such as when shutting a program down.

Friends And Related Function Documentation

◆ Node

friend class Node
friend

Represents the base of the Node class hierarchy.


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