Skip to content
Snippets Groups Projects
Select Git revision
  • master default
  • mingw_gcc44
  • release_ABP1_012
  • release_ABP1_008
  • release_ABP1_006
  • release_ABP1_007
  • release_ABP1_005
  • release_ABP1_004
  • release_ABP1_003
  • pre_release_0.15
  • release_ABP1_001
  • release_ABP1_002
  • pre_release_0.13
  • pre_release_0.14
  • pre_release_0.11
  • pre_release_0.12
  • pre_release_0.10
  • pre_release_0.09
  • pre_release_0.08
19 results

EinsteinS5R3Adapter.cpp

Blame
  • Forked from einsteinathome / graphicsframework
    247 commits behind the upstream repository.
    • Oliver Bock's avatar
      97a1dc47
      Refactored the BOINC client/application communication layer · 97a1dc47
      Oliver Bock authored
      * Now there's a generic and science application specific (e.g. shared memory handling) part
      * The actual shared memory indentifier now has to be passed during initialize() instead of being hard-coded
      * All this might eventually allow us to incorporate some portions of this API into something more general like a generic graphics toolkit
      97a1dc47
      History
      Refactored the BOINC client/application communication layer
      Oliver Bock authored
      * Now there's a generic and science application specific (e.g. shared memory handling) part
      * The actual shared memory indentifier now has to be passed during initialize() instead of being hard-coded
      * All this might eventually allow us to incorporate some portions of this API into something more general like a generic graphics toolkit
    EinsteinS5R3Adapter.cpp 1.38 KiB
    #include "EinsteinS5R3Adapter.h"
    
    EinsteinS5R3Adapter::EinsteinS5R3Adapter(BOINCClientAdapter *boincClient)
    {
    	this->boincClient = boincClient;
    	
    	m_WUSkyPosRightAscension = 0.0;
    	m_WUSkyPosDeclination = 0.0;
    	m_WUFractionDone = 0.0;
    	m_WUCPUTime = 0.0;
    }
    
    EinsteinS5R3Adapter::~EinsteinS5R3Adapter()
    {
    }
    
    void EinsteinS5R3Adapter::refresh()
    {
    	boincClient->refresh();
    	parseApplicationInformation();
    }
    
    void EinsteinS5R3Adapter::parseApplicationInformation()
    {
    	// get updated application information
    	string info = boincClient->applicationInformation();
    	
    	// do we have any data?
    	if(info.length() > 0) {
    		
    		// parse data into members
    		if(4 != sscanf(info.c_str(),
    			  		"<graphics_info>\n"
    			  		"  <skypos_rac>%lf</skypos_rac>\n"
    			  		"  <skypos_dec>%lf</skypos_dec>\n"
    			  		"  <fraction_done>%lf</fraction_done>\n"
    			  		"  <cpu_time>%lf</cpu_time>\n",
    			  		&m_WUSkyPosRightAscension,
    			  		&m_WUSkyPosDeclination,
    			  		&m_WUFractionDone,
    			  		&m_WUCPUTime))
    		{		 
    			cerr << "Incompatible shared memory data encountered!" << endl;
    		}
    	}
    }
    
    double EinsteinS5R3Adapter::wuSkyPosRightAscension() const
    {
    	return m_WUSkyPosRightAscension;
    }
    
    double EinsteinS5R3Adapter::wuSkyPosDeclination() const
    {
    	return m_WUSkyPosDeclination;
    }
    
    double EinsteinS5R3Adapter::wuFractionDone() const
    {
    	return m_WUFractionDone;
    }
    
    double EinsteinS5R3Adapter::wuCPUTime() const
    {
    	return m_WUCPUTime;
    }