GTIRB
v2.2.0
GrammaTech Intermediate Representation for Binaries: C++ API
|
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... | |
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.
gtirb::Context::Context | ( | ) |
gtirb::Context::~Context | ( | ) |
|
inline |
Create an object of type T.
NodeTy | The type of object for which to allocate memory. |
Args | The types of the constructor arguments. |
TheArgs | The constructor arguments. |
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.