Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)

formula/constFormula.hh
Go to the documentation of this file.
00001 
00004 #ifndef constformula_hh
00005 #define constformula_hh
00006 
00007 #include "basics/debug.hh"
00008 #include "formula.hh"
00009 
00010 #define ConstFormConstr_D 0
00011 #define ConstFormDestr_D  0
00012 
00013 
00014 namespace concepts {
00015 
00016 
00017   // ********************************************************* ConstFormula **
00018 
00023   template<typename F = Real>
00024   class ConstFormula : public Formula<F> {
00025   public:
00026     ConstFormula(const F a = F(1.0)) : a_(a) {
00027       DEBUGL(ConstFormConstr_D, "a = " << a);
00028     }
00029     virtual F operator() (const Real p,    const Real t = 0.0) const {
00030       return a_;
00031     }
00032     virtual F operator() (const Real2d& p, const Real t = 0.0) const  {
00033       return a_;
00034     }
00035     virtual F operator() (const Real3d& p, const Real t = 0.0) const  {
00036       return a_;
00037     }
00038     virtual ~ConstFormula() {
00039       DEBUGL(ConstFormDestr_D, "Delete " << *this);
00040     }
00041     virtual ConstFormula<F>* clone() const {
00042       return new ConstFormula<F>(a_);
00043     }
00044     ConstFormula<F>& operator=(const F a) {
00045       a_ = a;
00046       return *this;
00047     }
00048   protected:
00049     virtual std::ostream& info(std::ostream& os) const {
00050       return os << "ConstFormula(" << a_ << ")";
00051     }
00052   private:
00053     F a_;
00054   };
00055 
00056   
00057 
00058 } // namespace concepts
00059 
00060 
00061 #endif // constformula_hh

Home | Doxygen Documentation | Tutorials | Developer Tools (restricted)