Browse Source

Gmt module: Place const qualifiers where needed.

ObjPtr
Michael Uleysky 9 years ago
parent
commit
07f43394f4
  1. 6
      modules/gmt/modgmt_func.cpp

6
modules/gmt/modgmt_func.cpp

@ -22,7 +22,7 @@ class Base2Something: public OBTypeM<Func,O...>
Base2Something(const ObjectBase* arg):OBTypeM<Func,O...>(arg) {};
Base2Something(const ObjectList* input, const std::string& name):OBTypeM<Func,O...>(input->Get(name)){};
Base2Something(const ObjectList* input, const ObjectList::ListValues::size_type i):OBTypeM<Func,O...>((i<input->Size())?input->At(i):0){}; // Check index, because At is not safe
auto operator ()(bool* b) -> decltype(this->OBTypeM<Func,O...>::template operator()<bool*>(b)) const {return OBTypeM<Func,O...>::operator ()(b);}
auto operator ()(bool* b) const -> decltype(this->OBTypeM<Func,O...>::template operator()<bool*>(b)) {return OBTypeM<Func,O...>::operator ()(b);}
};
// Converting Int, Real or String to double
@ -30,13 +30,13 @@ template<class O>
class DoubleConv
{
public:
double operator ()(const O* q, bool* suc) {return q->Value();}
double operator ()(const O* q, bool* suc) const {return q->Value();}
};
template<>
class DoubleConv<ObjectString>
{
public:
double operator ()(const ObjectString* q, bool* suc) {double d=0; *suc=(*suc) && str2double(q->Value(),&d); return d;}
double operator ()(const ObjectString* q, bool* suc) const {double d=0; *suc=(*suc) && str2double(q->Value(),&d); return d;}
};
typedef Base2Something<DoubleConv,ObjectReal,ObjectInt,ObjectString> Base2Double;

Loading…
Cancel
Save