Ksetiwatch API Documentation


SetiContainer Class Reference

The SetiContainer class is a C++ class that allows convenient access to all the information in the state files of a SETI@home client. More...

#include <seticontainer.h>

Inherits QObject.

Inherited by SetiLoc.

Inheritance diagram for SetiContainer:

Inheritance graph
[legend]
Collaboration diagram for SetiContainer:

Collaboration graph
[legend]
List of all members.

Public Types

enum  SetiStatus
enum  sahID

Public Slots

int updateSahData (bool sig=true)

Signals

void progressIncreased ()
void progressDecreased ()
void newSpike (SpikeScore sps)
void newGaussian (GaussianScore gas)
void newPulse (PulseScore pus)
void newTriplet (TripletScore trs)
void newWorkUnit (WorkUnitData wud)
void updatedWorkUnitData ()
void updatedUserInfoData ()
void stateChanged (int state, int loadsize=0)

Public Methods

 SetiContainer (const QString &dir, int refresh=30)
 ~SetiContainer ()
void setRefreshInterval (int refresh)
QString directory () const
void setDirectory (const QString &d)
int refreshInterval ()
int fftNumber ()
int fftLength ()
double chirpRate ()
double cpuTime ()
int outfileSize ()
int potFrequency ()
int potActivity ()
double progress ()
double progressRate ()
double remainingTime ()
QString remainingTimeAsString ()
WUScore wuScore ()
SpikeScore spikeScore ()
GaussianScore gaussianScore ()
PulseScore pulseScore ()
TripletScore tripletScore ()
int userID ()
int key ()
QString userEmailAddress ()
QString userName ()
QString userHomepage ()
QString userCountry ()
int userPostalCode ()
bool showName ()
bool showEmail ()
int venue ()
QString registerTime ()
QString registerTimeString ()
QString lastWUTime ()
QString lastResultTime ()
QString lastResultTimeString ()
int numberOfWUs ()
int numberOfResults ()
double totalCPUTime ()
double averageCPUTime ()
double paramsIndex ()
QString task ()
int wuVersion ()
QString wuName ()
QString wuDataType ()
int wuDataClass ()
QString splitterVersion ()
double startRA ()
double startDec ()
double endRA ()
double endDec ()
double angleRange ()
double teraFlops (double ar, int version=0)
double megaFlopsPerSecond ()
QString timeRecorded ()
QString timeRecordedString ()
double centerFrequency ()
double baseFrequency ()
double sampleRate ()
int wuFFTLength ()
int wuIFFTLength ()
int subbandNumber ()
QString receiver ()
int numberOfSamples ()
QString tapeVersion ()
int numberOfCoords ()
QStringList coords ()
int clientVersion ()
bool exists (int sah)
bool isClientRunning (bool checkCmdLine=false)
int clientState () const
void setClientState (int st)
QString readEntry (int sah, const QString &e)

Static Public Methods

void initWUScore (WUScore *score)
QString convertTime (double time, bool hms)
QString convertRAToString (double ra)
QString convertDecToString (double dec)

Protected Methods

int readStateFile (bool sig=true)
int readWorkUnitFile (bool sig=true)
int readUserInfoFile (bool sig=true)
int readSahFile (const QString &file, QStringList &list, const QString &endId=0)
QString readEntry (const QString &fn, const QString &e)
void initStateFileData ()
void initWorkUnitData ()
void initUserInfoData ()
void scanStateFile (bool sig=true)
void scanSpikeData (bool sig=true)
void scanGaussianData (bool sig=true)
void scanPulseData (bool sig=true)
void scanTripletData (bool sig=true)
void scanGaussianGraphData ()
bool scanPulseGraphData ()
bool scanTripletGraphData ()
void scanUserInfoData (bool sig=true)
void scanWorkUnitData (bool sig=true)
int readClientVersion ()
void initAllData (bool sig=false)
virtual void timerEvent (QTimerEvent *e)
int checkClientState ()
int getClientPid ()
int checkClientStatePassive ()
void checkFileExistence ()

Static Protected Methods

QString readEntry (QStringList &list, const QString &e)
int readDataString (unsigned short int data[], QString &str, int cnt)

Detailed Description

The SetiContainer class is a C++ class that allows convenient access to all the information in the state files of a SETI@home client.

It periodically examines these files and updates its own data members accordingly. Other programs can use this class to extract information about the progress of the client, the found signals, or the work unit being processed. Additional functions offer more advanced info (like the amount of TeraFlops in a work unit, estimated time of completion, etc). The SetiContainer class is based on the Qt toolkit, and extensively uses Qt's Signal/Slot technique.

Using the SetiContainer is very simple. Here is a short code snippet:

 Seticontainer* sec = new SetiContainer("/home/crunchking/setiathome/");

 double  progress = sec->progress();
 QString wuname   = sec->wuName();
 cout << wuname << ": " << progress << " %";
 

This snippet creates a SetiContainer class which monitors the SETI@home client in the given directory. The name of the work unit and the client's progress are read and printed to stdout. By default, the SetiContainer class refreshes its data every 30 seconds. To change the refresh interval to 60 seconds, just do

 sec->setRefreshInterval(60);
 

SetiContainer offers more advanced functions: it calculates the amount of floating point operations (Flops) required to process the WU in dependence on the angle range, calculates the estimated time to complete the work unit, or converts the given time values from seconds into a nicely formatted string.

Another way of using this class is to inherit from it, and to extend it with all the features you would like to have. Have a look at the Ksetiwatch source code (http://ksetiwatch.sourceforge.net) to see how it is done.

All information from the client's output files is organized in a logical manner using dedicated structures. For example, there are the WorkUnitData structure, the UserInfoData structure, or the WUScore structure (which itself consists of four other structures: SpikeScore, GaussianScore, PulseScore, and TripletScore). By proper naming of these structures in your code, the resulting code is very readable. Here is an example; consider we have two WUScore structures, one holds the record signals, the other contains some newly found signals:

 WUScore record;
 WUScore new;
 ...
 ...
 ...
 if(new.pulse.score > record.pulse.score)
   {
   record.pulse = new.pulse;
   }
 ...
 

This piece of code checks if the score value of the new pulse is larger than that of the record pulse, and -if this is true- copies the entire pulse data to the record WUScore.

SetiContainer makes extensive use of Qt's signal/slot mechanism. For example, the progressIncreased() signal is emitted whenever the client has updated its state file with new data, or the newPulse() signal is emitted when a new high pulse signal was found. Connecting to a signal looks like this:

 connect(this,     SIGNAL(progressIncreased()),
         mywidget, SLOT(slotUpdateTimeData()));
 

Using this approach, the GUI elements are only updated when required, resulting in very efficient code.

In addition, the SetiContainer class provides a sophisticated way to check the state of the SETI@home client. It can distinguish between four different states: Running, Stopped, Finished, and Loading. Whenever the state changes, the stateChanged() signal is emitted.

Author:
Gordon Machel <gmachel@users.sourceforge.net>

Definition at line 117 of file seticontainer.h.


Member Enumeration Documentation

enum SetiContainer::SetiStatus
 

Status definition values.

Definition at line 428 of file seticontainer.h.

enum SetiContainer::sahID
 

The identifiers for the different output files of the SETI@home client.

Definition at line 432 of file seticontainer.h.


Constructor & Destructor Documentation

SetiContainer::SetiContainer const QString   dir,
int    refresh = 30
 

Constructs a Seti container class.

Parameters:
dir  The working folder of the SETI@home client.
refresh  The refresh interval. This class looks every refresh seconds if the data needs to be updated. Default is 30 seconds.

Definition at line 39 of file seticontainer.cpp.

References setDirectory(), and QObject::startTimer().

SetiContainer::~SetiContainer  
 

The destructor.

Definition at line 56 of file seticontainer.cpp.


Member Function Documentation

void SetiContainer::setRefreshInterval int    refresh
 

Sets the refresh interval to refresh seconds.

Parameters:
refresh  The refresh interval in seconds.

Definition at line 112 of file seticontainer.cpp.

References QObject::killTimer(), and QObject::startTimer().

Referenced by Ksetiwatch::readConfig(), and Options::slotSetRefreshInterval().

QString SetiContainer::directory   const [inline]
 

Returns the SETI@home directory.

Definition at line 138 of file seticontainer.h.

Referenced by checkClientState(), CompletedWUList::checkForRedirect(), getClientPid(), SetiLoc::logDirectory(), LoggedSigs::slotSave(), SetiGraph::slotSaveGraph(), SetiLoc::startClient(), and updateSahData().

void SetiContainer::setDirectory const QString   d
 

Sets the location's directory.

Definition at line 61 of file seticontainer.cpp.

References initAllData(), StateFileData::prog, and readClientVersion().

Referenced by SetiContainer(), and SetiLoc::setOptions().

int SetiContainer::refreshInterval   [inline]
 

Returns the current refresh interval time in seconds.

Definition at line 142 of file seticontainer.h.

int SetiContainer::fftNumber   [inline]
 

Returns the number of the currently processed Fast Fourier Transformation.

Definition at line 146 of file seticontainer.h.

References StateFileData::ncfft.

int SetiContainer::fftLength   [inline]
 

Returns the length (in data points) of the currently processed Fast Fourier Transformation.

Definition at line 150 of file seticontainer.h.

References StateFileData::fl.

double SetiContainer::chirpRate   [inline]
 

Returns the current chirp rate (or drift rate) in Hz/s.

Definition at line 152 of file seticontainer.h.

References StateFileData::cr.

Referenced by Analysis::updateListItemTimeData().

double SetiContainer::cpuTime   [inline]
 

Returns the cpu time (in seconds) spent on the current work unit.

Definition at line 154 of file seticontainer.h.

References StateFileData::cpu.

Referenced by progressRate(), timerEvent(), and Analysis::updateListItemTimeData().

int SetiContainer::outfileSize   [inline]
 

Returns the size of the file outfile.sah which collects data about interesting signals to be returned to the SETI@home server.

If this value has increased the client has found a new interesting signal.

Definition at line 159 of file seticontainer.h.

References StateFileData::outfilepos.

int SetiContainer::potFrequency   [inline]
 

This is a parameter used internally by the SETI@home client.

Definition at line 161 of file seticontainer.h.

References StateFileData::potfreq.

int SetiContainer::potActivity   [inline]
 

This is a parameter used internally by the SETI@home client.

Definition at line 163 of file seticontainer.h.

References StateFileData::potactivity.

double SetiContainer::progress   [inline]
 

Returns the progress of the client in per cent.

Definition at line 165 of file seticontainer.h.

References StateFileData::prog.

Referenced by DockWidget::paintIcon(), progressRate(), remainingTime(), Analysis::updateListItemTimeData(), and DockWidget::updateState().

double SetiContainer::progressRate  
 

Returns the client's progress rate (in % per hour) based on the actual percentage done and the corresponding cpu time.

Definition at line 1091 of file seticontainer.cpp.

References cpuTime(), and progress().

Referenced by megaFlopsPerSecond(), remainingTime(), and Analysis::updateListItemTimeData().

double SetiContainer::remainingTime  
 

Returns the estimated time (in seconds) needed to finish the work unit.

Definition at line 1098 of file seticontainer.cpp.

References progress(), and progressRate().

Referenced by remainingTimeAsString(), timerEvent(), and Analysis::updateListItemTimeData().

QString SetiContainer::remainingTimeAsString  
 

Returns the estimated time needed to finish the work unit in form of a formatted string.

Definition at line 1106 of file seticontainer.cpp.

References convertTime(), and remainingTime().

Referenced by DockWidget::updateState().

WUScore SetiContainer::wuScore   [inline]
 

Returns a WUScore structure containing the highest signals found in the current work unit so far.

See WUScore for details about the members of the WUScore structure.

Definition at line 182 of file seticontainer.h.

References StateFileData::max.

Referenced by Analysis::checkPopupStatus(), Analysis::updateListItemGaussianData(), Analysis::updateListItemPulseData(), Analysis::updateListItemSpikeData(), and Analysis::updateListItemTripletData().

SpikeScore SetiContainer::spikeScore   [inline]
 

Returns a SpikeScore structure containing the highest spike found in the current work unit so far.

See SpikeScore for details about the members of the SpikeScore structure.

Definition at line 187 of file seticontainer.h.

References StateFileData::max, and WUScore::spike.

GaussianScore SetiContainer::gaussianScore   [inline]
 

Returns a GaussianScore structure containing the highest gaussian found in the current work unit so far.

See GaussianScore for details about the members of the GaussianScore structure.

Definition at line 192 of file seticontainer.h.

References WUScore::gaussian, and StateFileData::max.

Referenced by GaussianPlot::init().

PulseScore SetiContainer::pulseScore   [inline]
 

Returns a PulseScore structure containing the highest pulse found in the current work unit so far.

See PulseScore for details about the members of the PulseScore structure.

Definition at line 197 of file seticontainer.h.

References StateFileData::max, and WUScore::pulse.

Referenced by PulsePlot::init().

TripletScore SetiContainer::tripletScore   [inline]
 

Returns a TripletScore structure containing the highest triplet found in the current work unit so far.

See TripletScore for details about the members of the TripletScore structure.

Definition at line 202 of file seticontainer.h.

References StateFileData::max, and WUScore::triplet.

Referenced by TripletPlot::init().

int SetiContainer::userID   [inline]
 

Returns the user's id number.

Definition at line 204 of file seticontainer.h.

References UserInfoData::id.

int SetiContainer::key   [inline]
 

Returns the user's id key.

Definition at line 206 of file seticontainer.h.

References UserInfoData::key.

Referenced by SetiLoc::logResults().

QString SetiContainer::userEmailAddress   [inline]
 

Returns the user's email address.

Definition at line 208 of file seticontainer.h.

References UserInfoData::email_addr.

QString SetiContainer::userName   [inline]
 

Returns the user's name.

Definition at line 210 of file seticontainer.h.

References UserInfoData::name.

Referenced by UserInfo::refreshListItem().

QString SetiContainer::userHomepage   [inline]
 

Returns the user's homepage address.

Definition at line 212 of file seticontainer.h.

References UserInfoData::url.

QString SetiContainer::userCountry   [inline]
 

Returns the user's country.

Definition at line 214 of file seticontainer.h.

References UserInfoData::country.

int SetiContainer::userPostalCode   [inline]
 

Returns the user's postal code.

Definition at line 216 of file seticontainer.h.

References UserInfoData::postal_code.

bool SetiContainer::showName   [inline]
 

If true the user's name is allowed to be shown on the SETI@home web pages.

Definition at line 220 of file seticontainer.h.

References UserInfoData::show_name.

bool SetiContainer::showEmail   [inline]
 

If true the user's email address is allowed to be shown on the SETI@home web pages.

Definition at line 224 of file seticontainer.h.

References UserInfoData::show_email.

int SetiContainer::venue   [inline]
 

Returns the venue parameter (whatever it is good for).

Definition at line 226 of file seticontainer.h.

References UserInfoData::venue.

QString SetiContainer::registerTime   [inline]
 

Returns the time the user registered with SETI@home in form of a plain string (as stored in user_info.sah).

Definition at line 230 of file seticontainer.h.

References UserInfoData::register_time.

Referenced by registerTimeString().

QString SetiContainer::registerTimeString  
 

Returns the date and time the user registered with SETI@home in a nicely formatted string.

An empty string is returned when the information could not be found.

Definition at line 1206 of file seticontainer.cpp.

References QString::find(), QString::mid(), and registerTime().

Referenced by UserInfo::refreshListItem().

QString SetiContainer::lastWUTime   [inline]
 

Returns the time the last work unit was sent to the user in form of a plain string (as stored in user_info.sah).

Note: this information is not updated any more.

Definition at line 240 of file seticontainer.h.

References UserInfoData::last_wu_time.

QString SetiContainer::lastResultTime   [inline]
 

Returns the time the user has sent his/her last work unit result to the SETI@home server in form of a plain string (as stored in user_info.sah).

Definition at line 245 of file seticontainer.h.

References UserInfoData::last_result_time.

Referenced by lastResultTimeString().

QString SetiContainer::lastResultTimeString  
 

Returns the date and time the last result was sent in a nicely formatted string.

An empty string is returned when the information could not be found.

Definition at line 1191 of file seticontainer.cpp.

References QString::find(), lastResultTime(), and QString::mid().

Referenced by UserInfo::refreshListItem().

int SetiContainer::numberOfWUs   [inline]
 

Returns the number of work units sent to the user.

Note: this information is not updated any more.

Definition at line 254 of file seticontainer.h.

References UserInfoData::nwus.

int SetiContainer::numberOfResults   [inline]
 

Returns the number of results the user has sent back to the SETI@home server.

Definition at line 258 of file seticontainer.h.

References UserInfoData::nresults.

Referenced by averageCPUTime(), and UserInfo::refreshListItem().

double SetiContainer::totalCPUTime   [inline]
 

Returns the total cpu time (in seconds) the user has processed so far.

Definition at line 261 of file seticontainer.h.

References UserInfoData::total_cpu.

Referenced by averageCPUTime(), and UserInfo::refreshListItem().

double SetiContainer::averageCPUTime  
 

Returns the average CPU time (in seconds) required to process one work unit.

Definition at line 1184 of file seticontainer.cpp.

References numberOfResults(), and totalCPUTime().

Referenced by UserInfo::refreshListItem().

double SetiContainer::paramsIndex   [inline]
 

Returns a parameter index value.

No idea what this is good for.

Definition at line 267 of file seticontainer.h.

References UserInfoData::params_index.

QString SetiContainer::task   [inline]
 

Returns the task identifier string.

We are all in the "seti" business, aren't we?

Definition at line 271 of file seticontainer.h.

References WorkUnitData::task.

int SetiContainer::wuVersion   [inline]
 

Returns an internal version number.

This is not the version number of the SETI@home client.

Definition at line 275 of file seticontainer.h.

References WorkUnitData::version.

QString SetiContainer::wuName   [inline]
 

Returns the name of the work unit.

Definition at line 277 of file seticontainer.h.

References WorkUnitData::name.

Referenced by scanGaussianData(), scanPulseData(), scanSpikeData(), scanTripletData(), SetiGraph::SetiGraph(), and TelescopePath::setLocation().

QString SetiContainer::wuDataType   [inline]
 

Returns the data type of the attached work unit data.

Definition at line 279 of file seticontainer.h.

References WorkUnitData::data_type.

int SetiContainer::wuDataClass   [inline]
 

Returns the data class of the attached work unit data.

Definition at line 281 of file seticontainer.h.

References WorkUnitData::data_class.

QString SetiContainer::splitterVersion   [inline]
 

Returns the version number of the splitter (software?).

Definition at line 283 of file seticontainer.h.

References WorkUnitData::splitter_version.

double SetiContainer::startRA   [inline]
 

Returns the right ascension (RA) value where the telescope has started to scan the sky for this work unit.

Definition at line 287 of file seticontainer.h.

References WorkUnitData::start_ra.

Referenced by SkyMap::addLocation(), and DataInfo::refreshListItem().

double SetiContainer::startDec   [inline]
 

Returns the declination value where the telescope has started to scan the sky for the current work unit.

Definition at line 291 of file seticontainer.h.

References WorkUnitData::start_dec.

Referenced by SkyMap::addLocation(), and DataInfo::refreshListItem().

double SetiContainer::endRA   [inline]
 

Returns the right ascension (RA) value where the telescope has stopped to scan the sky for the current work unit.

Definition at line 295 of file seticontainer.h.

References WorkUnitData::end_ra.

double SetiContainer::endDec   [inline]
 

Returns the declination value where the telescope has stopped to scan the sky for the current work unit.

Definition at line 299 of file seticontainer.h.

References WorkUnitData::end_dec.

double SetiContainer::angleRange   [inline]
 

Returns the angle range which the telescope has scanned for the current work unit.

Definition at line 303 of file seticontainer.h.

References WorkUnitData::angle_range.

Referenced by megaFlopsPerSecond(), DataInfo::refreshListItem(), and TelescopePath::setLocation().

double SetiContainer::teraFlops double    ar,
int    version = 0
 

Calculates the amount of floating point operations that need to be processed to finish a work unit depending on the angle range.

This function is based on the work of Lawrence Kirby and Roelof Engelbrecht.

Parameters:
ar  The angle range of the work unit.
version  The version of the SETI@home client as an integer value (300 is "3.00", 303 is "3.03"). If omitted, this method uses the version number found in `version.sah'.
Returns:
The number of floating point operations in TeraFlops.

Definition at line 1254 of file seticontainer.cpp.

References clientVersion().

Referenced by CompletedWUList::fillWUList(), megaFlopsPerSecond(), and DataInfo::refreshListItem().

double SetiContainer::megaFlopsPerSecond  
 

Returns the progress rate in MegaFlops/s.

Definition at line 1296 of file seticontainer.cpp.

References angleRange(), progressRate(), and teraFlops().

Referenced by Analysis::updateListItemTimeData().

QString SetiContainer::timeRecorded   [inline]
 

Returns the time the work unit was recorded (as stored in in the work_unit.sah file).

Definition at line 321 of file seticontainer.h.

References WorkUnitData::time_recorded.

Referenced by SkyMap::addLocation(), and timeRecordedString().

QString SetiContainer::timeRecordedString  
 

Returns the date and the time the work unit was recorded in a nicely formatted string.

An empty string is returned when the information could not be found.

Definition at line 1169 of file seticontainer.cpp.

References QString::find(), QString::mid(), timeRecorded(), and QObject::tr().

Referenced by SkyMap::addLocation(), and DataInfo::refreshListItem().

double SetiContainer::centerFrequency   [inline]
 

Returns the subband center frequency in GHz.

Definition at line 328 of file seticontainer.h.

References WorkUnitData::subband_center.

double SetiContainer::baseFrequency   [inline]
 

Returns the subband base frequency in GHz.

Definition at line 330 of file seticontainer.h.

References WorkUnitData::subband_base.

Referenced by DataInfo::refreshListItem().

double SetiContainer::sampleRate   [inline]
 

Returns the sample rate in Hz.

Definition at line 332 of file seticontainer.h.

References WorkUnitData::subband_sample_rate.

int SetiContainer::wuFFTLength   [inline]
 

This parameter is used internally by the SETI@home client.

Definition at line 334 of file seticontainer.h.

References WorkUnitData::fft_len.

int SetiContainer::wuIFFTLength   [inline]
 

This parameter is used internally by the SETI@home client.

Definition at line 336 of file seticontainer.h.

References WorkUnitData::ifft_len.

int SetiContainer::subbandNumber   [inline]
 

Returns the subband number.

Definition at line 338 of file seticontainer.h.

References WorkUnitData::subband_number.

QString SetiContainer::receiver   [inline]
 

Returns the identifier string of the facility that recorded the work unit.

"ao1420" defines the Arecibo Radio Telescope.

Definition at line 342 of file seticontainer.h.

References WorkUnitData::receiver.

Referenced by DataInfo::refreshListItem().

int SetiContainer::numberOfSamples   [inline]
 

Returns the number of samples in the work unit.

Definition at line 344 of file seticontainer.h.

References WorkUnitData::nsamples.

QString SetiContainer::tapeVersion   [inline]
 

Returns the version number of the tape storing the work unit.

Definition at line 346 of file seticontainer.h.

References WorkUnitData::tape_version.

int SetiContainer::numberOfCoords   [inline]
 

Returns the number of sky coordinates that define the path of the telescope over the sky during acquisition of the work unit data.

Definition at line 350 of file seticontainer.h.

References WorkUnitData::num_positions.

QStringList SetiContainer::coords   [inline]
 

Returns a string list with all the sky coordinates that define the path of the telescope over the sky during acquisition of the work unit data.

Definition at line 355 of file seticontainer.h.

References WorkUnitData::coordinates.

Referenced by TelescopePath::setLocation().

int SetiContainer::clientVersion   [inline]
 

Returns the version number of the SETI@home client.

It is returned as an integer formed of both the major and the minor version number. Example: for client version 3.03, a 303 is returned.

Definition at line 361 of file seticontainer.h.

Referenced by Analysis::checkPopupStatus(), SetiLoc::logWorkUnit(), and teraFlops().

bool SetiContainer::exists int    sah
 

Checks if the file represented by sah exists.

Parameters:
sah  Can be one of the following: SC_StateFile, SC_UserInfoFile, SC_WorkUnitFile, SC_ResultFile, SC_ResultHeaderFile, or SC_WtempFile.

Definition at line 1221 of file seticontainer.cpp.

References QFile::exists().

Referenced by checkClientState(), SetiLoc::logWorkUnit(), readStateFile(), readUserInfoFile(), readWorkUnitFile(), UserInfo::refreshListItem(), DataInfo::refreshListItem(), Analysis::updateListItemGaussianData(), Analysis::updateListItemPulseData(), Analysis::updateListItemSpikeData(), Analysis::updateListItemTimeData(), Analysis::updateListItemTripletData(), and Analysis::updateMaxScore().

bool SetiContainer::isClientRunning bool    checkCmdLine = false
 

Checks if the SETI@home client is running by trying to signal the process pid.

Parameters:
pid  The process id of the client. If omitted the pid will be read from pid.sah.
checkCmdLine  If true, this method checks whether the process defined by pid is really that of a SETI@home client.
Returns:
TRUE if client is running, FALSE if it is stopped or on error.

Definition at line 1484 of file seticontainer.cpp.

References QFile::close(), QString::find(), getClientPid(), and QFile::open().

Referenced by checkClientState(), Analysis::checkPopupStatus(), DockWidget::preparePopupMenu(), Analysis::slotStartAll(), Analysis::slotStopAll(), SetiLoc::startClient(), and Ksetiwatch::stopClients().

int SetiContainer::clientState   const [inline]
 

Returns the state of the location.

Definition at line 382 of file seticontainer.h.

Referenced by Analysis::checkPopupStatus(), AnalysisListViewItem::key(), DockWidget::paintIcon(), DockWidget::preparePopupMenu(), Analysis::refreshListItem(), Analysis::slotAdjustAllStatusIcons(), DockWidget::slotBlinkIcon(), Analysis::slotUpdateList(), Analysis::updateAnalysisList(), Analysis::updateListItemTimeData(), DockWidget::updateProgress(), and DockWidget::updateState().

void SetiContainer::setClientState int    st [inline]
 

Sets the state of the location.

Setting it to -1, triggers a refresh during the next update cycle.

Definition at line 385 of file seticontainer.h.

QString SetiContainer::readEntry int    sah,
const QString   e
 

This function allows low-level access to the entries in the S@h output files.

It reads the entry e from the file sah. Use this function only if you know what you are doing!

Parameters:
sah  The file from which the entry shall be read. You can choose from four values: SC_StateFile, SC_UserInfoFile, SC_WorkUnitFile, and SC_ResultFile.
e  The entry which shall be retrieved.

Definition at line 321 of file seticontainer.cpp.

Referenced by SetiLoc::loggedGaussianSignal(), SetiLoc::loggedPulseSignal(), SetiLoc::loggedSpikeSignal(), SetiLoc::loggedTripletProfile(), SetiLoc::loggedTripletSignal(), SetiLoc::logResults(), SetiLoc::logWorkUnit(), readClientVersion(), scanGaussianData(), scanGaussianGraphData(), scanPulseData(), scanPulseGraphData(), scanSpikeData(), scanStateFile(), scanTripletData(), scanTripletGraphData(), scanUserInfoData(), and scanWorkUnitData().

void SetiContainer::initWUScore WUScore   score [static]
 

Initializes all members and data arrays of the WUScore structure .

Parameters:
score  A pointer to the WUScore structure to be cleared.

Definition at line 416 of file seticontainer.cpp.

References GaussianScore::bin, SpikeScore::bin, TripletScore::bperiod, TripletScore::chirprate, PulseScore::chirprate, GaussianScore::chirprate, SpikeScore::chirprate, GaussianScore::chisq, TripletScore::data, PulseScore::data, GaussianScore::data, TripletScore::data_len, PulseScore::data_len, GaussianScore::data_len, TripletScore::dec, PulseScore::dec, GaussianScore::dec, SpikeScore::dec, GaussianScore::fft_index, SpikeScore::fft_index, TripletScore::fft_len, PulseScore::fft_len, GaussianScore::fft_len, SpikeScore::fft_len, TripletScore::freq_bin, PulseScore::freq_bin, TripletScore::frequency, PulseScore::frequency, GaussianScore::frequency, SpikeScore::frequency, WUScore::gaussian, TripletScore::mean, PulseScore::mean, TripletScore::period, PulseScore::period, TripletScore::power, PulseScore::power, GaussianScore::power, SpikeScore::power, WUScore::pulse, TripletScore::ra, PulseScore::ra, GaussianScore::ra, SpikeScore::ra, TripletScore::scale, TripletScore::score, PulseScore::score, GaussianScore::score, SpikeScore::score, GaussianScore::sigma, WUScore::spike, TripletScore::time_bin, PulseScore::time_bin, TripletScore::tpotind0_0, TripletScore::tpotind0_1, TripletScore::tpotind1_0, TripletScore::tpotind1_1, TripletScore::tpotind2_0, TripletScore::tpotind2_1, WUScore::triplet, GaussianScore::true_mean, TripletScore::wu_name, PulseScore::wu_name, GaussianScore::wu_name, and SpikeScore::wu_name.

Referenced by CompletedWUList::fillSigSumList(), CompletedWUList::fillTotalList(), SetiLoc::initMaxScore(), initStateFileData(), Ksetiwatch::Ksetiwatch(), SetiLoc::loggedGaussianSignal(), SetiLoc::loggedPulseSignal(), SetiLoc::loggedSpikeSignal(), SetiLoc::loggedTripletSignal(), and SetiLoc::slotInitMaxScore().

QString SetiContainer::convertTime double    time,
bool    hms
[static]
 

Converts the time (in seconds) to a string.

Parameters:
time  The time in seconds.
hms  Defines the kind of presentation. If true, the time will be given in hours:minutes:seconds, if false in days:hours:minutes:seconds.

Definition at line 1113 of file seticontainer.cpp.

References QString::sprintf().

Referenced by CompletedWUList::fillTotalColumns(), CompletedWUList::fillWUList(), UserInfo::refreshListItem(), remainingTimeAsString(), and Analysis::updateListItemTimeData().

QString SetiContainer::convertRAToString double    ra [static]
 

Converts the right ascension (RA) value to a readable string of the form hours:minutes:seconds.

Parameters:
ra  The RA value.
Returns:
The converted string.

Definition at line 1141 of file seticontainer.cpp.

References QString::sprintf().

Referenced by CompletedWUList::fillWUList(), DataInfo::refreshListItem(), LoggedSigs::setGaussianText(), TelescopePath::setLocation(), LoggedSigs::setPulseText(), and LoggedSigs::setTripletText().

QString SetiContainer::convertDecToString double    dec [static]
 

Converts the declination value to a readable string of the form degrees:minutes:seconds.

Parameters:
dec  The declination value.
Returns:
The converted string.

Definition at line 1155 of file seticontainer.cpp.

References QString::sprintf().

Referenced by CompletedWUList::fillWUList(), DataInfo::refreshListItem(), LoggedSigs::setGaussianText(), TelescopePath::setLocation(), LoggedSigs::setPulseText(), and LoggedSigs::setTripletText().

int SetiContainer::updateSahData bool    sig = true [slot]
 

Updates the data from all SETI@home files.

Parameters:
sig  If true, Qt's signals are allowed to be emitted when necessary.
Returns:
0 in case of success, 1 on error.

Definition at line 151 of file seticontainer.cpp.

References directory(), QFile::exists(), readClientVersion(), readStateFile(), readUserInfoFile(), readWorkUnitFile(), and stateChanged().

Referenced by checkClientState(), initAllData(), and timerEvent().

int SetiContainer::readStateFile bool    sig = true [protected]
 

Reads the state file and puts it into a string list.

Parameters:
sig  If true, Qt's signals are allowed to be emitted when necessary.
Returns:
0 in case of success, 1 on error.

Definition at line 246 of file seticontainer.cpp.

References exists(), QFileInfo::lastModified(), readSahFile(), scanStateFile(), and QDateTime::toString().

Referenced by updateSahData().

int SetiContainer::readWorkUnitFile bool    sig = true [protected]
 

Reads the work unit file and puts it into a string list.

Parameters:
sig  If true, Qt's signals are allowed to be emitted when necessary.
Returns:
0 in case of success, 1 on error.

Definition at line 271 of file seticontainer.cpp.

References exists(), QFileInfo::lastModified(), readSahFile(), scanWorkUnitData(), and QDateTime::toString().

Referenced by updateSahData().

int SetiContainer::readUserInfoFile bool    sig = true [protected]
 

Reads the user info file and puts it into a string list.

Parameters:
sig  If true, Qt's signals are allowed to be emitted when necessary.
Returns:
0 in case of success, 1 on error.

Definition at line 296 of file seticontainer.cpp.

References exists(), QFileInfo::lastModified(), readSahFile(), scanUserInfoData(), and QDateTime::toString().

Referenced by updateSahData().

int SetiContainer::readSahFile const QString   file,
QStringList   list,
const QString   endId = 0
[protected]
 

Reads a SETI@home sah file into a string list.

Parameters:
file  The file name.
list  A pointer to a QStrList where the lines are stored.
endId  The end-of-file identifier. If a line identical to this string is found, reading stops. When this parameter is omitted, the entire file is read.
Returns:
0 in case of success, 1 on error.

Definition at line 218 of file seticontainer.cpp.

References QTextStream::atEnd(), QFile::close(), QString::isEmpty(), QFile::open(), and QTextStream::readLine().

Referenced by readStateFile(), readUserInfoFile(), and readWorkUnitFile().

QString SetiContainer::readEntry const QString   fn,
const QString   e
[protected]
 

Reads an entry given by e from file fn.

Reads it directly from disk.

Parameters:
fn  The file name.
e  The entry identifier string.
Returns:
The corresponding entry, or an empty string if the entry could not be found.

Definition at line 349 of file seticontainer.cpp.

References QFile::close(), QString::find(), QString::isEmpty(), QString::left(), QString::length(), QFile::open(), QTextStream::readLine(), and QString::right().

QString SetiContainer::readEntry QStringList   list,
const QString   e
[static, protected]
 

Reads an entry given by e from the string list list.

Parameters:
list  A pointer to the string list containing a sah file.
e  The entry identifier string.
Returns:
The corresponding entry, or an empty string if the entry could not be found.

Definition at line 382 of file seticontainer.cpp.

References QString::find(), QString::length(), and QString::right().

void SetiContainer::initStateFileData   [protected]
 

Initializes all state file data members.

Definition at line 485 of file seticontainer.cpp.

References StateFileData::cpu, StateFileData::cr, StateFileData::fl, initWUScore(), StateFileData::max, StateFileData::ncfft, StateFileData::outfilepos, StateFileData::potactivity, StateFileData::potfreq, and StateFileData::prog.

Referenced by initAllData().

void SetiContainer::initWorkUnitData   [protected]
 

Initializes all work unit data members.

Definition at line 499 of file seticontainer.cpp.

References WorkUnitData::angle_range, WorkUnitData::coordinates, WorkUnitData::data_class, WorkUnitData::data_type, WorkUnitData::end_dec, WorkUnitData::end_ra, WorkUnitData::fft_len, WorkUnitData::ifft_len, WorkUnitData::name, WorkUnitData::nsamples, WorkUnitData::num_positions, WorkUnitData::receiver, WorkUnitData::splitter_version, WorkUnitData::start_dec, WorkUnitData::start_ra, WorkUnitData::subband_base, WorkUnitData::subband_center, WorkUnitData::subband_number, WorkUnitData::subband_sample_rate, WorkUnitData::tape_version, WorkUnitData::task, WorkUnitData::time_recorded, and WorkUnitData::version.

Referenced by initAllData().

void SetiContainer::initUserInfoData   [protected]
 

Initializes all user info data members.

Definition at line 527 of file seticontainer.cpp.

References UserInfoData::country, UserInfoData::email_addr, UserInfoData::id, UserInfoData::key, UserInfoData::last_result_time, UserInfoData::last_wu_time, UserInfoData::name, UserInfoData::nresults, UserInfoData::nwus, UserInfoData::params_index, UserInfoData::postal_code, UserInfoData::register_time, UserInfoData::show_email, UserInfoData::show_name, UserInfoData::total_cpu, UserInfoData::url, and UserInfoData::venue.

Referenced by initAllData().

void SetiContainer::scanStateFile bool    sig = true [protected]
 

Scans the state file and puts the data in the StateFileData structure.

Parameters:
sig  If true, Qt's signals are allowed to be emitted when necessary.

Definition at line 549 of file seticontainer.cpp.

References StateFileData::cpu, StateFileData::cr, StateFileData::fl, StateFileData::ncfft, StateFileData::outfilepos, StateFileData::potactivity, StateFileData::potfreq, StateFileData::prog, progressDecreased(), progressIncreased(), readEntry(), scanGaussianData(), scanPulseData(), scanSpikeData(), scanTripletData(), stateChanged(), QString::toDouble(), and QString::toInt().

Referenced by readStateFile().

void SetiContainer::scanSpikeData bool    sig = true [protected]
 

Scans the state file for spike data.

Parameters:
sig  If true, Qt's signals are allowed to be emitted when necessary.

Definition at line 600 of file seticontainer.cpp.

References SpikeScore::bin, SpikeScore::chirprate, SpikeScore::fft_index, SpikeScore::fft_len, StateFileData::max, newSpike(), SpikeScore::power, readEntry(), SpikeScore::score, WUScore::spike, QString::toDouble(), QString::toInt(), SpikeScore::wu_name, and wuName().

Referenced by scanStateFile().

void SetiContainer::scanGaussianData bool    sig = true [protected]
 

Scans the state file for basic Gaussian data.

Parameters:
sig  If true, Qt's signals are allowed to be emitted when necessary.

Definition at line 639 of file seticontainer.cpp.

References GaussianScore::bin, GaussianScore::chirprate, GaussianScore::chisq, GaussianScore::fft_index, GaussianScore::fft_len, WUScore::gaussian, StateFileData::max, newGaussian(), GaussianScore::power, readEntry(), scanGaussianGraphData(), GaussianScore::score, GaussianScore::sigma, QString::toDouble(), QString::toInt(), GaussianScore::true_mean, GaussianScore::wu_name, and wuName().

Referenced by scanStateFile().

void SetiContainer::scanPulseData bool    sig = true [protected]
 

Scans the state file for basic pulse data.

Parameters:
sig  If true, Qt's signals are allowed to be emitted when necessary.

Definition at line 706 of file seticontainer.cpp.

References PulseScore::chirprate, PulseScore::freq_bin, StateFileData::max, PulseScore::mean, newPulse(), PulseScore::period, PulseScore::power, WUScore::pulse, readEntry(), scanPulseGraphData(), PulseScore::score, PulseScore::time_bin, QString::toDouble(), QString::toInt(), PulseScore::wu_name, and wuName().

Referenced by scanStateFile().

void SetiContainer::scanTripletData bool    sig = true [protected]
 

Scans the state file for basic triplet data.

Parameters:
sig  If true, Qt's signals are allowed to be emitted when necessary.

Definition at line 774 of file seticontainer.cpp.

References TripletScore::bperiod, TripletScore::chirprate, TripletScore::fft_len, TripletScore::freq_bin, StateFileData::max, TripletScore::mean, newTriplet(), TripletScore::period, TripletScore::power, readEntry(), TripletScore::scale, scanTripletGraphData(), TripletScore::score, TripletScore::time_bin, QString::toDouble(), QString::toInt(), TripletScore::tpotind0_0, TripletScore::tpotind0_1, TripletScore::tpotind1_0, TripletScore::tpotind1_1, TripletScore::tpotind2_0, TripletScore::tpotind2_1, WUScore::triplet, TripletScore::wu_name, and wuName().

Referenced by scanStateFile().

void SetiContainer::scanGaussianGraphData   [protected]
 

Scans the state file for Gaussian graph data ('bg_pot xx').

Definition at line 693 of file seticontainer.cpp.

References GaussianScore::data, GaussianScore::data_len, WUScore::gaussian, StateFileData::max, readEntry(), and QString::toDouble().

Referenced by scanGaussianData().

bool SetiContainer::scanPulseGraphData   [protected]
 

Scans the state file for pulse graph data ('bp_pot').

Definition at line 757 of file seticontainer.cpp.

References PulseScore::data, PulseScore::data_len, StateFileData::max, WUScore::pulse, readDataString(), and readEntry().

Referenced by scanPulseData().

bool SetiContainer::scanTripletGraphData   [protected]
 

Scans the state file for triplet graph data ('bt_pot').

Definition at line 847 of file seticontainer.cpp.

References TripletScore::data, TripletScore::data_len, StateFileData::max, readDataString(), readEntry(), and WUScore::triplet.

Referenced by scanTripletData().

void SetiContainer::scanUserInfoData bool    sig = true [protected]
 

Scans the user info file and puts the data in the UserInfoData structure.

Parameters:
sig  If true, Qt's signals are allowed to be emitted when necessary.

Definition at line 891 of file seticontainer.cpp.

References UserInfoData::country, UserInfoData::email_addr, UserInfoData::id, UserInfoData::key, UserInfoData::last_result_time, UserInfoData::last_wu_time, UserInfoData::name, UserInfoData::nresults, UserInfoData::nwus, UserInfoData::params_index, UserInfoData::postal_code, readEntry(), UserInfoData::register_time, UserInfoData::show_email, UserInfoData::show_name, QString::toDouble(), QString::toInt(), UserInfoData::total_cpu, updatedUserInfoData(), UserInfoData::url, and UserInfoData::venue.

Referenced by readUserInfoFile().

void SetiContainer::scanWorkUnitData bool    sig = true [protected]
 

Scans the state file and puts the data in the stateFileData structure.

Parameters:
sig  If true, Qt's signals are allowed to be emitted when necessary.

Definition at line 967 of file seticontainer.cpp.

References WorkUnitData::angle_range, WorkUnitData::coordinates, WorkUnitData::data_class, WorkUnitData::data_type, WorkUnitData::end_dec, WorkUnitData::end_ra, WorkUnitData::fft_len, WorkUnitData::ifft_len, QString::isEmpty(), WorkUnitData::name, WorkUnitData::nsamples, WorkUnitData::num_positions, readEntry(), WorkUnitData::receiver, WorkUnitData::splitter_version, WorkUnitData::start_dec, WorkUnitData::start_ra, WorkUnitData::subband_base, WorkUnitData::subband_center, WorkUnitData::subband_number, WorkUnitData::subband_sample_rate, WorkUnitData::tape_version, WorkUnitData::task, WorkUnitData::time_recorded, QString::toDouble(), QString::toInt(), updatedWorkUnitData(), and WorkUnitData::version.

Referenced by readWorkUnitFile().

int SetiContainer::readClientVersion   [protected]
 

Returns the version number of the SETI@home client.

It is returned as an integer formed of both the major and the minor version number. Example: for client version 3.03, a 303 is returned.

Definition at line 1070 of file seticontainer.cpp.

References QFile::exists(), readEntry(), and QString::toInt().

Referenced by setDirectory(), and updateSahData().

void SetiContainer::initAllData bool    sig = false [protected]
 

Fills all data members (all structs) with zeros and reads the client's data from disk.

Parameters:
sig  If true, Qt's signals are allowed to be emitted when necessary.

Definition at line 94 of file seticontainer.cpp.

References initStateFileData(), initUserInfoData(), initWorkUnitData(), and updateSahData().

Referenced by checkClientState(), and setDirectory().

void SetiContainer::timerEvent QTimerEvent   e [protected, virtual]
 

The event handler for timer events.

This method is called when the internal refresh timer triggers the event to synchronize the internal data structures with the SETI@home files.

Reimplemented from QObject.

Definition at line 122 of file seticontainer.cpp.

References checkClientState(), checkClientStatePassive(), cpuTime(), QObject::killTimer(), remainingTime(), QObject::startTimer(), QTimerEvent::timerId(), and updateSahData().

int SetiContainer::checkClientState   [protected]
 

Checks the status of the client.

Returns:
One of the following values: Stopped, Running, Finished, or Loading.

Definition at line 1302 of file seticontainer.cpp.

References directory(), exists(), initAllData(), isClientRunning(), newWorkUnit(), StateFileData::prog, QFileInfo::size(), stateChanged(), and updateSahData().

Referenced by timerEvent().

int SetiContainer::getClientPid   [protected]
 

Retrieves the pid of the S@h client.

Returns:
The pid, or -1 on error.

Definition at line 1455 of file seticontainer.cpp.

References QFile::close(), directory(), QFile::exists(), QFileInfo::lastModified(), QFile::open(), and QDateTime::toString().

Referenced by isClientRunning(), and SetiLoc::startClient().

int SetiContainer::checkClientStatePassive   [protected]
 

This function is called every two minutes by a timer event.

It checks if the client has made any progress within the two minutes, and switches the state to Stopped if nothing has happened. This is needed for passive monitoring of remote clients on other computers, where no valid process id could be obtained.

Returns:
The current state of the client.

Definition at line 1522 of file seticontainer.cpp.

References StateFileData::prog, and stateChanged().

Referenced by timerEvent().

int SetiContainer::readDataString unsigned short int    data[],
QString   str,
int    cnt
[static, protected]
 

Reads cnt values from the data string str.

Parameters:
data  A pointer to the array where the converted shall be stored.
str  The string with data in hexadecimal form.
cnt  The number of data points to be read from the string.
Returns:
True if ok, false on error.

Definition at line 865 of file seticontainer.cpp.

References QTextStream::atEnd(), and QString::isEmpty().

Referenced by SetiLoc::loggedGaussianSignal(), SetiLoc::loggedPulseSignal(), SetiLoc::loggedTripletSignal(), scanPulseGraphData(), and scanTripletGraphData().

void SetiContainer::checkFileExistence   [protected]
 

No descriptions.

void SetiContainer::progressIncreased   [signal]
 

This signal is emitted when the client has updated the state file with new data.

Referenced by scanStateFile().

void SetiContainer::progressDecreased   [signal]
 

This signal is emitted when the progress value has been found to be decreased.

This is a rather unusual event, and should only happen when the client has started to reprocess the current work unit from the beginning (probably after updating the S@h client).

Referenced by scanStateFile().

void SetiContainer::newSpike SpikeScore    sps [signal]
 

This signal is emitted when a new high spike has been found in the work unit.

Parameters:
sps  The SpikeScore structure with the new data.

Referenced by scanSpikeData().

void SetiContainer::newGaussian GaussianScore    gas [signal]
 

This signal is emitted when a new high gaussian has been found in the work unit.

Parameters:
gas  The GaussianScore structure with the new data.

Referenced by scanGaussianData().

void SetiContainer::newPulse PulseScore    pus [signal]
 

This signal is emitted when a new high pulse has been found in the work unit.

Parameters:
pus  The PulseScore structure with the new data.

Referenced by scanPulseData().

void SetiContainer::newTriplet TripletScore    trs [signal]
 

This signal is emitted when a new high triplet has been found in the work unit.

Parameters:
trs  The TripletScore structure with the new data.

Referenced by scanTripletData().

void SetiContainer::newWorkUnit WorkUnitData    wud [signal]
 

This signal is emitted when a new work unit has been loaded.

Referenced by checkClientState().

void SetiContainer::updatedWorkUnitData   [signal]
 

This signal is emitted when the work unit data have changed during runtime for some reason, e.g.

after mounting a network share.

Referenced by scanWorkUnitData().

void SetiContainer::updatedUserInfoData   [signal]
 

This signal is emitted when the user info data have changed during runtime for some reason, e.g.

after mounting a network share.

Referenced by scanUserInfoData().

void SetiContainer::stateChanged int    state,
int    loadsize = 0
[signal]
 

This signal is emitted when the state of the client has changed.

Parameters:
state  The new state.
loadsize  If state is 'Loading', this parameter passes the current file size of the work unit being loaded. For all other states it is zero (not used).

Referenced by checkClientState(), checkClientStatePassive(), scanStateFile(), and updateSahData().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for Ksetiwatch API Version 2.6.1.
Documentation copyright © 2000-2003 Gordon Machel.
Generated on Fri Jun 6 00:28:56 2003 by doxygen 1.2.18, written by Dimitri van Heesch, © 1997-2002