Polaris: AnySuchThat.h Source File

AnySuchThat.h

Go to the documentation of this file.
00001 ///
00002 /// \class AnySuchThat 
00003 /// \brief Wildcard expression for user-defined semantics
00004 /// \defgroup Polaris
00005 /// \ingroup Polaris
00006 ///  Base
00007 /// \see Wildcard/AnySuchThat.h
00008 /// \see Wildcard/Wildcard.cc
00009 /// \see Wildcard/AnySuchThat.h
00010 ///
00011 /// \endcode
00012 /// \section Description Description
00013 /// AnySuchThat is a wildcard expression which matches any
00014 /// expression passing user-defined semantics.  The user
00015 /// gives the wildcard's constructor a function of type
00016 /// such_that_func (see Wildcard) plus extra arguments
00017 /// to be passed to the function (see Info).  When an
00018 /// attempt is made to made an expression against this
00019 /// wildcard, the user-defined function is called with
00020 /// the expression and with the user-defined extra
00021 /// arguments as parameters.  If the user-defined function
00022 /// returns True, the wildcard is considered a match,
00023 /// otherwise not.
00024 ///
00025 /// For more details, please see Wildcard.
00026 ///
00027 #ifndef _ANY_SUCH_THAT_H
00028 #define _ANY_SUCH_THAT_H
00029 ///
00030 #ifdef POLARIS_GNU_PRAGMAS
00031 #pragma interface
00032 #endif
00033 ///
00034 #ifndef _WILDCARD_H
00035 #include "Wildcard.h"
00036 #endif
00037 ///
00038 #include "../Info.h"
00039 ///
00040 class AnySuchThat : public Wildcard {
00041   protected:
00042     such_that_func _func;
00043     ExtraInfo *_info;
00044     String _printable_condition;
00045     
00046   public:
00047     AnySuchThat(such_that_func func,
00048                 /*&*/       const ExtraInfo &extra_info,
00049                 /*&*/       const char *printable_condition = 0);
00050     ///< Constructor.
00051     ///< 'func' is a user-defined function (see DESCRIPTION.)
00052     ///< 'extra_info' contains arguments to be passed to 'func'
00053     ///< 'printable_condition' is an optional printable representation
00054     ///<   of the condition function 'func', for example,
00055     ///<   "expr has no side-effects", or whatever.  It's only
00056     ///<   use is in printing out the wildcard expression.
00057     
00058     AnySuchThat(const AnySuchThat &other);
00059     
00060     virtual Expression *clone() const;
00061     virtual void print_debug(ostream &o, Boolean debug) const;
00062     virtual Boolean _try_for_match(Expression &e, Boolean consider_side_effects);
00063     virtual int structures_OK() const;
00064     
00065     virtual const ExprSignature & update_signature();
00066     virtual int node_compare(const Expression &ex) const;
00067 };
00068 
00069 #endif
 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:05:37 2005