Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
mortenvp committed Feb 3, 2025
1 parent 7b718bc commit ec5ad5e
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 30 deletions.
29 changes: 0 additions & 29 deletions src/abacus/detail/size_of_type.hpp

This file was deleted.

1 change: 0 additions & 1 deletion src/abacus/metrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "metrics.hpp"

#include "detail/hash_function.hpp"
#include "detail/size_of_type.hpp"

#include "info.hpp"
#include "protocol_version.hpp"
Expand Down
29 changes: 29 additions & 0 deletions src/abacus/parse_metadata.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright (c) Steinwurf ApS 2020.
// All Rights Reserved
//
// Distributed under the "BSD License". See the accompanying LICENSE.rst file.

#include "parse_metadata.hpp"

#include <cassert>
#include <optional>

namespace abacus
{
inline namespace STEINWURF_ABACUS_VERSION
{
auto parse_metadata(const uint8_t* metadata_data, std::size_t metadata_bytes)
-> std::optional<protobuf::MetricsMetadata>
{
assert(metadata_data != nullptr);
assert(metadata_bytes > 0);
protobuf::MetricsMetadata metadata;
auto result = metadata.ParseFromArray(metadata_data, metadata_bytes);
if (!result)
{
return std::nullopt;
}
return metadata;
}
}
}
24 changes: 24 additions & 0 deletions src/abacus/parse_metadata.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright (c) Steinwurf ApS 2020.
// All Rights Reserved
//
// Distributed under the "BSD License". See the accompanying LICENSE.rst file.

#pragma once

#include <cstdint>

#include "protobuf/metrics.pb.h"
#include "version.hpp"

namespace abacus
{
inline namespace STEINWURF_ABACUS_VERSION
{

/// @param metadata_data The meta data pointer
/// @param metadata_bytes The meta data size in bytes
auto parse_metadata(const uint8_t* metadata_data, std::size_t metadata_bytes)
-> std::optional<protobuf::MetricsMetadata>;

}
}

0 comments on commit ec5ad5e

Please sign in to comment.