J
Jim
I have made a class which includes some of the methods in the class
declaration, which is in the header;
slice.h
class Slice{
private:
float cdelt1,cdelt2;
float crval1,crval2;
float crpix1,crpix2;
int crval3;
string filename;
long ax1,ax2;
valarray<float> contents;
void readData();
public:
Slice(string fnm,int i);
float getCDelt1(){ return cdelt1;}
float getCDelt2(){ return cdelt2;}
float getCRPix1(){ return crpix1;}
float getCRPix2(){ return crpix2;}
float getCRVal1(){ return crval2;}
float getCRVal2(){ return crval2;}
int getCRVal3(){ return crval3;}
long getax1(){ return ax1;}
long getax2(){ return ax2;}
void copyData(valarray<float> & data, int i);
};
As these have already been declared in the class declaration I thought
they would have been included as class members but I get an error in
assemble when I try to compile the file using this class.
assemble.cpp:49: error: 'class std::slice' has no member named
'getCDelt1'
assemble.cpp:50: error: 'class std::slice' has no member named
'getCDelt2'
assemble.cpp:51: error: 'class std::slice' has no member named
'getCRVal1'
assemble.cpp:52: error: 'class std::slice' has no member named
'getCRVal2'
assemble.cpp:53: error: 'class std::slice' has no member named
'getCRPix1'
assemble.cpp:54: error: 'class std::slice' has no member named
'getCRPix2'
assemble.cpp:55: error: 'class std::slice' has no member named
'getax1'
assemble.cpp:56: error: 'class std::slice' has no member named
'getax2'
assemble.cpp:61: error: 'class std::slice' has no member named
'copyData'
I tried re-writing the names in the class declaration as e.g
Slice::copyData, but that didn't work. How should I be doing this?
Putting the class def in the header and commenting it out of the .cpp
has been the only way I can get multiline programs to compile. Also,
does anyone know an efficient C++ method to go from strings to floats
or doubles? At the moment I convert to c_str and use atof.
Thanks!
declaration, which is in the header;
slice.h
class Slice{
private:
float cdelt1,cdelt2;
float crval1,crval2;
float crpix1,crpix2;
int crval3;
string filename;
long ax1,ax2;
valarray<float> contents;
void readData();
public:
Slice(string fnm,int i);
float getCDelt1(){ return cdelt1;}
float getCDelt2(){ return cdelt2;}
float getCRPix1(){ return crpix1;}
float getCRPix2(){ return crpix2;}
float getCRVal1(){ return crval2;}
float getCRVal2(){ return crval2;}
int getCRVal3(){ return crval3;}
long getax1(){ return ax1;}
long getax2(){ return ax2;}
void copyData(valarray<float> & data, int i);
};
As these have already been declared in the class declaration I thought
they would have been included as class members but I get an error in
assemble when I try to compile the file using this class.
assemble.cpp:49: error: 'class std::slice' has no member named
'getCDelt1'
assemble.cpp:50: error: 'class std::slice' has no member named
'getCDelt2'
assemble.cpp:51: error: 'class std::slice' has no member named
'getCRVal1'
assemble.cpp:52: error: 'class std::slice' has no member named
'getCRVal2'
assemble.cpp:53: error: 'class std::slice' has no member named
'getCRPix1'
assemble.cpp:54: error: 'class std::slice' has no member named
'getCRPix2'
assemble.cpp:55: error: 'class std::slice' has no member named
'getax1'
assemble.cpp:56: error: 'class std::slice' has no member named
'getax2'
assemble.cpp:61: error: 'class std::slice' has no member named
'copyData'
I tried re-writing the names in the class declaration as e.g
Slice::copyData, but that didn't work. How should I be doing this?
Putting the class def in the header and commenting it out of the .cpp
has been the only way I can get multiline programs to compile. Also,
does anyone know an efficient C++ method to go from strings to floats
or doubles? At the moment I convert to c_str and use atof.
Thanks!