Autowiring  1.0.3
A C++ Inversion of Control Framework
auto_prev.h
Go to the documentation of this file.
1 // Copyright (C) 2012-2015 Leap Motion, Inc. All rights reserved.
2 #pragma once
3 #include "auto_arg.h"
4 
5 namespace autowiring {
6 
7 template<class T>
8 class auto_arg;
9 
17 template<class T, int N = 1>
18 struct auto_prev {
19 public:
20  auto_prev(const T* value) :
21  value(value)
22  {}
23 
24  operator bool(void) const {
25  return !!value;
26  }
27 
28  const T& operator*(void) const {
29  return *value;
30  }
31 
32  const T* operator->(void) const {
33  return value;
34  }
35 
36  const T* const value;
37 };
38 
39 template<class T, int N>
40 class auto_arg<auto_prev<T, N>>
41 {
42 public:
43  typedef auto_prev<T, N> type;
44  typedef auto_prev<T, N> arg_type;
45  typedef auto_id_t<T> id_type;
46 
47  static const bool is_input = true;
48  static const bool is_output = false;
49  static const bool is_rvalue = false;
50  static const bool is_shared = true;
51  static const bool is_multi = false;
52  static const int tshift = N;
53 
54  template<class C>
55  static const T* arg(C& packet) {
56  const T* retVal;
57  packet.template Get<T>(retVal, N);
58  return retVal;
59  }
60 };
61 
62 }
Reinterpret copied argument as input
Definition: auto_arg.h:30
Definition: auto_arg.h:8
Identifier for AutoFilter inputs from the previous packet
Definition: auto_prev.h:18