Skip to content
Snippets Groups Projects
Commit 8668a194 authored by Oliver Bock's avatar Oliver Bock
Browse files

New class added

* BOINCClientAdapter is responsible for all communication with the BOINC infrastructure
-> the core client
-> the Einstein@Home application
parent 308333b5
No related branches found
No related tags found
No related merge requests found
#include "BOINCClientAdapter.h"
BOINCClientAdapter::BOINCClientAdapter()
{
updateUserInfo();
m_SharedMemoryArea = (char*) boinc_graphics_get_shmem(EAH_SHMEM_APP_NAME);
if(m_SharedMemoryArea) {
updateSharedMemoryArea();
m_SharedMemoryAreaAvailable = true;
}
else {
m_SharedMemoryAreaAvailable = false;
}
}
BOINCClientAdapter::~BOINCClientAdapter()
{
}
void BOINCClientAdapter::updateUserInfo()
{
boinc_get_init_data(m_UserData);
}
void BOINCClientAdapter::updateSharedMemoryArea()
{
if(m_SharedMemoryArea) {
if(3 != sscanf( (char*)shmem,
" <graphics_info> \n"
" <skypos_rac> %f </skypos_rac> \n"
" <skypos_dec> %f </skypos_dec> \n"
" <fraction_done> %f </fraction_done> \n",
&m_SkyPosRightAscension,
&m_SkyPosDeclination,
&m_WUFractionDone))
{
cerr << "Incompatible shared memory data encountered!" << endl;
}
}
}
string BOINCClientAdapter::getCoreVersion() const
{
// int major_version;int minor_version;int release;
}
string BOINCClientAdapter::getApplicationName() const
{
}
string BOINCClientAdapter::getApplicationVersion() const
{
}
string BOINCClientAdapter::getUserName() const
{
}
string BOINCClientAdapter::getTeamName() const
{
}
double BOINCClientAdapter::getUserCredit() const
{
}
double BOINCClientAdapter::getUserRACredit() const
{
}
double BOINCClientAdapter::getHostCredit() const
{
}
double BOINCClientAdapter::getHostRACredit() const
{
}
string BOINCClientAdapter::getWUName() const
{
}
double BOINCClientAdapter::getWUCPUTime() const
{
}
double BOINCClientAdapter::getWUFPOpsEstimated() const
{
}
double BOINCClientAdapter::getWUFPOpsBound() const
{
}
double BOINCClientAdapter::getWUMemoryBound() const
{
}
double BOINCClientAdapter::getWUDiskBound() const
{
}
#ifndef BOINCCLIENTADAPTER_H_
#define BOINCCLIENTADAPTER_H_
#include <string>
#include "boinc_api.h"
#include "graphics2.h"
#define EAH_SHMEM_APP_NAME "EinsteinHS"
class BOINCClientAdapter
{
public:
BOINCClientAdapter();
virtual ~BOINCClientAdapter();
string getCoreVersion() const;
string getApplicationName() const;
string getApplicationVersion() const;
string getUserName() const;
string getTeamName() const;
double getUserCredit() const;
double getUserRACredit() const;
double getHostCredit() const;
double getHostRACredit() const;
string getWUName() const;
double getWUCPUTime() const;
double getWUFPOpsEstimated() const;
double getWUFPOpsBound() const;
double getWUMemoryBound() const;
double getWUDiskBound() const;
private:
void updateUserInfo();
void updateSharedMemoryArea();
char *m_SharedMemoryArea;
bool m_SharedMemoryAreaAvailable;
APP_INIT_DATA m_UserData;
float m_SkyPosRightAscension;
float m_SkyPosDeclination;
float m_WUFractionDone;
};
#endif /*BOINCCLIENTADAPTER_H_*/
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment