/******************************************************************************* * E.S.O. - VLT project * * "@(#) $Id: AP_targ.C,v 2.43 2004/06/17 23:04:28 vltsccm Exp $" * * who when what * -------- -------- ---------------------------------------------- * hummel 02/03/98 created * aaguayo 04/12/03 APR2003 */ /************************************************************************ * NAME * TARG - simple container class * * SYNOPSIS * #include * TARG(char* tn, * float ta, float td, * float tx, float ty, * float tm, int tp); * * PARENT CLASS * * DESCRIPTION * A simple container class, adopted to represent an * astronomical catalog object, like a star or a * distant galaxy. The constructor arguments of the * instance (the target) are the target name (tn), * world coordinate positions (ta,td), cartesian * positions (tx,ty), magnitude (tm) and priority * flag (tp=0/1) * * PUBLIC METHODS * void print(); * float get_RA(); * float get_DEC(); * float get_MAG(); * float get_px(); * float get_py(); * int get_PRI(); * char* get_nam(); * void set_MAG(float mag); * void set_RA(float ra); * void set_DEC(float dec); * void set_px(float px); * void set_py(float py); * void set_PRI(int pri); * void set_nam(char *s); * * PUBLIC DATA MEMBERS * * PROTECTED METHODS * * PROTECTED DATA MEMBERS * * PRIVATE METHODS * * PRIVATE DATA MEMBERS * char* tn; // target name * float ta; // target RA (right ascension) * float td; // target DEC (declination) * float tx; // target pixel x * float ty; // target pixel y * float tm; // target magnitide * int tp; // target priority 0 or 1 * * FILES * AP_mask.C AP_mask.h * * ENVIRONMENT * * COMMANDS * * RETURN VALUES * * CAUTIONS * * EXAMPLES * * SEE ALSO * * BUGS * *------------------------------------------------------------------------ */ #ifndef __cplusplus #error This is a C++ include file and cannot be used from plain C #endif #include #include #include "AP_targ.h" using namespace std; void TARG::print() { cout << " T_name=" << tn << " RA=" << ta << "deg" << " DEC=" << td << "deg" << " px=" << tx << "pix" << " py=" << ty << "pix" << " mag=" << tm << "m" << " prio=" << tp << "p" << endl; } float TARG::get_RA() { return ta; } float TARG::get_DEC() { return td; } float TARG::get_px() { return tx; } float TARG::get_py() { return ty; } float TARG::get_MAG() { return tm; } int TARG::get_PRI() { return tp; } char* TARG::get_nam() { return tn; } void TARG::set_MAG(float mag) { tm=mag; } void TARG::set_RA(float ra) { ta=ra; } void TARG::set_DEC(float de) { td=de; } void TARG::set_px(float px) { tx=px; } void TARG::set_py(float py) { ty=py; } void TARG::set_PRI(int pri) { tp=pri; } void TARG::set_nam(char *s) { int n=strlen(s); // delete old storage delete[] tn; // create new storage tn=new char[n+1];// assign strcpy(tn,s); } TARG::TARG(char* ltn, float lta, float ltd, float ltx, float lty, float ltm, int ltp) { this->tn = new char[strlen(ltn)+1]; strcpy(this->tn,ltn); this->ta=lta; this->td=ltd; this->tx=ltx; this->ty=lty; this->tp=ltp; this->tm=ltm; }