|
|
|
|
|
|
|
|
#include <string> |
|
|
#include <string> |
|
|
#include <set> |
|
|
#include <set> |
|
|
|
|
|
|
|
|
using namespace std; |
|
|
|
|
|
|
|
|
namespace cd = codedweller; |
|
|
|
|
|
|
|
|
const unsigned long int HeaderDirectiveBypass = 0x00000001; // Bypass hd rule flag. |
|
|
const unsigned long int HeaderDirectiveBypass = 0x00000001; // Bypass hd rule flag. |
|
|
const unsigned long int HeaderDirectiveWhite = 0x00000002; // White hd rule flag. |
|
|
const unsigned long int HeaderDirectiveWhite = 0x00000002; // White hd rule flag. |
|
|
|
|
|
|
|
|
const unsigned long int HeaderDirectiveSource = 0x00000008; // Source rule flag. |
|
|
const unsigned long int HeaderDirectiveSource = 0x00000008; // Source rule flag. |
|
|
const unsigned long int HeaderDirectiveContext = 0x80000000; // Context activation flag. |
|
|
const unsigned long int HeaderDirectiveContext = 0x80000000; // Context activation flag. |
|
|
|
|
|
|
|
|
class HeaderDirectiveHandler : public Configurator { // Handle inputs to header directives. |
|
|
|
|
|
|
|
|
class HeaderDirectiveHandler : public cd::Configurator { // Handle inputs to header directives. |
|
|
public: |
|
|
public: |
|
|
|
|
|
|
|
|
HeaderDirectiveSet HeaderDirectives; // Managed set of Header Directives. |
|
|
HeaderDirectiveSet HeaderDirectives; // Managed set of Header Directives. |
|
|
|
|
|
|
|
|
void operator()(ConfigurationElement& E, ConfigurationData& D) { // The configurator call adds the Input. |
|
|
|
|
|
|
|
|
void operator()(cd::ConfigurationElement& E, cd::ConfigurationData& D) { // The configurator call adds the Input. |
|
|
|
|
|
|
|
|
if(HeaderDirectiveContext == ContextInput.Directive) { // If a context has been established |
|
|
if(HeaderDirectiveContext == ContextInput.Directive) { // If a context has been established |
|
|
ContextInput.Context = HeaderDirectives.size() + 1; // then setup the context ID and |
|
|
ContextInput.Context = HeaderDirectives.size() + 1; // then setup the context ID and |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class HeaderDirectiveInitializer : public Configurator { // Initializes Header Directives. |
|
|
|
|
|
|
|
|
class HeaderDirectiveInitializer : public cd::Configurator { // Initializes Header Directives. |
|
|
private: |
|
|
private: |
|
|
|
|
|
|
|
|
HeaderDirectiveHandler* MyTarget; // Needs to know it's target. |
|
|
HeaderDirectiveHandler* MyTarget; // Needs to know it's target. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setTarget(HeaderDirectiveHandler& H) { MyTarget = &H; } // We have a way to set the target though ;-) |
|
|
void setTarget(HeaderDirectiveHandler& H) { MyTarget = &H; } // We have a way to set the target though ;-) |
|
|
|
|
|
|
|
|
void operator()(ConfigurationElement& E, ConfigurationData& D) { // The configurator() function goes to the |
|
|
|
|
|
|
|
|
void operator()(cd::ConfigurationElement& E, cd::ConfigurationData& D) { // The configurator() function goes to the |
|
|
if(NULL!=MyTarget) { // target (if it's set) and pushes the |
|
|
if(NULL!=MyTarget) { // target (if it's set) and pushes the |
|
|
MyTarget->reset(); // reset button (empties the set). |
|
|
MyTarget->reset(); // reset button (empties the set). |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class HeaderDirectiveWhiteHeaderInitializer : public Configurator { // Initializes White Header Directives. |
|
|
|
|
|
|
|
|
class HeaderDirectiveWhiteHeaderInitializer : public cd::Configurator { // Initializes White Header Directives. |
|
|
private: |
|
|
private: |
|
|
|
|
|
|
|
|
HeaderDirectiveHandler* MyTarget; // Needs to know it's target. |
|
|
HeaderDirectiveHandler* MyTarget; // Needs to know it's target. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setTarget(HeaderDirectiveHandler& H) { MyTarget = &H; } // We have a way to set the target though ;-) |
|
|
void setTarget(HeaderDirectiveHandler& H) { MyTarget = &H; } // We have a way to set the target though ;-) |
|
|
|
|
|
|
|
|
void operator()(ConfigurationElement& E, ConfigurationData& D) { // The configurator() function goes to the |
|
|
|
|
|
|
|
|
void operator()(cd::ConfigurationElement& E, cd::ConfigurationData& D) { // The configurator() function goes to the |
|
|
if(NULL!=MyTarget) { // target (if it's set) and sets it up |
|
|
if(NULL!=MyTarget) { // target (if it's set) and sets it up |
|
|
MyTarget->ContextInput.clear(); // for a white header directive. |
|
|
MyTarget->ContextInput.clear(); // for a white header directive. |
|
|
MyTarget->DirectiveInput.clear(); |
|
|
MyTarget->DirectiveInput.clear(); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class HeaderDirectiveBypassHeaderInitializer : public Configurator { // Initializes Bypass Header Directives. |
|
|
|
|
|
|
|
|
class HeaderDirectiveBypassHeaderInitializer : public cd::Configurator { // Initializes Bypass Header Directives. |
|
|
private: |
|
|
private: |
|
|
|
|
|
|
|
|
HeaderDirectiveHandler* MyTarget; // Needs to know it's target. |
|
|
HeaderDirectiveHandler* MyTarget; // Needs to know it's target. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setTarget(HeaderDirectiveHandler& H) { MyTarget = &H; } // We have a way to set the target though ;-) |
|
|
void setTarget(HeaderDirectiveHandler& H) { MyTarget = &H; } // We have a way to set the target though ;-) |
|
|
|
|
|
|
|
|
void operator()(ConfigurationElement& E, ConfigurationData& D) { // The configurator() function goes to the |
|
|
|
|
|
|
|
|
void operator()(cd::ConfigurationElement& E, cd::ConfigurationData& D) { // The configurator() function goes to the |
|
|
if(NULL!=MyTarget) { // target (if it's set) and sets it up |
|
|
if(NULL!=MyTarget) { // target (if it's set) and sets it up |
|
|
MyTarget->ContextInput.clear(); // for a bypass header directive. |
|
|
MyTarget->ContextInput.clear(); // for a bypass header directive. |
|
|
MyTarget->DirectiveInput.clear(); |
|
|
MyTarget->DirectiveInput.clear(); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class HeaderDirectiveDrilldownInitializer : public Configurator { // Initializes Drilldown Header Directives. |
|
|
|
|
|
|
|
|
class HeaderDirectiveDrilldownInitializer : public cd::Configurator { // Initializes Drilldown Header Directives. |
|
|
private: |
|
|
private: |
|
|
|
|
|
|
|
|
HeaderDirectiveHandler* MyTarget; // Needs to know it's target. |
|
|
HeaderDirectiveHandler* MyTarget; // Needs to know it's target. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setTarget(HeaderDirectiveHandler& H) { MyTarget = &H; } // We have a way to set the target though ;-) |
|
|
void setTarget(HeaderDirectiveHandler& H) { MyTarget = &H; } // We have a way to set the target though ;-) |
|
|
|
|
|
|
|
|
void operator()(ConfigurationElement& E, ConfigurationData& D) { // The configurator() function goes to the |
|
|
|
|
|
|
|
|
void operator()(cd::ConfigurationElement& E, cd::ConfigurationData& D) { // The configurator() function goes to the |
|
|
if(NULL!=MyTarget) { // target (if it's set) and sets it up for |
|
|
if(NULL!=MyTarget) { // target (if it's set) and sets it up for |
|
|
MyTarget->ContextInput.clear(); // a drilldown header directive. |
|
|
MyTarget->ContextInput.clear(); // a drilldown header directive. |
|
|
MyTarget->DirectiveInput.clear(); |
|
|
MyTarget->DirectiveInput.clear(); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class HeaderDirectiveSourceHeaderInitializer : public Configurator { // Initializes Source Header Directives. |
|
|
|
|
|
|
|
|
class HeaderDirectiveSourceHeaderInitializer : public cd::Configurator { // Initializes Source Header Directives. |
|
|
private: |
|
|
private: |
|
|
|
|
|
|
|
|
HeaderDirectiveHandler* MyTarget; // Needs to know it's target. |
|
|
HeaderDirectiveHandler* MyTarget; // Needs to know it's target. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setTarget(HeaderDirectiveHandler& H) { MyTarget = &H; } // We have a way to set the target though ;-) |
|
|
void setTarget(HeaderDirectiveHandler& H) { MyTarget = &H; } // We have a way to set the target though ;-) |
|
|
|
|
|
|
|
|
void operator()(ConfigurationElement& E, ConfigurationData& D) { // The configurator() function goes to the |
|
|
|
|
|
|
|
|
void operator()(cd::ConfigurationElement& E, cd::ConfigurationData& D) { // The configurator() function goes to the |
|
|
if(NULL!=MyTarget) { // target (if it's set) and sets it up |
|
|
if(NULL!=MyTarget) { // target (if it's set) and sets it up |
|
|
MyTarget->ContextInput.clear(); // for a context sensitive source header |
|
|
MyTarget->ContextInput.clear(); // for a context sensitive source header |
|
|
MyTarget->DirectiveInput.clear(); // directive. Activation context as well |
|
|
MyTarget->DirectiveInput.clear(); // directive. Activation context as well |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class RangeHandler : public Configurator { // The handler adds edgepoints and holds and |
|
|
|
|
|
|
|
|
class RangeHandler : public cd::Configurator { // The handler adds edgepoints and holds and |
|
|
public: // tests the set that defines the region. |
|
|
public: // tests the set that defines the region. |
|
|
|
|
|
|
|
|
void operator()(ConfigurationElement& E, ConfigurationData& D) { // The () operator adds EdgeInput to the list. |
|
|
|
|
|
|
|
|
void operator()(cd::ConfigurationElement& E, cd::ConfigurationData& D) { // The () operator adds EdgeInput to the list. |
|
|
EdgeMap.insert(EdgeInput); |
|
|
EdgeMap.insert(EdgeInput); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class RangeInitializer : public Configurator { // The RangeInitializer Configurator. |
|
|
|
|
|
|
|
|
class RangeInitializer : public cd::Configurator { // The RangeInitializer Configurator. |
|
|
private: |
|
|
private: |
|
|
|
|
|
|
|
|
RangeHandler* MyTarget; // Needs to know it's target. |
|
|
RangeHandler* MyTarget; // Needs to know it's target. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setTarget(RangeHandler& H) { MyTarget = &H; } // We have a way to set the target though ;-) |
|
|
void setTarget(RangeHandler& H) { MyTarget = &H; } // We have a way to set the target though ;-) |
|
|
|
|
|
|
|
|
void operator()(ConfigurationElement& E, ConfigurationData& D) { // The configurator() function goes to the |
|
|
|
|
|
|
|
|
void operator()(cd::ConfigurationElement& E, cd::ConfigurationData& D) { // The configurator() function goes to the |
|
|
if(NULL!=MyTarget) { // target (if it's set) and pushes the |
|
|
if(NULL!=MyTarget) { // target (if it's set) and pushes the |
|
|
MyTarget->reset(); // reset button. |
|
|
MyTarget->reset(); // reset button. |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class IntegerSetHandler : public Configurator { // Integer set handler for rule panics. |
|
|
|
|
|
|
|
|
class IntegerSetHandler : public cd::Configurator { // Integer set handler for rule panics. |
|
|
public: |
|
|
public: |
|
|
void operator()(ConfigurationElement& E, ConfigurationData& D) { // The operator() inserts IntegerInput |
|
|
|
|
|
|
|
|
void operator()(cd::ConfigurationElement& E, cd::ConfigurationData& D) { // The operator() inserts IntegerInput |
|
|
IntegerSet.insert(IntegerInput); // if it's not already a member. |
|
|
IntegerSet.insert(IntegerInput); // if it's not already a member. |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void reset() { IntegerSet.clear(); } // How to reset (clear) the list. |
|
|
void reset() { IntegerSet.clear(); } // How to reset (clear) the list. |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class IntegerSetInitializer : public Configurator { // The initializer resets the set. |
|
|
|
|
|
|
|
|
class IntegerSetInitializer : public cd::Configurator { // The initializer resets the set. |
|
|
private: |
|
|
private: |
|
|
|
|
|
|
|
|
IntegerSetHandler* MyTarget; // It needs to know which set to init. |
|
|
IntegerSetHandler* MyTarget; // It needs to know which set to init. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setTarget(IntegerSetHandler& H) { MyTarget = &H; } // Set a pointer to the handler. |
|
|
void setTarget(IntegerSetHandler& H) { MyTarget = &H; } // Set a pointer to the handler. |
|
|
|
|
|
|
|
|
void operator()(ConfigurationElement& E, ConfigurationData& D) { // The operator() does the trick. |
|
|
|
|
|
|
|
|
void operator()(cd::ConfigurationElement& E, cd::ConfigurationData& D) { // The operator() does the trick. |
|
|
if(NULL!=MyTarget) { |
|
|
if(NULL!=MyTarget) { |
|
|
MyTarget->reset(); |
|
|
MyTarget->reset(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} // in this case. |
|
|
} // in this case. |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class XHDRSymbolsHandler : public Configurator { // XHDRSymbol hander. |
|
|
|
|
|
|
|
|
class XHDRSymbolsHandler : public cd::Configurator { // XHDRSymbol hander. |
|
|
public: |
|
|
public: |
|
|
set<XHDRSymbol> SymbolHeaders; // Carries a set of Symbol Headers. |
|
|
set<XHDRSymbol> SymbolHeaders; // Carries a set of Symbol Headers. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int Symbol; // Input Symbol value. |
|
|
int Symbol; // Input Symbol value. |
|
|
string Header; // Input Header value. |
|
|
string Header; // Input Header value. |
|
|
|
|
|
|
|
|
void operator()(ConfigurationElement& E, ConfigurationData& D) { // The operator() inserts an XHDRSymbol |
|
|
|
|
|
|
|
|
void operator()(cd::ConfigurationElement& E, cd::ConfigurationData& D) { // The operator() inserts an XHDRSymbol |
|
|
if(OnOff) { // if the header entry is turned on and |
|
|
if(OnOff) { // if the header entry is turned on and |
|
|
SymbolHeaders.insert(XHDRSymbol(Symbol, Header)); // if it's not already a member. |
|
|
SymbolHeaders.insert(XHDRSymbol(Symbol, Header)); // if it's not already a member. |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class XHDRSymbolsInitializer : public Configurator { // The XHDRSymbols initializer. |
|
|
|
|
|
|
|
|
class XHDRSymbolsInitializer : public cd::Configurator { // The XHDRSymbols initializer. |
|
|
private: |
|
|
private: |
|
|
|
|
|
|
|
|
XHDRSymbolsHandler* MyTarget; // It needs to know which set to init. |
|
|
XHDRSymbolsHandler* MyTarget; // It needs to know which set to init. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void setTarget(XHDRSymbolsHandler& H) { MyTarget = &H; } // Set a pointer to the handler. |
|
|
void setTarget(XHDRSymbolsHandler& H) { MyTarget = &H; } // Set a pointer to the handler. |
|
|
|
|
|
|
|
|
void operator()(ConfigurationElement& E, ConfigurationData& D) { // The operator() does the trick. |
|
|
|
|
|
|
|
|
void operator()(cd::ConfigurationElement& E, cd::ConfigurationData& D) { // The operator() does the trick. |
|
|
if(NULL!=MyTarget) { |
|
|
if(NULL!=MyTarget) { |
|
|
MyTarget->reset(); |
|
|
MyTarget->reset(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
class snfCFGData { // Object that stores our config data. |
|
|
class snfCFGData { // Object that stores our config data. |
|
|
private: |
|
|
private: |
|
|
|
|
|
|
|
|
ConfigurationElement MyCFGReader; // This is how we read our cfg data. |
|
|
|
|
|
|
|
|
cd::ConfigurationElement MyCFGReader; // This is how we read our cfg data. |
|
|
|
|
|
|
|
|
public: |
|
|
public: |
|
|
|
|
|
|