aggregator
DetermineSampleTimestamp.hpp
Go to the documentation of this file.
1 #ifndef _AGGREGATOR_DETERMINE_SAMPLE_TIMESTAMP_HPP_
2 #define _AGGREGATOR_DETERMINE_SAMPLE_TIMESTAMP_HPP_
3 
4 #include <base/Time.hpp>
5 #include <boost/shared_ptr.hpp>
6 #include <stdexcept>
7 
8 namespace aggregator
9 {
10 
23 template<typename T>
24 inline base::Time determineTimestamp(const T& type)
25 {
26  return type.time;
27 }
28 
29 template<typename T>
30 inline base::Time determineTimestamp(const T* type)
31 {
32  if (type == NULL) throw std::invalid_argument("determineTimestamp: Received null pointer in function!");
33  return determineTimestamp(*type);
34 }
35 
36 template<typename T>
37 inline base::Time determineTimestamp(const boost::shared_ptr<T>& type)
38 {
39  if (type.get() == NULL) throw std::invalid_argument("determineTimestamp: Received null pointer in function!");
40  return determineTimestamp(*type);
41 }
42 
43 }
44 
45 #endif
Definition: DetermineSampleTimestamp.hpp:8
base::Time determineTimestamp(const T &type)
Definition: DetermineSampleTimestamp.hpp:24