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

Fixed BOINC information update

* The interface declared in AbstractGraphicsEngine is now implemented in the most specialized class only (to make sure it's called, down the inheritance hierarchy)
* The abstract or generelized classes (up the hierarchy) got local implementation (protected) which are called by their respective children.
* Fixed a bug in the old starsphere code. Search marker rendering deleted to much (memory corruption)! Does OpenGL do any boundary checking?
parent a352cbc9
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,7 @@ AbstractGraphicsEngine::~AbstractGraphicsEngine()
{
}
void AbstractGraphicsEngine::refreshBOINCInformation()
void AbstractGraphicsEngine::refreshLocalBOINCInformation()
{
m_BoincAdapter.refresh();
}
......@@ -133,10 +133,13 @@ public:
/**
* \brief This method is called when the BOINC client information should be updated
*
* When you inherit from this class and override this method, please make sure you call this (base)
* method anyway as it already has a default implementation which refreshes \ref m_BoincAdapter.
* When you inherit from this class and implement this method, please make sure you call
* \ref refreshLocalBOINCInformation() to invoke the generic default implementation which
* refreshes \ref m_BoincAdapter.
*
* \see refreshLocalBOINCInformation()
*/
virtual void refreshBOINCInformation();
virtual void refreshBOINCInformation() = 0;
protected:
/**
......@@ -146,6 +149,15 @@ protected:
*/
AbstractGraphicsEngine();
/**
* \brief This method has to be called in order to update the BOINC client information
*
* This is the local/generic implementation which refreshes \ref m_BoincAdapter.
*
* \see refreshBOINCInformation()
*/
virtual void refreshLocalBOINCInformation();
/// BOINC client adapter instance for information retrieval
BOINCClientAdapter m_BoincAdapter;
};
......
......@@ -23,7 +23,10 @@ void BOINCClientAdapter::initialize(string sharedMemoryIdentifier)
void BOINCClientAdapter::refresh()
{
if(m_Initialized) {
readUserInfo();
readSharedMemoryArea();
/// \todo Check that we're still watching our own WU (or science app)!
}
else {
cerr << "The BOINC Client Adapter has not yet been initialized!";
......
......@@ -379,9 +379,9 @@ void Starsphere::make_search_marker(GLfloat RAdeg, GLfloat DEdeg, GLfloat size)
// r1 is inner circle, r2 is outer circle, r3 is crosshairs
r1 = size, r2=3*size, r3=4*size;
// delete any existing marker, then create a new one
// delete existing marker, then create a new one
if (SearchMarker) {
glDeleteLists(SearchMarker, SearchMarker);
glDeleteLists(SearchMarker, 1);
}
SearchMarker = glGenLists(1);
......@@ -432,8 +432,8 @@ void Starsphere::make_search_marker(GLfloat RAdeg, GLfloat DEdeg, GLfloat size)
// West arm:
sphVertex(+r1, 0.0);
sphVertex(+r3, 0.0);
glEnd();
glPopMatrix();
// searchlight line out to marker (OFF!)
......@@ -896,10 +896,10 @@ bool Starsphere::isFeature(const Features feature)
return ((featureFlags & feature) == feature ? true : false);
}
void Starsphere::refreshBOINCInformation()
void Starsphere::refreshLocalBOINCInformation()
{
// call base class implementation
AbstractGraphicsEngine::refreshBOINCInformation();
AbstractGraphicsEngine::refreshLocalBOINCInformation();
// prepare conversion buffer
stringstream buffer;
......
......@@ -90,11 +90,6 @@ public:
const AbstractGraphicsEngine::MouseButton buttonPressed);
void keyboardPressEvent(const AbstractGraphicsEngine::KeyBoardKey keyPressed);
/**
* \brief This method is called when the BOINC client information should be updated
*/
virtual void refreshBOINCInformation();
protected:
/**
* \brief Default contructor
......@@ -114,6 +109,16 @@ protected:
*/
virtual void renderSearchInformation() = 0;
/**
* \brief This method has to be called in order to update the BOINC client information
*
* This is the local/generic implementation which calls
* AbstractGraphicsEngine::refreshLocalBOINCInformation() first and
* refreshes the "BOINC Statistics" afterwards.
*
* \see AbstractGraphicsEngine::refreshLocalBOINCInformation()
*/
virtual void refreshLocalBOINCInformation();
// resource handling
OGLFT::TranslucentTexture* m_FontLogo1;
......
......@@ -32,7 +32,11 @@ void StarsphereS5R3::resize(const int width, const int height)
void StarsphereS5R3::refreshBOINCInformation()
{
Starsphere::refreshBOINCInformation();
// call base class implementation
Starsphere::refreshLocalBOINCInformation();
// update local/specific content
m_EinsteinAdapter.refresh();
// prepare conversion buffer
stringstream buffer;
......
......@@ -57,8 +57,12 @@ public:
/**
* \brief This method is called when the BOINC client information should be updated
*
* As this method overrides its parent's implementation, it calls Starsphere::refreshBOINCInformation()
* first in order to "add" the sepcialized parts afterwards.
* This method implements AbstractGraphicsEngine::refreshBOINCInformation() and calls
* Starsphere::refreshLocalBOINCInformation() first and "adds" the sepcialized
* parts afterwards.
*
* \see AbstractGraphicsEngine::refreshBOINCInformation()
* \see Starsphere::refreshLocalBOINCInformation()
*/
void refreshBOINCInformation();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment