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::Regexp::Walker< T > Class Template Referenceabstract

Public Member Functions

virtual T PreVisit (Regexp *re, T parent_arg, bool *stop)
virtual T PostVisit (Regexp *re, T parent_arg, T pre_arg, T *child_args, int nchild_args)
virtual T Copy (T arg)
virtual T ShortVisit (Regexp *re, T parent_arg)=0
T Walk (Regexp *re, T top_arg)
T WalkExponential (Regexp *re, T top_arg, int max_visits)
void Reset ()
bool stopped_early ()

Private Member Functions

T WalkInternal (Regexp *re, T top_arg, bool use_copy)
 Walker (const Walker &)=delete
Walker & operator= (const Walker &)=delete

Private Attributes

std::stack< WalkState< T > > stack_
bool stopped_early_
int max_visits_

Constructor & Destructor Documentation

◆ Walker()

template<typename T>
duckdb_re2::Regexp::Walker< T >::Walker ( )
460768 {
460769 stopped_early_ = false;
460770}

◆ ~Walker()

template<typename T>
duckdb_re2::Regexp::Walker< T >::~Walker ( )
virtual
460772 {
460773 Reset();
460774}

Member Function Documentation

◆ PreVisit()

template<typename T>
T duckdb_re2::Regexp::Walker< T >::PreVisit ( Regexp * re,
T parent_arg,
bool * stop )
virtual
460736 {
460737 return parent_arg;
460738}
Definition duckdb.cpp:460657

◆ PostVisit()

template<typename T>
T duckdb_re2::Regexp::Walker< T >::PostVisit ( Regexp * re,
T parent_arg,
T pre_arg,
T * child_args,
int nchild_args )
virtual
460744 {
460745 return pre_arg;
460746}

◆ Copy()

template<typename T>
T duckdb_re2::Regexp::Walker< T >::Copy ( T arg)
virtual
460748 {
460749 return arg;
460750}

◆ Walk()

template<typename T>
T duckdb_re2::Regexp::Walker< T >::Walk ( Regexp * re,
T top_arg )
460862 {
460863 // Without the exponential walking behavior,
460864 // this budget should be more than enough for any
460865 // regexp, and yet not enough to get us in trouble
460866 // as far as CPU time.
460867 max_visits_ = 1000000;
460868 return WalkInternal(re, top_arg, true);
460869}

◆ WalkExponential()

template<typename T>
T duckdb_re2::Regexp::Walker< T >::WalkExponential ( Regexp * re,
T top_arg,
int max_visits )
460872 {
460873 max_visits_ = max_visits;
460874 return WalkInternal(re, top_arg, false);
460875}

◆ Reset()

template<typename T>
void duckdb_re2::Regexp::Walker< T >::Reset ( )
460779 {
460780 if (!stack_.empty()) {
460781 LOG(DFATAL) << "Stack not empty.";
460782 while (!stack_.empty()) {
460783 if (stack_.top().re->nsub_ > 1)
460784 delete[] stack_.top().child_args;
460785 stack_.pop();
460786 }
460787 }
460788}

◆ stopped_early()

template<typename T>
bool duckdb_re2::Regexp::Walker< T >::stopped_early ( )
inline
460720{ return stopped_early_; }

◆ WalkInternal()

template<typename T>
T duckdb_re2::Regexp::Walker< T >::WalkInternal ( Regexp * re,
T top_arg,
bool use_copy )
private
460791 {
460792 Reset();
460793
460794 if (re == NULL) {
460795 LOG(DFATAL) << "Walk NULL";
460796 return top_arg;
460797 }
460798
460799 stack_.push(WalkState<T>(re, top_arg));
460800
460801 WalkState<T>* s;
460802 for (;;) {
460803 T t;
460804 s = &stack_.top();
460805 re = s->re;
460806 switch (s->n) {
460807 case -1: {
460808 if (--max_visits_ < 0) {
460809 stopped_early_ = true;
460810 t = ShortVisit(re, s->parent_arg);
460811 break;
460812 }
460813 bool stop = false;
460814 s->pre_arg = PreVisit(re, s->parent_arg, &stop);
460815 if (stop) {
460816 t = s->pre_arg;
460817 break;
460818 }
460819 s->n = 0;
460820 s->child_args = NULL;
460821 if (re->nsub_ == 1)
460822 s->child_args = &s->child_arg;
460823 else if (re->nsub_ > 1)
460824 s->child_args = new T[re->nsub_];
460826 }
460827 default: {
460828 if (re->nsub_ > 0) {
460829 Regexp** sub = re->sub();
460830 if (s->n < re->nsub_) {
460831 if (use_copy && s->n > 0 && sub[s->n - 1] == sub[s->n]) {
460832 s->child_args[s->n] = Copy(s->child_args[s->n - 1]);
460833 s->n++;
460834 } else {
460835 stack_.push(WalkState<T>(sub[s->n], s->pre_arg));
460836 }
460837 continue;
460838 }
460839 }
460840
460841 t = PostVisit(re, s->parent_arg, s->pre_arg, s->child_args, s->n);
460842 if (re->nsub_ > 1)
460843 delete[] s->child_args;
460844 break;
460845 }
460846 }
460847
460848 // We've finished stack_.top().
460849 // Update next guy down.
460850 stack_.pop();
460851 if (stack_.empty())
460852 return t;
460853 s = &stack_.top();
460854 if (s->child_args != NULL)
460855 s->child_args[s->n] = t;
460856 else
460857 s->child_arg = t;
460858 s->n++;
460859 }
460860}

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