|
|
|
|
|
|
|
|
// Communications are well formed xml snippets. |
|
|
// Communications are well formed xml snippets. |
|
|
// See snf_sync.xml for examples. |
|
|
// See snf_sync.xml for examples. |
|
|
|
|
|
|
|
|
#ifndef snf_sync_included |
|
|
|
|
|
#define snf_sync_included |
|
|
|
|
|
|
|
|
#pragma once |
|
|
|
|
|
|
|
|
#include <list> |
|
|
#include <list> |
|
|
#include <cstring> |
|
|
#include <cstring> |
|
|
|
|
|
|
|
|
#include "../CodeDweller/networking.hpp" |
|
|
#include "../CodeDweller/networking.hpp" |
|
|
#include "../CodeDweller/configuration.hpp" |
|
|
#include "../CodeDweller/configuration.hpp" |
|
|
|
|
|
|
|
|
class GBUAlertHandler : public Configurator { |
|
|
|
|
|
|
|
|
namespace cd = codedweller; |
|
|
|
|
|
|
|
|
|
|
|
class GBUAlertHandler : public cd::Configurator { |
|
|
public: |
|
|
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. |
|
|
void reset(); // Resets the list for a new run. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int Alert_g; // g='0' |
|
|
int Alert_g; // g='0' |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class GBUAlertInitializer : public Configurator { |
|
|
|
|
|
|
|
|
class GBUAlertInitializer : public cd::Configurator { |
|
|
private: |
|
|
private: |
|
|
GBUAlertHandler* MyHandler; // Handler to reset. |
|
|
GBUAlertHandler* MyHandler; // Handler to reset. |
|
|
|
|
|
|
|
|
public: |
|
|
public: |
|
|
GBUAlertInitializer() { MyHandler = NULL; } // Init safely with null. |
|
|
GBUAlertInitializer() { MyHandler = NULL; } // Init safely with null. |
|
|
void link(GBUAlertHandler& H) { MyHandler = &H; } // Link to my handler. |
|
|
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 |
|
|
if(NULL != MyHandler) { // If I know where it is |
|
|
MyHandler->reset(); // I hit the reset button. |
|
|
MyHandler->reset(); // I hit the reset button. |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class snf_sync { |
|
|
class snf_sync { |
|
|
private: |
|
|
private: |
|
|
ConfigurationElement Reader; // Our reader. |
|
|
|
|
|
|
|
|
cd::ConfigurationElement Reader; // Our reader. |
|
|
void SetupReader(); // Configure the 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. |
|
|
bool ReadWasGood; // flag at the end of the snf element. |
|
|
void construct(); // Encapsulate the initial construction. |
|
|
void construct(); // Encapsulate the initial construction. |
|
|
void reset(); // Reset/initialize for the next read. |
|
|
void reset(); // Reset/initialize for the next read. |
|
|
|
|
|
|
|
|
GBUAlertInitializer ServerGBUAlertInitializer; |
|
|
GBUAlertInitializer ServerGBUAlertInitializer; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|