get_allocated_memory.hpp
Go to the documentation of this file.
1 
13 #ifndef MLPACK_BINDINGS_IO_GET_ALLOCATED_MEMORY_HPP
14 #define MLPACK_BINDINGS_IO_GET_ALLOCATED_MEMORY_HPP
15 
17 
18 namespace mlpack {
19 namespace bindings {
20 namespace tests {
21 
22 template<typename T>
24  util::ParamData& /* d */,
25  const typename std::enable_if<!data::HasSerialize<T>::value>::type* = 0,
26  const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0)
27 {
28  return NULL;
29 }
30 
31 template<typename T>
33  util::ParamData& /* d */,
34  const typename std::enable_if<arma::is_arma_type<T>::value>::type* = 0)
35 {
36  return NULL;
37 }
38 
39 template<typename T>
41  util::ParamData& d,
42  const typename std::enable_if<!arma::is_arma_type<T>::value>::type* = 0,
43  const typename std::enable_if<data::HasSerialize<T>::value>::type* = 0)
44 {
45  // Here we have a model; return its memory location.
46  return *boost::any_cast<T*>(&d.value);
47 }
48 
49 template<typename T>
51  const void* /* input */,
52  void* output)
53 {
54  *((void**) output) =
55  GetAllocatedMemory<typename std::remove_pointer<T>::type>(d);
56 }
57 
58 } // namespace tests
59 } // namespace bindings
60 } // namespace mlpack
61 
62 #endif
boost::any value
The actual value that is held.
Definition: param_data.hpp:79
Linear algebra utility functions, generally performed on matrices or vectors.
This structure holds all of the information about a single parameter, including its value (which is s...
Definition: param_data.hpp:52
void * GetAllocatedMemory(util::ParamData &, const typename std::enable_if<!data::HasSerialize< T >::value >::type *=0, const typename std::enable_if<!arma::is_arma_type< T >::value >::type *=0)