run_set_visitor.hpp
Go to the documentation of this file.
1 
14 #ifndef MLPACK_METHODS_ANN_VISITOR_RUN_SET_VISITOR_HPP
15 #define MLPACK_METHODS_ANN_VISITOR_RUN_SET_VISITOR_HPP
16 
18 
19 #include <boost/variant.hpp>
20 
21 namespace mlpack {
22 namespace ann {
23 
28 class RunSetVisitor : public boost::static_visitor<void>
29 {
30  public:
32  RunSetVisitor(const bool run = true);
33 
35  template<typename LayerType>
36  void operator()(LayerType* layer) const;
37 
38  private:
40  const bool run;
41 
44  template<typename T>
45  typename std::enable_if<
46  HasRunCheck<T, bool&(T::*)(void)>::value &&
47  HasModelCheck<T>::value, void>::type
48  LayerRun(T* layer) const;
49 
52  template<typename T>
53  typename std::enable_if<
54  !HasRunCheck<T, bool&(T::*)(void)>::value &&
55  HasModelCheck<T>::value, void>::type
56  LayerRun(T* layer) const;
57 
60  template<typename T>
61  typename std::enable_if<
62  HasRunCheck<T, bool&(T::*)(void)>::value &&
63  !HasModelCheck<T>::value, void>::type
64  LayerRun(T* layer) const;
65 
68  template<typename T>
69  typename std::enable_if<
70  !HasRunCheck<T, bool&(T::*)(void)>::value &&
71  !HasModelCheck<T>::value, void>::type
72  LayerRun(T* layer) const;
73 };
74 
75 } // namespace ann
76 } // namespace mlpack
77 
78 // Include implementation.
79 #include "run_set_visitor_impl.hpp"
80 
81 #endif
RunSetVisitor set the run parameter given the run value.
.hpp
Definition: add_to_po.hpp:21
void operator()(LayerType *layer) const
Set the run parameter.
RunSetVisitor(const bool run=true)
Set the run parameter given the current run value.