memory.h 798 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
//
// Copyright (c) 2021 INRIA
//

#ifndef HPP_FCL_SERIALIZATION_MEMORY_H
#define HPP_FCL_SERIALIZATION_MEMORY_H

namespace hpp {
namespace fcl {

namespace internal
{
  template<typename T>
  struct memory_footprint_evaluator
  {
    static size_t run(const T &) { return sizeof(T); }
  };
}

  /// \brief Returns the memory footpring of the input object.
  /// For POD objects, this function returns the result of sizeof(T)
  ///
  /// \param[in] object whose memory footprint needs to be evaluated.
  ///
  /// \return the memory footprint of the input object.
  template<typename T>
  size_t computeMemoryFootprint(const T & object)
  {
    return internal::memory_footprint_evaluator<T>::run(object);
  }

} // namespace fcl
} // namespace hpp

#endif // ifndef HPP_FCL_SERIALIZATION_MEMORY_H