\hypertarget{symbol__table_8cpp_source}{}\doxysection{symbol\+\_\+table.\+cpp}
\label{symbol__table_8cpp_source}\index{src/recomp/symbol\_table.cpp@{src/recomp/symbol\_table.cpp}}
\mbox{\hyperlink{symbol__table_8cpp}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00001}00001 \textcolor{comment}{// Copyright (c) 2022, \_xeroxz}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00002}00002 \textcolor{comment}{// All rights reserved.}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00003}00003 \textcolor{comment}{//}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00004}00004 \textcolor{comment}{// Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00005}00005 \textcolor{comment}{// modification, are permitted provided that the following conditions are met:}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00006}00006 \textcolor{comment}{//}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00007}00007 \textcolor{comment}{// 1. Redistributions of source code must retain the above copyright notice,}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00008}00008 \textcolor{comment}{//    this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00009}00009 \textcolor{comment}{//}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00010}00010 \textcolor{comment}{// 2. Redistributions in binary form must reproduce the above copyright notice,}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00011}00011 \textcolor{comment}{//    this list of conditions and the following disclaimer in the documentation}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00012}00012 \textcolor{comment}{//    and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00013}00013 \textcolor{comment}{//}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00014}00014 \textcolor{comment}{// 3. Neither the name of the copyright holder nor the names of its}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00015}00015 \textcolor{comment}{//    contributors may be used to endorse or promote products derived from}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00016}00016 \textcolor{comment}{//    this software without specific prior written permission.}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00017}00017 \textcolor{comment}{//}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00018}00018 \textcolor{comment}{// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "{}AS IS"{}}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00019}00019 \textcolor{comment}{// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00020}00020 \textcolor{comment}{// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00021}00021 \textcolor{comment}{// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00022}00022 \textcolor{comment}{// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00023}00023 \textcolor{comment}{// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00024}00024 \textcolor{comment}{// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00025}00025 \textcolor{comment}{// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00026}00026 \textcolor{comment}{// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00027}00027 \textcolor{comment}{// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00028}00028 \textcolor{comment}{// POSSIBILITY OF SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00029}00029 \textcolor{comment}{//}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00030}00030 }
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00031}00031 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{symbol__table_8hpp}{recomp/symbol\_table.hpp}}>}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00032}00032 }
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00033}00033 \textcolor{keyword}{namespace }\mbox{\hyperlink{namespacetheo_1_1recomp}{theo::recomp}} \{}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00034}\mbox{\hyperlink{classtheo_1_1recomp_1_1symbol__table__t_ab7dfbb8369463ce3d74ad656115cf4d5}{00034}} \mbox{\hyperlink{classtheo_1_1recomp_1_1symbol__table__t_ad06d4004c0cb454b1ffe7e2ae2ccedf5}{symbol\_table\_t::symbol\_table\_t}}(\textcolor{keyword}{const} std::vector<decomp::symbol\_t>\&\& syms) \{}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00035}00035   std::for\_each(syms.begin(), syms.end(), [\&](\mbox{\hyperlink{classtheo_1_1decomp_1_1symbol__t}{decomp::symbol\_t}} sym) \{}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00036}00036     m\_table.insert(\{sym.hash(), sym\});}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00037}00037   \});}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00038}00038 \}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00039}00039 }
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00040}\mbox{\hyperlink{classtheo_1_1recomp_1_1symbol__table__t_af9caf2d4d97b2498aa624c3750a7a601}{00040}} \textcolor{keywordtype}{void} symbol\_table\_t::put\_symbol(\mbox{\hyperlink{classtheo_1_1decomp_1_1symbol__t}{decomp::symbol\_t}}\& sym) \{}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00041}00041   m\_table.insert(\{sym.\mbox{\hyperlink{classtheo_1_1decomp_1_1symbol__t_a8695d75670cc4d61d275464e9109ff06}{hash}}(), sym\});}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00042}00042 \}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00043}00043 }
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00044}\mbox{\hyperlink{classtheo_1_1recomp_1_1symbol__table__t_ae7c35d9336f67d3175910c028e0b9b3e}{00044}} \textcolor{keywordtype}{void} symbol\_table\_t::put\_symbols(std::vector<decomp::symbol\_t>\& syms) \{}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00045}00045   std::for\_each(syms.begin(), syms.end(),}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00046}00046                 [\&](\mbox{\hyperlink{classtheo_1_1decomp_1_1symbol__t}{decomp::symbol\_t}} sym) \{ put\_symbol(sym); \});}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00047}00047 \}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00048}00048 }
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00049}\mbox{\hyperlink{classtheo_1_1recomp_1_1symbol__table__t_a35008ba37814a94209cf979302e13e6d}{00049}} \textcolor{keywordtype}{void} symbol\_table\_t::for\_each(\mbox{\hyperlink{namespacetheo_1_1decomp_af96177687d0ad683c5897d8fa01135f9acf6baee49c2ddb7e89724231bbd75d4a}{std::function}}<\textcolor{keywordtype}{void}(\mbox{\hyperlink{classtheo_1_1decomp_1_1symbol__t}{decomp::symbol\_t}}\& sym)> fn) \{}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00050}00050   \textcolor{keywordflow}{for} (\textcolor{keyword}{auto} itr = m\_table.begin(); itr != m\_table.end(); ++itr)}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00051}00051     fn(itr-\/>second);}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00052}00052 \}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00053}00053 }
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00054}\mbox{\hyperlink{classtheo_1_1recomp_1_1symbol__table__t_a308c0dbcc4d569467e0986b32ef30db5}{00054}} std::optional<decomp::symbol\_t*> symbol\_table\_t::sym\_from\_hash(}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00055}00055     std::size\_t hash) \{}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00056}00056   \textcolor{keywordflow}{return} m\_table.count(hash) ? \&m\_table.at(hash)}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00057}00057                              : std::optional<decomp::symbol\_t*>\{\};}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00058}00058 \}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00059}00059 }
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00060}\mbox{\hyperlink{classtheo_1_1recomp_1_1symbol__table__t_abaea9fd899d87b09d60c2b815624e2d2}{00060}} std::optional<decomp::symbol\_t*> symbol\_table\_t::sym\_from\_alloc(}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00061}00061     std::uintptr\_t allocated\_at) \{}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00062}00062   \textcolor{keyword}{auto} res =}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00063}00063       std::find\_if(m\_table.begin(), m\_table.end(),}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00064}00064                    [\&](std::pair<const std::size\_t, decomp::symbol\_t> itr) \{}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00065}00065                      return itr.second.allocated\_at() == allocated\_at;}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00066}00066                    \});}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00067}00067 }
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00068}00068   \textcolor{keywordflow}{return} res != m\_table.end() ? \&res-\/>second}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00069}00069                               : std::optional<decomp::symbol\_t*>\{\};}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00070}00070 \}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00071}00071 }
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00072}\mbox{\hyperlink{classtheo_1_1recomp_1_1symbol__table__t_af57c0495a442ea86af0f9cca4521631e}{00072}} std::uint32\_t symbol\_table\_t::size() \{}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00073}00073   \textcolor{keywordflow}{return} m\_table.size();}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00074}00074 \}}
\DoxyCodeLine{\Hypertarget{symbol__table_8cpp_source_l00075}00075 \}  \textcolor{comment}{// namespace theo::recomp}}

\end{DoxyCode}
