Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Examples  

UserFuncPtr.h

Go to the documentation of this file.
00001 #ifndef USERFUNCPTR_H
00002 #define USERFUNCPTR_H
00003 
00004 #include "SundanceDefs.h"
00005 
00006 #include "ListBatch.h"
00007 
00008 
00009 namespace Sundance
00010 {
00011 
00012   using namespace TSF;
00013   using std::string;
00014 
00015   using std::ostream;
00016 
00017 
00018 
00019   /** \ingroup LowLevelSymbolics
00020    * FuncPtrBase is a base class for function pointers used in user-defined
00021    * expressions.
00022    */
00023 
00024   class FuncPtrBase
00025     {
00026     public:
00027       /** \name Developer-only methods */
00028       //@{
00029       /** no detailed doc */
00030       virtual ~FuncPtrBase(){;}
00031 
00032       /** */
00033       virtual ExprValue average(const Cell& cell) const = 0 ;
00034       //@}
00035     private:
00036     };
00037 
00038 
00039   /** \ingroup LowLevelSymbolics */
00040 
00041   class FuncOfX : public FuncPtrBase
00042     {
00043     public:
00044       /** \name Developer-only methods */
00045       //@{
00046       /** no detailed doc */
00047       FuncOfX(funcOfX f) : f_(f){;}
00048       /** */
00049       virtual ~FuncOfX(){;}
00050 
00051       /** */
00052       virtual ExprValue average(const Cell& cell) const ;
00053       //@}
00054     private:
00055       funcOfX f_;
00056     };
00057 
00058 
00059   /**
00060    * \ingroup LowLevelSymbolics
00061    * Handle for user-defined functions
00062    */
00063 
00064   class UserFuncPtr
00065     {
00066     public:
00067       /** \name Developer-only methods */
00068       //@{
00069       /** no detailed doc */
00070       UserFuncPtr(funcOfX f);
00071 
00072       /** */
00073       ExprValue average(const Cell& cell) const ;
00074       //@}
00075 
00076     private:
00077       TSFSmartPtr<FuncPtrBase> ptr_;
00078       mutable ListBatch cache_;
00079     };
00080 
00081 
00082 }
00083 #endif

Contact:
Kevin Long (krlong@ca.sandia.gov)


Documentation generated by