|
|
@@ -6,8 +6,7 @@ |
|
|
|
// Communications are well formed xml snippets. |
|
|
|
// See snf_sync.xml for examples. |
|
|
|
|
|
|
|
#ifndef snf_sync_included |
|
|
|
#define snf_sync_included |
|
|
|
#pragma once |
|
|
|
|
|
|
|
#include <list> |
|
|
|
#include <cstring> |
|
|
@@ -15,9 +14,11 @@ |
|
|
|
#include "../CodeDweller/networking.hpp" |
|
|
|
#include "../CodeDweller/configuration.hpp" |
|
|
|
|
|
|
|
class GBUAlertHandler : public Configurator { |
|
|
|
namespace cd = codedweller; |
|
|
|
|
|
|
|
class GBUAlertHandler : public cd::Configurator { |
|
|
|
public: |
|
|
|
virtual void operator()(ConfigurationElement& E, ConfigurationData& D); // Add an alert handler :-) |
|
|
|
virtual void operator()(cd::ConfigurationElement& E, cd::ConfigurationData& D); // Add an alert handler :-) |
|
|
|
|
|
|
|
void reset(); // Resets the list for a new run. |
|
|
|
|
|
|
@@ -32,14 +33,14 @@ class GBUAlertHandler : public Configurator { |
|
|
|
int Alert_g; // g='0' |
|
|
|
}; |
|
|
|
|
|
|
|
class GBUAlertInitializer : public Configurator { |
|
|
|
class GBUAlertInitializer : public cd::Configurator { |
|
|
|
private: |
|
|
|
GBUAlertHandler* MyHandler; // Handler to reset. |
|
|
|
|
|
|
|
public: |
|
|
|
GBUAlertInitializer() { MyHandler = NULL; } // Init safely with null. |
|
|
|
void link(GBUAlertHandler& H) { MyHandler = &H; } // Link to my handler. |
|
|
|
virtual void operator()(ConfigurationElement& E, ConfigurationData& D) { // Add an alert handler :-) |
|
|
|
virtual void operator()(cd::ConfigurationElement& E, cd::ConfigurationData& D) { // Add an alert handler :-) |
|
|
|
if(NULL != MyHandler) { // If I know where it is |
|
|
|
MyHandler->reset(); // I hit the reset button. |
|
|
|
} |
|
|
@@ -48,9 +49,9 @@ class GBUAlertInitializer : public Configurator { |
|
|
|
|
|
|
|
class snf_sync { |
|
|
|
private: |
|
|
|
ConfigurationElement Reader; // Our reader. |
|
|
|
cd::ConfigurationElement Reader; // Our reader. |
|
|
|
void SetupReader(); // Configure the reader. |
|
|
|
ConfiguratorSetTrueOnComplete SNFWasParsed; // Configurator sets the ReadWasGood |
|
|
|
cd::ConfiguratorSetTrueOnComplete SNFWasParsed; // Configurator sets the ReadWasGood |
|
|
|
bool ReadWasGood; // flag at the end of the snf element. |
|
|
|
void construct(); // Encapsulate the initial construction. |
|
|
|
void reset(); // Reset/initialize for the next read. |
|
|
@@ -81,5 +82,3 @@ class snf_sync { |
|
|
|
GBUAlertInitializer ServerGBUAlertInitializer; |
|
|
|
}; |
|
|
|
|
|
|
|
#endif |
|
|
|
|