Autonomy Software C++ 24.5.1
Welcome to the Autonomy Software repository of the Mars Rover Design Team (MRDT) at Missouri University of Science and Technology (Missouri S&T)! API reference contains the source code and other resources for the development of the autonomy software for our Mars rover. The Autonomy Software project aims to compete in the University Rover Challenge (URC) by demonstrating advanced autonomous capabilities and robust navigation algorithms.
Loading...
Searching...
No Matches
duckdb_re2::FilteredRE2 Class Reference

Public Member Functions

 FilteredRE2 (int min_atom_len)
 FilteredRE2 (const FilteredRE2 &)=delete
FilteredRE2 & operator= (const FilteredRE2 &)=delete
 FilteredRE2 (FilteredRE2 &&other)
FilteredRE2 & operator= (FilteredRE2 &&other)
RE2::ErrorCode Add (const StringPiece &pattern, const RE2::Options &options, int *id)
void Compile (std::vector< std::string > *strings_to_match)
int SlowFirstMatch (const StringPiece &text) const
int FirstMatch (const StringPiece &text, const std::vector< int > &atoms) const
bool AllMatches (const StringPiece &text, const std::vector< int > &atoms, std::vector< int > *matching_regexps) const
void AllPotentials (const std::vector< int > &atoms, std::vector< int > *potential_regexps) const
int NumRegexps () const
const RE2 & GetRE2 (int regexpid) const

Private Member Functions

void PrintPrefilter (int regexpid)
void RegexpsGivenStrings (const std::vector< int > &matched_atoms, std::vector< int > *passed_regexps)

Private Attributes

std::vector< RE2 * > re2_vec_
bool compiled_
duckdb_base_std::unique_ptr< PrefilterTree > prefilter_tree_

Constructor & Destructor Documentation

◆ FilteredRE2() [1/3]

duckdb_re2::FilteredRE2::FilteredRE2 ( )
464902 : compiled_(false),
464903 prefilter_tree_(new PrefilterTree()) {
464904}

◆ FilteredRE2() [2/3]

duckdb_re2::FilteredRE2::FilteredRE2 ( int min_atom_len)
explicit
464907 : compiled_(false),
464908 prefilter_tree_(new PrefilterTree(min_atom_len)) {
464909}

◆ ~FilteredRE2()

duckdb_re2::FilteredRE2::~FilteredRE2 ( )
464911 {
464912 for (size_t i = 0; i < re2_vec_.size(); i++)
464913 delete re2_vec_[i];
464914}

◆ FilteredRE2() [3/3]

duckdb_re2::FilteredRE2::FilteredRE2 ( FilteredRE2 && other)
464917 : re2_vec_(std::move(other.re2_vec_)),
464918 compiled_(other.compiled_),
464919 prefilter_tree_(std::move(other.prefilter_tree_)) {
464920 other.re2_vec_.clear();
464921 other.re2_vec_.shrink_to_fit();
464922 other.compiled_ = false;
464923 other.prefilter_tree_.reset(new PrefilterTree());
464924}

Member Function Documentation

◆ operator=()

FilteredRE2 & duckdb_re2::FilteredRE2::operator= ( FilteredRE2 && other)
464926 {
464927 this->~FilteredRE2();
464928 (void) new (this) FilteredRE2(std::move(other));
464929 return *this;
464930}

◆ Add()

RE2::ErrorCode duckdb_re2::FilteredRE2::Add ( const StringPiece & pattern,
const RE2::Options & options,
int * id )
464933 {
464934 RE2* re = new RE2(pattern, options);
464935 RE2::ErrorCode code = re->error_code();
464936
464937 if (!re->ok()) {
464938 if (options.log_errors()) {
464939 LOG(ERROR) << "Couldn't compile regular expression, skipping: "
464940 << pattern << " due to error " << re->error();
464941 }
464942 delete re;
464943 } else {
464944 *id = static_cast<int>(re2_vec_.size());
464945 re2_vec_.push_back(re);
464946 }
464947
464948 return code;
464949}

◆ Compile()

void duckdb_re2::FilteredRE2::Compile ( std::vector< std::string > * strings_to_match)
464951 {
464952 if (compiled_) {
464953 LOG(ERROR) << "Compile called already.";
464954 return;
464955 }
464956
464957 if (re2_vec_.empty()) {
464958 LOG(ERROR) << "Compile called before Add.";
464959 return;
464960 }
464961
464962 for (size_t i = 0; i < re2_vec_.size(); i++) {
464963 Prefilter* prefilter = Prefilter::FromRE2(re2_vec_[i]);
464964 prefilter_tree_->Add(prefilter);
464965 }
464966 atoms->clear();
464967 prefilter_tree_->Compile(atoms);
464968 compiled_ = true;
464969}

◆ SlowFirstMatch()

int duckdb_re2::FilteredRE2::SlowFirstMatch ( const StringPiece & text) const
464971 {
464972 for (size_t i = 0; i < re2_vec_.size(); i++)
464973 if (RE2::PartialMatch(text, *re2_vec_[i]))
464974 return static_cast<int>(i);
464975 return -1;
464976}

◆ FirstMatch()

int duckdb_re2::FilteredRE2::FirstMatch ( const StringPiece & text,
const std::vector< int > & atoms ) const
464979 {
464980 if (!compiled_) {
464981 LOG(DFATAL) << "FirstMatch called before Compile.";
464982 return -1;
464983 }
464984 std::vector<int> regexps;
464985 prefilter_tree_->RegexpsGivenStrings(atoms, &regexps);
464986 for (size_t i = 0; i < regexps.size(); i++)
464987 if (RE2::PartialMatch(text, *re2_vec_[regexps[i]]))
464988 return regexps[i];
464989 return -1;
464990}

◆ AllMatches()

bool duckdb_re2::FilteredRE2::AllMatches ( const StringPiece & text,
const std::vector< int > & atoms,
std::vector< int > * matching_regexps ) const
464995 {
464996 matching_regexps->clear();
464997 std::vector<int> regexps;
464998 prefilter_tree_->RegexpsGivenStrings(atoms, &regexps);
464999 for (size_t i = 0; i < regexps.size(); i++)
465000 if (RE2::PartialMatch(text, *re2_vec_[regexps[i]]))
465001 matching_regexps->push_back(regexps[i]);
465002 return !matching_regexps->empty();
465003}

◆ AllPotentials()

void duckdb_re2::FilteredRE2::AllPotentials ( const std::vector< int > & atoms,
std::vector< int > * potential_regexps ) const
465007 {
465008 prefilter_tree_->RegexpsGivenStrings(atoms, potential_regexps);
465009}

◆ NumRegexps()

int duckdb_re2::FilteredRE2::NumRegexps ( ) const
inline
464571{ return static_cast<int>(re2_vec_.size()); }

◆ GetRE2()

const RE2 & duckdb_re2::FilteredRE2::GetRE2 ( int regexpid) const
inline
464574{ return *re2_vec_[regexpid]; }

◆ PrintPrefilter()

void duckdb_re2::FilteredRE2::PrintPrefilter ( int regexpid)
private
465016 {
465017 prefilter_tree_->PrintPrefilter(regexpid);
465018}

◆ RegexpsGivenStrings()

void duckdb_re2::FilteredRE2::RegexpsGivenStrings ( const std::vector< int > & matched_atoms,
std::vector< int > * passed_regexps )
private
465012 {
465013 prefilter_tree_->RegexpsGivenStrings(matched_atoms, passed_regexps);
465014}

The documentation for this class was generated from the following file: