File indexing completed on 2024-09-07 04:36:22
0001 #ifndef Subsystem_Package_dummy_helpers_h
0002 #define Subsystem_Package_dummy_helpers_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #include <memory>
0023 #include <vector>
0024 #include <mutex>
0025
0026
0027
0028
0029 namespace edm {
0030 namespace stream {
0031 namespace impl {
0032 struct dummy_ptr {
0033 void* get() { return nullptr; }
0034 void reset(void*) {}
0035 void* release() { return nullptr; }
0036 };
0037
0038 struct dummy_vec {
0039 void resize(size_t) {}
0040 dummy_ptr operator[](unsigned int) { return dummy_ptr(); }
0041 };
0042
0043 struct dummy_mutex {
0044 void lock() {}
0045 void unlock() {}
0046 };
0047
0048 template <typename T>
0049 struct choose_unique_ptr {
0050 typedef std::unique_ptr<T> type;
0051 };
0052 template <>
0053 struct choose_unique_ptr<void> {
0054 typedef dummy_ptr type;
0055 };
0056
0057 template <>
0058 struct choose_unique_ptr<void const> {
0059 typedef dummy_ptr type;
0060 };
0061
0062 template <typename T>
0063 struct choose_shared_vec {
0064 typedef std::vector<std::shared_ptr<T>> type;
0065 };
0066 template <>
0067 struct choose_shared_vec<void> {
0068 typedef dummy_vec type;
0069 };
0070 template <>
0071 struct choose_shared_vec<void const> {
0072 typedef dummy_vec type;
0073 };
0074 template <typename T>
0075 struct choose_mutex {
0076 using type = std::mutex;
0077 };
0078 template <>
0079 struct choose_mutex<void> {
0080 using type = dummy_mutex;
0081 };
0082 }
0083 }
0084 }
0085
0086 #endif