2020-06-06 01:49:27 +02:00
---
layout: default
title: Packets
parent: Framework Concepts
nav_order: 3
---
2019-06-17 01:03:25 +02:00
2020-06-06 01:49:27 +02:00
# Packets
{: .no_toc }
1. TOC
{:toc}
---
2019-06-17 01:03:25 +02:00
Each calculator is a node of of a graph. We describe how to create a new calculator, how to initialize a calculator, how to perform its calculations, input and output streams, timestamps, and options
2020-06-06 01:49:27 +02:00
## Creating a packet
2019-06-17 01:03:25 +02:00
Packets are generally created with `MediaPipe::Adopt()` (from packet.h).
```c++
// Create some data.
auto data = gtl::MakeUnique< MyDataClass > ("constructor_argument");
// Create a packet to own the data.
Packet p = Adopt(data.release());
// Make a new packet with the same data and a different timestamp.
Packet p2 = p.At(Timestamp::PostStream());
```
Data within a packet is accessed with `Packet::Get<T>()`