1// Copyright 2018 The Fuchsia Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include <cobalt-client/cpp/types-internal.h>
6#include <lib/fidl/cpp/vector_view.h>
7
8namespace cobalt_client {
9namespace internal {
10
11template <typename T>
12EventBuffer<T>::EventBuffer(const fbl::Vector<Metadata>& metadata) : flushing_(false) {
13    metadata_.reserve(metadata.size() + 1);
14    for (const auto& data : metadata) {
15        metadata_.push_back(data);
16    }
17}
18
19template <typename T> EventBuffer<T>::EventBuffer(EventBuffer&& other) {
20    flushing_.store(other.flushing_.load());
21    buffer_ = fbl::move(other.buffer_);
22    metadata_ = fbl::move(other.metadata_);
23}
24
25template <typename T> EventBuffer<T>::~EventBuffer() = default;
26
27// Supported types for cobalt's metric types.
28// Counter.
29template class EventBuffer<uint32_t>;
30// Histogram.
31template class EventBuffer<fidl::VectorView<HistogramBucket>>;
32
33} // namespace internal
34} // namespace cobalt_client
35