diff --git a/types/array_type.toml b/types/array_type.toml index 92e72ca..6d73322 100644 --- a/types/array_type.toml +++ b/types/array_type.toml @@ -29,27 +29,6 @@ void getSizeType(const %1% &container, size_t& returnArg) } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::List::type>; - - static types::st::Unit getSizeType( - const %1% &container, - typename TypeHandler>::type returnArg) { - auto tail = returnArg.write(container.size()); - - for (auto & it: container) { - tail = tail.delegate([&it](auto ret) { - return TypeHandler::getSizeType(it, ret); - }); - } - - return tail.finish(); - } -}; -""" - traversal_func = """ auto tail = returnArg.write(container.size()); diff --git a/types/cxx11_string_type.toml b/types/cxx11_string_type.toml index 1ecc931..94e7183 100644 --- a/types/cxx11_string_type.toml +++ b/types/cxx11_string_type.toml @@ -36,24 +36,6 @@ void getSizeType(const %1% &container, size_t& returnArg) } """ -handler = """ -template -struct TypeHandler> { - using type = - types::st::Pair, types::st::VarInt>; - - static types::st::Unit getSizeType( - const %1% & container, - typename TypeHandler>::type returnArg) { - bool sso = ((uintptr_t)container.data() < - (uintptr_t)(&container + sizeof(%1% ))) && - ((uintptr_t)container.data() >= (uintptr_t)&container); - - return returnArg.write(container.capacity()).write(container.size()); - } -}; -""" - extra = """ template class CaptureKeyHandler> { diff --git a/types/deque_list_type.toml b/types/deque_list_type.toml index eb0015d..a59742a 100644 --- a/types/deque_list_type.toml +++ b/types/deque_list_type.toml @@ -33,28 +33,3 @@ void getSizeType(const %1% &container, size_t& returnArg) } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair, - types::st::List::type>>; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - auto tail = returnArg.write((uintptr_t)&container) - .write(container.size()); - - // The double ampersand is needed otherwise this loop doesn't work with - // vector - for (auto&& it : container) { - tail = tail.delegate([&it](auto ret) { - return TypeHandler::getSizeType(it, ret); - }); - } - - return tail.finish(); - } -}; -""" diff --git a/types/f14_fast_map.toml b/types/f14_fast_map.toml index 87d8d87..c8c84f2 100644 --- a/types/f14_fast_map.toml +++ b/types/f14_fast_map.toml @@ -36,40 +36,6 @@ void getSizeType(const %1% &container, siz } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair, - types::st::Pair, - types::st::List::type, - typename TypeHandler::type>>>>; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - size_t memorySize = container.getAllocatedMemorySize(); - auto tail = returnArg - .write(memorySize) - .write(container.bucket_count()) - .write(container.size()); - - for (auto &&entry: container) { - tail = tail.delegate([&key = entry.first, &value = entry.second](auto ret) { - auto next = ret.delegate([&key](typename TypeHandler::type ret) { - return OIInternal::getSizeType(key, ret); - }); - return OIInternal::getSizeType(value, next); - }); - } - - return tail.finish(); - } -}; -""" - traversal_func = """ auto tail = returnArg .write((uintptr_t)container.getAllocatedMemorySize()) diff --git a/types/f14_fast_set.toml b/types/f14_fast_set.toml index 63262c5..8516f8c 100644 --- a/types/f14_fast_set.toml +++ b/types/f14_fast_set.toml @@ -35,36 +35,6 @@ void getSizeType(const %1% &container, size_t& ret } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair, - types::st::Pair, - types::st::List::type>>>; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - size_t memorySize = container.getAllocatedMemorySize(); - auto tail = returnArg - .write(memorySize) - .write(container.bucket_count()) - .write(container.size()); - - for (auto &&entry: container) { - tail = tail.delegate([&entry](auto ret) { - return OIInternal::getSizeType(entry, ret); - }); - } - - return tail.finish(); - } -}; -""" - traversal_func = """ auto tail = returnArg .write((uintptr_t)container.getAllocatedMemorySize()) diff --git a/types/f14_node_map.toml b/types/f14_node_map.toml index 4d483e6..93b53e9 100644 --- a/types/f14_node_map.toml +++ b/types/f14_node_map.toml @@ -36,40 +36,6 @@ void getSizeType(const %1% &container, siz } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair, - types::st::Pair, - types::st::List::type, - typename TypeHandler::type>>>>; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - size_t memorySize = container.getAllocatedMemorySize(); - auto tail = returnArg - .write(memorySize) - .write(container.bucket_count()) - .write(container.size()); - - for (auto &&entry: container) { - tail = tail.delegate([&key = entry.first, &value = entry.second](auto ret) { - auto next = ret.delegate([&key](typename TypeHandler::type ret) { - return OIInternal::getSizeType(key, ret); - }); - return OIInternal::getSizeType(value, next); - }); - } - - return tail.finish(); - } -}; -""" - traversal_func = """ auto tail = returnArg .write((uintptr_t)container.getAllocatedMemorySize()) diff --git a/types/f14_node_set.toml b/types/f14_node_set.toml index 8413cf0..511c2f8 100644 --- a/types/f14_node_set.toml +++ b/types/f14_node_set.toml @@ -35,36 +35,6 @@ void getSizeType(const %1% &container, size_t& ret } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair, - types::st::Pair, - types::st::List::type>>>; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - size_t memorySize = container.getAllocatedMemorySize(); - auto tail = returnArg - .write(memorySize) - .write(container.bucket_count()) - .write(container.size()); - - for (auto &&entry: container) { - tail = tail.delegate([&entry](auto ret) { - return OIInternal::getSizeType(entry, ret); - }); - } - - return tail.finish(); - } -}; -""" - traversal_func = """ auto tail = returnArg .write((uintptr_t)container.getAllocatedMemorySize()) diff --git a/types/f14_value_map.toml b/types/f14_value_map.toml index ed569de..ec4f187 100644 --- a/types/f14_value_map.toml +++ b/types/f14_value_map.toml @@ -36,40 +36,6 @@ void getSizeType(const %1% &container, siz } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair, - types::st::Pair, - types::st::List::type, - typename TypeHandler::type>>>>; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - size_t memorySize = container.getAllocatedMemorySize(); - auto tail = returnArg - .write(memorySize) - .write(container.bucket_count()) - .write(container.size()); - - for (auto &&entry: container) { - tail = tail.delegate([&key = entry.first, &value = entry.second](auto ret) { - auto next = ret.delegate([&key](typename TypeHandler::type ret) { - return OIInternal::getSizeType(key, ret); - }); - return OIInternal::getSizeType(value, next); - }); - } - - return tail.finish(); - } -}; -""" - traversal_func = """ auto tail = returnArg .write((uintptr_t)container.getAllocatedMemorySize()) diff --git a/types/f14_value_set.toml b/types/f14_value_set.toml index 07887e7..20aae30 100644 --- a/types/f14_value_set.toml +++ b/types/f14_value_set.toml @@ -35,36 +35,6 @@ void getSizeType(const %1% &container, size_t& ret } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair, - types::st::Pair, - types::st::List::type>>>; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - size_t memorySize = container.getAllocatedMemorySize(); - auto tail = returnArg - .write(memorySize) - .write(container.bucket_count()) - .write(container.size()); - - for (auto &&entry: container) { - tail = tail.delegate([&entry](auto ret) { - return OIInternal::getSizeType(entry, ret); - }); - } - - return tail.finish(); - } -}; -""" - traversal_func = """ auto tail = returnArg .write((uintptr_t)container.getAllocatedMemorySize()) diff --git a/types/f14_vector_map.toml b/types/f14_vector_map.toml index 9287d1b..5e29d82 100644 --- a/types/f14_vector_map.toml +++ b/types/f14_vector_map.toml @@ -36,40 +36,6 @@ void getSizeType(const %1% &container, siz } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair, - types::st::Pair, - types::st::List::type, - typename TypeHandler::type>>>>; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - size_t memorySize = container.getAllocatedMemorySize(); - auto tail = returnArg - .write(memorySize) - .write(container.bucket_count()) - .write(container.size()); - - for (auto &&entry: container) { - tail = tail.delegate([&key = entry.first, &value = entry.second](auto ret) { - auto next = ret.delegate([&key](typename TypeHandler::type ret) { - return OIInternal::getSizeType(key, ret); - }); - return OIInternal::getSizeType(value, next); - }); - } - - return tail.finish(); - } -}; -""" - traversal_func = """ auto tail = returnArg .write((uintptr_t)container.getAllocatedMemorySize()) diff --git a/types/f14_vector_set.toml b/types/f14_vector_set.toml index e94b8b9..1aed210 100644 --- a/types/f14_vector_set.toml +++ b/types/f14_vector_set.toml @@ -35,36 +35,6 @@ void getSizeType(const %1% &container, size_t& ret } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair, - types::st::Pair, - types::st::List::type>>>; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - size_t memorySize = container.getAllocatedMemorySize(); - auto tail = returnArg - .write(memorySize) - .write(container.bucket_count()) - .write(container.size()); - - for (auto &&entry: container) { - tail = tail.delegate([&entry](auto ret) { - return OIInternal::getSizeType(entry, ret); - }); - } - - return tail.finish(); - } -}; -""" - traversal_func = """ auto tail = returnArg .write((uintptr_t)container.getAllocatedMemorySize()) diff --git a/types/fb_string_type.toml b/types/fb_string_type.toml index 19b9f34..e0679d3 100644 --- a/types/fb_string_type.toml +++ b/types/fb_string_type.toml @@ -38,38 +38,6 @@ void getSizeType(const %1% &container, size_t& returnArg) } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair, - types::st::Pair, - types::st::Pair, - types::st::VarInt - >>>; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - auto last = returnArg.write((uintptr_t)container.data()) - .write(container.capacity()) - .write(container.size()); - - bool inlined = ((uintptr_t)container.data() < (uintptr_t)(&container + sizeof(%1%))) - && - ((uintptr_t)container.data() >= (uintptr_t)&container); - - if (!inlined && pointers.add((uintptr_t)container.data())) { - return last.write(1); - } else { - return last.write(0); - } - } -}; -""" - traversal_func = """ // fbstring has inlining (SSO) and allocates large strings as // reference counted strings. Reference counted strings have an diff --git a/types/map_seq_type.toml b/types/map_seq_type.toml index 16b9615..90d424d 100644 --- a/types/map_seq_type.toml +++ b/types/map_seq_type.toml @@ -35,37 +35,6 @@ void getSizeType(const %1% -struct TypeHandler> { - using type = types::st::Pair, - types::st::Pair, - types::st::List::type, - typename TypeHandler::type - >>>>; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - auto tail = returnArg.write((uintptr_t)&container) - .write(container.capacity()) - .write(container.size()); - - for (const auto& it : container) { - tail = tail.delegate([&it](auto ret) { - return OIInternal::getSizeType(it.second, ret.delegate([&it](auto ret) { - return OIInternal::getSizeType(it.first, ret); - })); - }); - } - - return tail.finish(); - } -}; -""" traversal_func = ''' auto tail = returnArg.write((uintptr_t)&container) diff --git a/types/multi_map_type.toml b/types/multi_map_type.toml index f29eb8d..7b1e622 100644 --- a/types/multi_map_type.toml +++ b/types/multi_map_type.toml @@ -33,34 +33,6 @@ void getSizeType(const %1% &container, size_t& returnAr } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::List::type, - typename TypeHandler::type - >>; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - auto tail = returnArg.write(container.size()); - - // The double ampersand is needed otherwise this loop doesn't work with - // vector - for (auto&& it : container) { - tail = tail.delegate([&it](auto ret) { - return OIInternal::getSizeType(it.second, ret.delegate([&it](auto ret) { - return OIInternal::getSizeType(it.first, ret); - })); - }); - } - - return tail.finish(); - } -}; -""" - traversal_func = """ auto tail = returnArg .write((uintptr_t)&container) diff --git a/types/multi_set_type.toml b/types/multi_set_type.toml index aab9fd7..34163e8 100644 --- a/types/multi_set_type.toml +++ b/types/multi_set_type.toml @@ -35,31 +35,6 @@ void getSizeType(const %1% &container, size_t& returnArg) } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::List::type>; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - constexpr size_t nodeSize = sizeof(typename %1%::node_type); - - auto tail = returnArg.write(container.size()); - - // The double ampersand is needed otherwise this loop doesn't work with - // vector - for (auto&& it : container) { - tail = tail.delegate([&it](auto ret) { - return OIInternal::getSizeType(it, ret); - }); - } - - return tail.finish(); - } -}; -""" - traversal_func = """ auto tail = returnArg.write((uintptr_t)&container) .write(container.size()); diff --git a/types/optional_type.toml b/types/optional_type.toml index d153537..2178743 100644 --- a/types/optional_type.toml +++ b/types/optional_type.toml @@ -28,28 +28,6 @@ void getSizeType(const %1%& container, size_t& returnArg) { } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Sum, - typename TypeHandler::type - >; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - if (container) { - return returnArg.template delegate<1>([&container](auto ret) { - return OIInternal::getSizeType(*container, ret); - }); - } else { - return returnArg.template delegate<0>(std::identity()); - } - } -}; -""" - traversal_func = """ if (container.has_value()) { return returnArg.template delegate<1>([&container](auto ret) { diff --git a/types/pair_type.toml b/types/pair_type.toml index e904db8..570d289 100644 --- a/types/pair_type.toml +++ b/types/pair_type.toml @@ -26,26 +26,6 @@ void getSizeType(const %1% &container, size_t& returnArg) } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair::type, - typename TypeHandler::type>; - - static types::st::Unit getSizeType( - const %1% & container, - typename TypeHandler>::type returnArg) { - return OIInternal::getSizeType( - container.second, - returnArg.delegate([&container](auto ret) { - return OIInternal::getSizeType(container.first, ret); - }) - ); - } -}; -""" - traversal_func = """ return OIInternal::getSizeType( container.second, diff --git a/types/priority_queue_container_adapter_type.toml b/types/priority_queue_container_adapter_type.toml index cc0b33c..7bdebb6 100644 --- a/types/priority_queue_container_adapter_type.toml +++ b/types/priority_queue_container_adapter_type.toml @@ -32,21 +32,3 @@ void getSizeType(const %1% &containerAdapter, size_t& returnA getSizeType(container, returnArg); } """ - -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair, - typename TypeHandler::type>; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - auto tail = returnArg.write((uintptr_t)&container); - - const T1 &underlyingContainer = get_container(container); - return OIInternal::getSizeType(underlyingContainer, tail); - } -}; -""" diff --git a/types/queue_container_adapter_type.toml b/types/queue_container_adapter_type.toml index 10891f8..7870901 100644 --- a/types/queue_container_adapter_type.toml +++ b/types/queue_container_adapter_type.toml @@ -32,20 +32,3 @@ void getSizeType(const %1% &containerAdapter, size_t& returnArg) } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair, - typename TypeHandler::type>; - - static types::st::Unit getSizeType( - const %1% & container, - typename TypeHandler>::type returnArg) { - auto tail = returnArg.write((uintptr_t)&container); - - const T1 &underlyingContainer = get_container(container); - return OIInternal::getSizeType(underlyingContainer, tail); - } -}; -""" diff --git a/types/ref_wrapper_type.toml b/types/ref_wrapper_type.toml index 9c87b2a..949b385 100644 --- a/types/ref_wrapper_type.toml +++ b/types/ref_wrapper_type.toml @@ -29,29 +29,3 @@ void getSizeType(const %1% &ref, size_t& returnArg) } } """ - -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair, - types::st::Sum, - typename TypeHandler::type - >>; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - auto r0 = returnArg.write((uintptr_t)&(container.get())); - - if (pointers.add((uintptr_t)&container.get())) { - return r0.template delegate<1>([&container](auto ret) { - return OIInternal::getSizeType(container.get(), ret); - }); - } else { - return r0.template delegate<0>(std::identity()); - } - } -}; -""" diff --git a/types/seq_type.toml b/types/seq_type.toml index 1da8fd6..0ccfee8 100644 --- a/types/seq_type.toml +++ b/types/seq_type.toml @@ -35,35 +35,6 @@ void getSizeType(const %1% &container, size_t& returnArg) } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair< - DB, types::st::VarInt, - types::st::Pair< - DB, types::st::VarInt, - types::st::List::type>>>; - - static types::st::Unit getSizeType( - const %1% & container, - typename TypeHandler>::type returnArg) { - auto tail = returnArg.write((uintptr_t)&container) - .write(container.capacity()) - .write(container.size()); - - // The double ampersand is needed otherwise this loop doesn't work with - // vector - for (auto&& it : container) { - tail = tail.delegate([&it](auto ret) { - return OIInternal::getSizeType(it, ret); - }); - } - - return tail.finish(); - } -}; -""" - traversal_func = """ auto tail = returnArg.write((uintptr_t)&container) .write(container.capacity()) diff --git a/types/set_type.toml b/types/set_type.toml index bd22ad6..43206f6 100644 --- a/types/set_type.toml +++ b/types/set_type.toml @@ -36,34 +36,6 @@ void getSizeType(const %1% &container, size_t& returnArg) } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair, - types::st::List::type>>; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - constexpr size_t nodeSize = sizeof(typename %1%::node_type); - - auto tail = returnArg.write(nodeSize) - .write(container.size()); - - // The double ampersand is needed otherwise this loop doesn't work with - // vector - for (auto&& it : container) { - tail = tail.delegate([&it](auto ret) { - return OIInternal::getSizeType(it, ret); - }); - } - - return tail.finish(); - } -}; -""" - traversal_func = """ auto tail = returnArg.write((uintptr_t)&container) .write(container.size()); diff --git a/types/shrd_ptr_type.toml b/types/shrd_ptr_type.toml index 3154fe4..693f871 100644 --- a/types/shrd_ptr_type.toml +++ b/types/shrd_ptr_type.toml @@ -34,38 +34,6 @@ void getSizeType(const %1% &s_ptr, size_t& returnArg) } """ -handler = """ -template -struct TypeHandler> { - using type = typename std::conditional< - std::is_void::value, - types::st::Unit, - types::st::Pair, - types::st::Sum, - typename TypeHandler::type - >>>::type; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - if constexpr (!std::is_void::value) { - auto r0 = returnArg.write((uintptr_t)(container.get())); - if (container && pointers.add((uintptr_t)(container.get()))) { - return r0.template delegate<1>([&container](auto ret) { - return OIInternal::getSizeType(*(container.get()), ret); - }); - } else { - return r0.template delegate<0>(std::identity()); - } - } else { - return returnArg; - } - } -}; -""" - traversal_func = """ auto tail = returnArg.write((uintptr_t)container.get()); diff --git a/types/small_vec_type.toml b/types/small_vec_type.toml index 0bdd1dd..aca3e79 100644 --- a/types/small_vec_type.toml +++ b/types/small_vec_type.toml @@ -42,33 +42,6 @@ void getSizeType(const %1% &container, size_t& returnArg) } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair< - DB, types::st::VarInt, - types::st::Pair< - DB, types::st::VarInt, - types::st::List::type>>>; - - static types::st::Unit getSizeType( - const %1% & container, - typename TypeHandler>::type returnArg) { - auto tail = returnArg.write(N0) - .write(container.capacity()) - .write(container.size()); - - for (auto& it : container) { - tail = tail.delegate([&it](auto ret) { - return OIInternal::getSizeType(it, ret); - }); - } - - return tail.finish(); - } -}; -""" - traversal_func = """ // If `container.data()` pointer is within the container struct, // then the container's storage is inlined and doesn't uses the heap. diff --git a/types/sorted_vec_set_type.toml b/types/sorted_vec_set_type.toml index bc44219..f17a0f7 100644 --- a/types/sorted_vec_set_type.toml +++ b/types/sorted_vec_set_type.toml @@ -31,23 +31,6 @@ void getSizeType(const %1% &conta } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair, - typename TypeHandler::type>; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - auto tail = returnArg.write((uintptr_t)&container); - const T4 &underlyingContainer = container.get_container(); - return OIInternal::getSizeType(underlyingContainer, tail); - } -}; -""" - traversal_func = ''' auto tail = returnArg.write((uintptr_t)&container) .write(container.capacity()) diff --git a/types/stack_container_adapter_type.toml b/types/stack_container_adapter_type.toml index 67187bb..db91880 100644 --- a/types/stack_container_adapter_type.toml +++ b/types/stack_container_adapter_type.toml @@ -31,21 +31,3 @@ void getSizeType(const %1% &containerAdapter, size_t& returnArg) getSizeType(container, returnArg); } """ - -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair, - typename TypeHandler::type>; - - static types::st::Unit getSizeType( - const %1% & container, - typename TypeHandler>::type returnArg) { - auto tail = returnArg.write((uintptr_t)&container); - - const T1 &underlyingContainer = get_container(container); - return OIInternal::getSizeType(underlyingContainer, tail); - } -}; -""" diff --git a/types/std_map_type.toml b/types/std_map_type.toml index ecceb36..61be6be 100644 --- a/types/std_map_type.toml +++ b/types/std_map_type.toml @@ -37,38 +37,6 @@ void getSizeType(const %1% &container, size_t& returnArg) } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair, - types::st::List::type, - typename TypeHandler::type - >>>; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - constexpr size_t nodeSize = sizeof(typename %1%::node_type); - - auto tail = returnArg.write(nodeSize).write(container.size()); - - // The double ampersand is needed otherwise this loop doesn't work with - // vector - for (const auto& it : container) { - tail = tail.delegate([&it](auto ret) { - return OIInternal::getSizeType(it.second, ret.delegate([&it](auto ret) { - return OIInternal::getSizeType(it.first, ret); - })); - }); - } - - return tail.finish(); - } -}; -""" - traversal_func = """ auto tail = returnArg .write((uintptr_t)&container) diff --git a/types/std_unordered_map_type.toml b/types/std_unordered_map_type.toml index b7f99d7..541576d 100644 --- a/types/std_unordered_map_type.toml +++ b/types/std_unordered_map_type.toml @@ -39,42 +39,6 @@ void getSizeType(const %1% &container, size_t& returnArg) } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair, - types::st::Pair, - types::st::List::type, - typename TypeHandler::type - >>>>; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - constexpr size_t nodeSize = sizeof(typename %1%::node_type); - - auto tail = returnArg.write(nodeSize) - .write(container.bucket_count()) - .write(container.size()); - - // The double ampersand is needed otherwise this loop doesn't work with - // vector - for (const auto& it : container) { - tail = tail.delegate([&it](auto ret) { - return OIInternal::getSizeType(it.second, ret.delegate([&it](auto ret) { - return OIInternal::getSizeType(it.first, ret); - })); - }); - } - - return tail.finish(); - } -}; -""" - traversal_func = """ auto tail = returnArg .write((uintptr_t)&container) diff --git a/types/std_unordered_multimap_type.toml b/types/std_unordered_multimap_type.toml index 2782118..a548623 100644 --- a/types/std_unordered_multimap_type.toml +++ b/types/std_unordered_multimap_type.toml @@ -39,42 +39,6 @@ void getSizeType(const %1% &container, size_t& returnArg) } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair, - types::st::Pair, - types::st::List::type, - typename TypeHandler::type - >>>>; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - constexpr size_t nodeSize = sizeof(typename %1%::node_type); - - auto tail = returnArg.write(nodeSize) - .write(container.bucket_count()) - .write(container.size()); - - // The double ampersand is needed otherwise this loop doesn't work with - // vector - for (const auto& it : container) { - tail = tail.delegate([&it](auto ret) { - return OIInternal::getSizeType(it.second, ret.delegate([&it](auto ret) { - return OIInternal::getSizeType(it.first, ret); - })); - }); - } - - return tail.finish(); - } -}; -""" - traversal_func = """ auto tail = returnArg .write((uintptr_t)&container) diff --git a/types/std_variant.toml b/types/std_variant.toml index d8d5f9b..c7b9dcc 100644 --- a/types/std_variant.toml +++ b/types/std_variant.toml @@ -36,33 +36,5 @@ void getSizeType(const %1% &container, size_t& returnArg) } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Sum::type..., types::st::Unit>; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - return getSizeTypeRecursive(container, returnArg); - } - - private: - template - static types::st::Unit getSizeTypeRecursive( - const %1%& container, - typename TypeHandler>::type returnArg) { - if constexpr (I < sizeof...(Types)) { - if (I == container.index()) { - return returnArg.template delegate([&container](auto ret) { - return OIInternal::getSizeType(std::get(container), ret); - }); - } else { - return getSizeTypeRecursive(container, returnArg); - } - } else { - return returnArg.template delegate(std::identity()); - } - } -}; -""" +# TODO: Add tbv2 definitions. The removed intermediate handler is a good +# template for this, find it in the git logs. diff --git a/types/thrift_isset_type.toml b/types/thrift_isset_type.toml index 213cb58..ce60791 100644 --- a/types/thrift_isset_type.toml +++ b/types/thrift_isset_type.toml @@ -17,9 +17,6 @@ decl = """ func = """ // DummyFunc %1% """ -handler = """ -// DummyHandler %1% -""" traversal_func = """ return returnArg; diff --git a/types/uniq_ptr_type.toml b/types/uniq_ptr_type.toml index eb3be12..35155f9 100644 --- a/types/uniq_ptr_type.toml +++ b/types/uniq_ptr_type.toml @@ -35,38 +35,6 @@ void getSizeType(const %1% &u_ptr, size_t& returnArg) } """ -handler = """ -template -struct TypeHandler> { - using type = typename std::conditional< - std::is_void::value, - types::st::Unit, - types::st::Pair, - types::st::Sum, - typename TypeHandler::type - >>>::type; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - if constexpr (!std::is_void::value) { - auto r0 = returnArg.write((uintptr_t)(container.get())); - if (container && pointers.add((uintptr_t)(container.get()))) { - return r0.template delegate<1>([&container](auto ret) { - return OIInternal::getSizeType(*(container.get()), ret); - }); - } else { - return r0.template delegate<0>(std::identity()); - } - } else { - return returnArg; - } - } -}; -""" - traversal_func = """ auto tail = returnArg.write((uintptr_t)container.get()); diff --git a/types/unordered_multiset_type.toml b/types/unordered_multiset_type.toml index bf6e86f..9d1449a 100644 --- a/types/unordered_multiset_type.toml +++ b/types/unordered_multiset_type.toml @@ -37,37 +37,6 @@ void getSizeType(const %1% &container, size_t& ret } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair< - DB, types::st::VarInt, - types::st::Pair< - DB, types::st::VarInt, - types::st::List::type>>>; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - constexpr size_t nodeSize = sizeof(typename %1%::node_type); - - auto tail = returnArg.write(nodeSize) - .write(container.bucket_count()) - .write(container.size()); - - // The double ampersand is needed otherwise this loop doesn't work with - // vector - for (auto&& it : container) { - tail = tail.delegate([&it](auto ret) { - return OIInternal::getSizeType(it, ret); - }); - } - - return tail.finish(); - } -}; -""" - traversal_func = """ auto tail = returnArg .write((uintptr_t)&container) diff --git a/types/unordered_set_type.toml b/types/unordered_set_type.toml index 8f085c4..62e0190 100644 --- a/types/unordered_set_type.toml +++ b/types/unordered_set_type.toml @@ -37,37 +37,6 @@ void getSizeType(const %1% &container, size_t& ret } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Pair< - DB, types::st::VarInt, - types::st::Pair< - DB, types::st::VarInt, - types::st::List::type>>>; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - constexpr size_t nodeSize = sizeof(typename %1%::node_type); - - auto tail = returnArg.write(nodeSize) - .write(container.bucket_count()) - .write(container.size()); - - // The double ampersand is needed otherwise this loop doesn't work with - // vector - for (auto&& it : container) { - tail = tail.delegate([&it](auto ret) { - return OIInternal::getSizeType(it, ret); - }); - } - - return tail.finish(); - } -}; -""" - traversal_func = """ auto tail = returnArg .write((uintptr_t)&container) diff --git a/types/weak_ptr_type.toml b/types/weak_ptr_type.toml index 83eaf56..33cb74e 100644 --- a/types/weak_ptr_type.toml +++ b/types/weak_ptr_type.toml @@ -24,18 +24,5 @@ void getSizeType(const %1% &s_ptr, size_t& returnArg) } """ -handler = """ -template -struct TypeHandler> { - using type = types::st::Unit; - - static types::st::Unit getSizeType( - const %1%& container, - typename TypeHandler>::type returnArg) { - return returnArg; - } -}; -""" - traversal_func = "return returnArg;"