libvibe++ : a generic C++ library for the ViBe algorithm
AbsoluteValue.h
Go to the documentation of this file.
1 /* Copyright - Benjamin Laugraud <blaugraud@ulg.ac.be> - 2016
2  * Copyright - Marc Van Droogenbroeck <m.vandroogenbroeck@ulg.ac.be> - 2016
3  *
4  * ViBe is covered by a patent (see http://www.telecom.ulg.ac.be/research/vibe).
5  *
6  * Permission to use ViBe without payment of fee is granted for nonprofit
7  * educational and research purposes only.
8  *
9  * This work may not be copied or reproduced in whole or in part for any
10  * purpose.
11  *
12  * Copying, reproduction, or republishing for any purpose shall require a
13  * license. Please contact the authors in such cases. All the code is provided
14  * without any guarantee.
15  */
16 
17 /**
18  @file AbsoluteValue.h
19  @brief
20 
21  @author Benjamin Laungraud and Marc Van Droogenbroeck
22 
23  @date June 2016
24 */
25 
26 
27 #ifndef _LIB_VIBE_XX_MATH_ABSOLUTE_VALUE_H_
28 #define _LIB_VIBE_XX_MATH_ABSOLUTE_VALUE_H_
29 
30 #include "../system/inline.h"
31 
32 namespace ViBe {
33  namespace internals {
34  struct AbsoluteValue {
35  // TODO static assert in the case where T is not a primitive value.
36  template <typename T>
37  STRONG_INLINE static T abs(T value) {
38  return (value >= 0) ? value : -value;
39  }
40  };
41  } /* _NS_internals_ */
42 } /* _NS_ViBe_ */
43 
44 #endif /* _LIB_VIBE_XX_MATH_ABSOLUTE_VALUE_H_ */

License/Copyright

This code is copyrighted by the University of Liège, Belgium. 
It is only shared for research purposes. Please do not distribute it. 
B. Laugraud and M. Van Droogenbroeck, May 2016.