GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: include/hpp/fcl/serialization/memory.h Lines: 3 3 100.0 %
Date: 2024-02-09 12:57:42 Branches: 0 0 - %

Line Branch Exec Source
1
//
2
// Copyright (c) 2021 INRIA
3
//
4
5
#ifndef HPP_FCL_SERIALIZATION_MEMORY_H
6
#define HPP_FCL_SERIALIZATION_MEMORY_H
7
8
namespace hpp {
9
namespace fcl {
10
11
namespace internal {
12
template <typename T>
13
struct memory_footprint_evaluator {
14
1
  static size_t run(const T &) { return sizeof(T); }
15
};
16
}  // namespace internal
17
18
/// \brief Returns the memory footpring of the input object.
19
/// For POD objects, this function returns the result of sizeof(T)
20
///
21
/// \param[in] object whose memory footprint needs to be evaluated.
22
///
23
/// \return the memory footprint of the input object.
24
template <typename T>
25
4
size_t computeMemoryFootprint(const T &object) {
26
4
  return internal::memory_footprint_evaluator<T>::run(object);
27
}
28
29
}  // namespace fcl
30
}  // namespace hpp
31
32
#endif  // ifndef HPP_FCL_SERIALIZATION_MEMORY_H