Skip to content

Commit

Permalink
Use const* in place of unique_ptr reference; Update docstrings.
Browse files Browse the repository at this point in the history
  • Loading branch information
SharafMohamed committed Dec 7, 2024
1 parent 244d122 commit 176391b
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions src/log_surgeon/finite_automata/RegexDFA.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,24 @@ template <typename DFAStateType>
class RegexDFA {
public:
/**
* Creates a new DFA state based on a set of NFA states and adds it to
* m_states
* @param nfa_state_set
* @return DFAStateType*
* Creates a new DFA state based on a set of NFA states and adds it to `m_states`.
* @param nfa_state_set The set of NFA states represented by this DFA state.
* @return A pointer to the new DFA state.
*/
template <typename NFAStateType>
auto new_state(std::set<NFAStateType*> const& nfa_state_set) -> DFAStateType*;

auto get_root() const -> DFAStateType const* { return m_states.at(0).get(); }

/**
* Compares this dfa with dfa_in to determine the set of schema types in
* this dfa that are reachable by any type in dfa_in. A type is considered
* reachable if there is at least one string for which: (1) this dfa returns
* a set of types containing the type, and (2) dfa_in returns any non-empty
* set of types.
* @param dfa_in
* @return The set of schema types reachable by dfa_in
* Compares this dfa with `dfa_in` to determine the set of schema types in this dfa that are
* reachable by any type in `dfa_in`. A type is considered reachable if there is at least one
* string for which: (1) this dfa returns a set of types containing the type, and (2) `dfa_in`
* returns any non-empty set of types.
* @param dfa_in The dfa with which to take the intersect.
* @return The set of schema types reachable by `dfa_in`.
*/
[[nodiscard]] auto get_intersect(std::unique_ptr<RegexDFA> const& dfa_in
) const -> std::set<uint32_t>;
[[nodiscard]] auto get_intersect(RegexDFA const* dfa_in) const -> std::set<uint32_t>;

private:
std::vector<std::unique_ptr<DFAStateType>> m_states;
Expand All @@ -55,8 +52,7 @@ auto RegexDFA<DFAStateType>::new_state(std::set<NFAStateType*> const& nfa_state_
}

template <typename DFAStateType>
auto RegexDFA<DFAStateType>::get_intersect(std::unique_ptr<RegexDFA> const& dfa_in
) const -> std::set<uint32_t> {
auto RegexDFA<DFAStateType>::get_intersect(RegexDFA const* dfa_in) const -> std::set<uint32_t> {
std::set<uint32_t> schema_types;
std::set<RegexDFAStatePair<DFAStateType>> unvisited_pairs;
std::set<RegexDFAStatePair<DFAStateType>> visited_pairs;
Expand Down

0 comments on commit 176391b

Please sign in to comment.