From 75d723d268f76c97cc483c3196ad84cdd4f4667c Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Thu, 20 Nov 2014 22:29:09 +0100 Subject: [PATCH] add compare structures to data objects --- alib2data/src/alphabet/BarSymbol.h | 11 ++++++++ alib2data/src/alphabet/BlankSymbol.h | 11 ++++++++ .../src/alphabet/BottomOfTheStackSymbol.h | 11 ++++++++ alib2data/src/alphabet/EndSymbol.h | 11 ++++++++ alib2data/src/alphabet/LabeledSymbol.h | 11 ++++++++ alib2data/src/alphabet/RankedBarSymbol.h | 11 ++++++++ alib2data/src/alphabet/RankedSymbol.h | 11 ++++++++ .../src/alphabet/SubtreeWildcardSymbol.h | 11 ++++++++ alib2data/src/alphabet/SymbolBase.h | 11 ++++++++ alib2data/src/automaton/AutomatonBase.h | 11 ++++++++ alib2data/src/automaton/FSM/CompactNFA.cpp | 26 +++++++++++++------ alib2data/src/automaton/FSM/CompactNFA.h | 11 ++++++++ alib2data/src/automaton/FSM/DFA.h | 11 ++++++++ alib2data/src/automaton/FSM/EpsilonNFA.h | 11 ++++++++ alib2data/src/automaton/FSM/ExtendedNFA.h | 11 ++++++++ .../src/automaton/FSM/MultiInitialStateNFA.h | 11 ++++++++ alib2data/src/automaton/FSM/NFA.h | 11 ++++++++ alib2data/src/automaton/PDA/DPDA.h | 11 ++++++++ alib2data/src/automaton/PDA/InputDrivenNPDA.h | 11 ++++++++ alib2data/src/automaton/PDA/NPDA.h | 11 ++++++++ .../PDA/RealTimeHeightDeterministicDPDA.h | 11 ++++++++ .../PDA/RealTimeHeightDeterministicNPDA.h | 11 ++++++++ alib2data/src/automaton/PDA/SinglePopDPDA.h | 11 ++++++++ alib2data/src/automaton/PDA/SinglePopNPDA.h | 11 ++++++++ .../src/automaton/PDA/VisiblyPushdownDPDA.h | 11 ++++++++ .../src/automaton/PDA/VisiblyPushdownNPDA.h | 11 ++++++++ alib2data/src/automaton/TM/OneTapeDTM.h | 11 ++++++++ alib2data/src/container/ContainerBase.h | 11 ++++++++ alib2data/src/container/ObjectsMap.h | 11 ++++++++ alib2data/src/container/ObjectsPair.h | 11 ++++++++ alib2data/src/container/ObjectsSet.h | 11 ++++++++ alib2data/src/container/ObjectsVector.h | 11 ++++++++ alib2data/src/exception/AlibException.h | 11 ++++++++ alib2data/src/grammar/ContextFree/CFG.h | 11 ++++++++ alib2data/src/grammar/ContextFree/CNF.h | 11 ++++++++ .../src/grammar/ContextFree/EpsilonFreeCFG.h | 11 ++++++++ alib2data/src/grammar/ContextFree/GNF.h | 11 ++++++++ alib2data/src/grammar/ContextFree/LG.h | 11 ++++++++ alib2data/src/grammar/ContextSensitive/CSG.h | 11 ++++++++ .../ContextSensitive/NonContractingGrammar.h | 11 ++++++++ alib2data/src/grammar/GrammarBase.h | 11 ++++++++ alib2data/src/grammar/Regular/LeftLG.h | 11 ++++++++ alib2data/src/grammar/Regular/LeftRG.h | 11 ++++++++ alib2data/src/grammar/Regular/RightLG.h | 11 ++++++++ alib2data/src/grammar/Regular/RightRG.h | 11 ++++++++ .../ContextPreservingUnrestrictedGrammar.h | 11 ++++++++ .../Unrestricted/UnrestrictedGrammar.h | 11 ++++++++ alib2data/src/label/HexavigesimalLabel.h | 11 ++++++++ alib2data/src/label/LabelBase.h | 11 ++++++++ alib2data/src/label/LabelPairLabel.h | 11 ++++++++ alib2data/src/label/LabelSetLabel.h | 11 ++++++++ alib2data/src/label/ObjectLabel.h | 11 ++++++++ alib2data/src/label/PrimitiveLabel.h | 11 ++++++++ alib2data/src/object/Void.h | 11 ++++++++ alib2data/src/primitive/Character.h | 11 ++++++++ alib2data/src/primitive/Integer.h | 11 ++++++++ alib2data/src/primitive/PrimitiveBase.h | 11 ++++++++ alib2data/src/primitive/String.h | 11 ++++++++ alib2data/src/regexp/RegExpBase.h | 11 ++++++++ alib2data/src/regexp/formal/FormalRegExp.h | 11 ++++++++ .../src/regexp/unbounded/UnboundedRegExp.h | 11 ++++++++ alib2data/src/std/compare.hpp | 2 +- alib2data/src/string/CyclicString.h | 11 ++++++++ alib2data/src/string/Epsilon.h | 11 ++++++++ alib2data/src/string/LinearString.h | 11 ++++++++ alib2data/src/string/StringBase.h | 11 ++++++++ 66 files changed, 723 insertions(+), 9 deletions(-) diff --git a/alib2data/src/alphabet/BarSymbol.h b/alib2data/src/alphabet/BarSymbol.h index 1368321a3c..8c0a0504d4 100644 --- a/alib2data/src/alphabet/BarSymbol.h +++ b/alib2data/src/alphabet/BarSymbol.h @@ -42,4 +42,15 @@ public: } /* namespace alphabet */ +namespace std { + +template<> +struct compare<alphabet::BarSymbol> { + int operator()(const alphabet::BarSymbol& first, const alphabet::BarSymbol& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* BAR_SYMBOL_H_ */ diff --git a/alib2data/src/alphabet/BlankSymbol.h b/alib2data/src/alphabet/BlankSymbol.h index 962095050e..29d0a20a09 100644 --- a/alib2data/src/alphabet/BlankSymbol.h +++ b/alib2data/src/alphabet/BlankSymbol.h @@ -42,4 +42,15 @@ public: } /* namespace alphabet */ +namespace std { + +template<> +struct compare<alphabet::BlankSymbol> { + int operator()(const alphabet::BlankSymbol& first, const alphabet::BlankSymbol& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* BLANK_SYMBOL_H_ */ diff --git a/alib2data/src/alphabet/BottomOfTheStackSymbol.h b/alib2data/src/alphabet/BottomOfTheStackSymbol.h index 3494fcbf27..af7f4c569a 100644 --- a/alib2data/src/alphabet/BottomOfTheStackSymbol.h +++ b/alib2data/src/alphabet/BottomOfTheStackSymbol.h @@ -42,4 +42,15 @@ public: } /* namespace alphabet */ +namespace std { + +template<> +struct compare<alphabet::BottomOfTheStackSymbol> { + int operator()(const alphabet::BottomOfTheStackSymbol& first, const alphabet::BottomOfTheStackSymbol& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* BOTTOM_OF_THE_STACK_SYMBOL_H_ */ diff --git a/alib2data/src/alphabet/EndSymbol.h b/alib2data/src/alphabet/EndSymbol.h index 49e07097a3..476e864e80 100644 --- a/alib2data/src/alphabet/EndSymbol.h +++ b/alib2data/src/alphabet/EndSymbol.h @@ -42,4 +42,15 @@ public: } /* namespace alphabet */ +namespace std { + +template<> +struct compare<alphabet::EndSymbol> { + int operator()(const alphabet::EndSymbol& first, const alphabet::EndSymbol& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* END_SYMBOL_H_ */ diff --git a/alib2data/src/alphabet/LabeledSymbol.h b/alib2data/src/alphabet/LabeledSymbol.h index e3ef61a405..528bb40dd0 100644 --- a/alib2data/src/alphabet/LabeledSymbol.h +++ b/alib2data/src/alphabet/LabeledSymbol.h @@ -55,4 +55,15 @@ public: } /* namespace alphabet */ +namespace std { + +template<> +struct compare<alphabet::LabeledSymbol> { + int operator()(const alphabet::LabeledSymbol& first, const alphabet::LabeledSymbol& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* LABELED_SYMBOL_H_ */ diff --git a/alib2data/src/alphabet/RankedBarSymbol.h b/alib2data/src/alphabet/RankedBarSymbol.h index 64e7e598ad..ca40d8622e 100644 --- a/alib2data/src/alphabet/RankedBarSymbol.h +++ b/alib2data/src/alphabet/RankedBarSymbol.h @@ -48,4 +48,15 @@ public: } /* namespace alphabet */ +namespace std { + +template<> +struct compare<alphabet::RankedBarSymbol> { + int operator()(const alphabet::RankedBarSymbol& first, const alphabet::RankedBarSymbol& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* RANKED_BAR_SYMBOL_H_ */ diff --git a/alib2data/src/alphabet/RankedSymbol.h b/alib2data/src/alphabet/RankedSymbol.h index e759a42fc4..9f1ad0d3aa 100644 --- a/alib2data/src/alphabet/RankedSymbol.h +++ b/alib2data/src/alphabet/RankedSymbol.h @@ -63,4 +63,15 @@ public: } /* namespace alphabet */ +namespace std { + +template<> +struct compare<alphabet::RankedSymbol> { + int operator()(const alphabet::RankedSymbol& first, const alphabet::RankedSymbol& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* RANKED_SYMBOL_H_ */ diff --git a/alib2data/src/alphabet/SubtreeWildcardSymbol.h b/alib2data/src/alphabet/SubtreeWildcardSymbol.h index c9bcb75b2e..5a8e9c31c7 100644 --- a/alib2data/src/alphabet/SubtreeWildcardSymbol.h +++ b/alib2data/src/alphabet/SubtreeWildcardSymbol.h @@ -42,4 +42,15 @@ public: } /* namespace alphabet */ +namespace std { + +template<> +struct compare<alphabet::SubtreeWildcardSymbol> { + int operator()(const alphabet::SubtreeWildcardSymbol& first, const alphabet::SubtreeWildcardSymbol& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* SUBTREE_WILDCARD_SYMBOL_H_ */ diff --git a/alib2data/src/alphabet/SymbolBase.h b/alib2data/src/alphabet/SymbolBase.h index 68b50edefa..45dd60bf9d 100644 --- a/alib2data/src/alphabet/SymbolBase.h +++ b/alib2data/src/alphabet/SymbolBase.h @@ -34,4 +34,15 @@ public: } /* namespace alphabet */ +namespace std { + +template<> +struct compare<alphabet::SymbolBase> { + int operator()(const alphabet::SymbolBase& first, const alphabet::SymbolBase& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* SYMBOL_BASE_H_ */ diff --git a/alib2data/src/automaton/AutomatonBase.h b/alib2data/src/automaton/AutomatonBase.h index ff3d4c3249..1b3dd4fbdc 100644 --- a/alib2data/src/automaton/AutomatonBase.h +++ b/alib2data/src/automaton/AutomatonBase.h @@ -180,5 +180,16 @@ class VisitableConstDeterministicAutomatonBase : public VisitableAutomatonBase:: } /* namespace automaton */ +namespace std { + +template<> +struct compare<automaton::AutomatonBase> { + int operator()(const automaton::AutomatonBase& first, const automaton::AutomatonBase& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* AUTOMATON_BASE_H_ */ diff --git a/alib2data/src/automaton/FSM/CompactNFA.cpp b/alib2data/src/automaton/FSM/CompactNFA.cpp index e57181fdb3..fa9ba83f73 100644 --- a/alib2data/src/automaton/FSM/CompactNFA.cpp +++ b/alib2data/src/automaton/FSM/CompactNFA.cpp @@ -169,15 +169,25 @@ int CompactNFA::compare(const ObjectBase& other) const { } int CompactNFA::compare(const CompactNFA& other) const { - auto first = std::tie(states, inputAlphabet, initialState, finalStates, transitions); - auto second = std::tie(other.states, other.inputAlphabet, other.initialState, other.finalStates, other.transitions); - if(first == second) { - return 0; - } else if(first < second) { - return -1; - } else { - return 1; + std::compare<decltype(states)> comp; + int res = comp(states, other.states); + if(res == 0) { + std::compare<decltype(inputAlphabet)> comp; + res = comp(inputAlphabet, other.inputAlphabet); } + if(res == 0) { + std::compare<decltype(initialState)> comp; + res = comp(initialState, other.initialState); + } + if(res == 0) { + std::compare<decltype(finalStates)> comp; + res = comp(finalStates, other.finalStates); + } + if(res == 0) { + std::compare<decltype(transitions)> comp; + res = comp(transitions, other.transitions); + } + return res; } void CompactNFA::operator>>(std::ostream& out) const { diff --git a/alib2data/src/automaton/FSM/CompactNFA.h b/alib2data/src/automaton/FSM/CompactNFA.h index 22f0ac7c09..0c7284a17e 100644 --- a/alib2data/src/automaton/FSM/CompactNFA.h +++ b/alib2data/src/automaton/FSM/CompactNFA.h @@ -93,4 +93,15 @@ public: } /* namespace automaton */ +namespace std { + +template<> +struct compare<automaton::CompactNFA> { + int operator()(const automaton::CompactNFA& first, const automaton::CompactNFA& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* COMPACT_DFA_H_ */ diff --git a/alib2data/src/automaton/FSM/DFA.h b/alib2data/src/automaton/FSM/DFA.h index 3059c4d775..1fb39a450c 100644 --- a/alib2data/src/automaton/FSM/DFA.h +++ b/alib2data/src/automaton/FSM/DFA.h @@ -94,4 +94,15 @@ public: } /* namespace automaton */ +namespace std { + +template<> +struct compare<automaton::DFA> { + int operator()(const automaton::DFA& first, const automaton::DFA& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* DFA_H_ */ diff --git a/alib2data/src/automaton/FSM/EpsilonNFA.h b/alib2data/src/automaton/FSM/EpsilonNFA.h index 22aabff97a..479b739d6b 100644 --- a/alib2data/src/automaton/FSM/EpsilonNFA.h +++ b/alib2data/src/automaton/FSM/EpsilonNFA.h @@ -172,4 +172,15 @@ public: } /* namespace automaton */ +namespace std { + +template<> +struct compare<automaton::EpsilonNFA> { + int operator()(const automaton::EpsilonNFA& first, const automaton::EpsilonNFA& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* EPSILON_NFA_H_ */ diff --git a/alib2data/src/automaton/FSM/ExtendedNFA.h b/alib2data/src/automaton/FSM/ExtendedNFA.h index 375f682c4a..2f01c40289 100644 --- a/alib2data/src/automaton/FSM/ExtendedNFA.h +++ b/alib2data/src/automaton/FSM/ExtendedNFA.h @@ -95,4 +95,15 @@ public: } /* namespace automaton */ +namespace std { + +template<> +struct compare<automaton::ExtendedNFA> { + int operator()(const automaton::ExtendedNFA& first, const automaton::ExtendedNFA& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* EXTENDED_NFA_H_ */ diff --git a/alib2data/src/automaton/FSM/MultiInitialStateNFA.h b/alib2data/src/automaton/FSM/MultiInitialStateNFA.h index bef36397b1..82192f4e73 100644 --- a/alib2data/src/automaton/FSM/MultiInitialStateNFA.h +++ b/alib2data/src/automaton/FSM/MultiInitialStateNFA.h @@ -111,4 +111,15 @@ public: } /* namespace automaton */ +namespace std { + +template<> +struct compare<automaton::MultiInitialStateNFA> { + int operator()(const automaton::MultiInitialStateNFA& first, const automaton::MultiInitialStateNFA& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* MULTI_INITIAL_STATE_NFA_H_ */ diff --git a/alib2data/src/automaton/FSM/NFA.h b/alib2data/src/automaton/FSM/NFA.h index c998bad2e7..3fb615aed1 100644 --- a/alib2data/src/automaton/FSM/NFA.h +++ b/alib2data/src/automaton/FSM/NFA.h @@ -109,4 +109,15 @@ public: } /* namespace automaton */ +namespace std { + +template<> +struct compare<automaton::NFA> { + int operator()(const automaton::NFA& first, const automaton::NFA& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* NFA_H_ */ diff --git a/alib2data/src/automaton/PDA/DPDA.h b/alib2data/src/automaton/PDA/DPDA.h index 4a3b2cba81..e5a8eafbc7 100644 --- a/alib2data/src/automaton/PDA/DPDA.h +++ b/alib2data/src/automaton/PDA/DPDA.h @@ -105,4 +105,15 @@ public: } /* namespace automaton */ +namespace std { + +template<> +struct compare<automaton::DPDA> { + int operator()(const automaton::DPDA& first, const automaton::DPDA& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* DPDA_H_ */ diff --git a/alib2data/src/automaton/PDA/InputDrivenNPDA.h b/alib2data/src/automaton/PDA/InputDrivenNPDA.h index 1054c421a4..b841f4c819 100644 --- a/alib2data/src/automaton/PDA/InputDrivenNPDA.h +++ b/alib2data/src/automaton/PDA/InputDrivenNPDA.h @@ -102,4 +102,15 @@ public: } /* namespace automaton */ +namespace std { + +template<> +struct compare<automaton::InputDrivenNPDA> { + int operator()(const automaton::InputDrivenNPDA& first, const automaton::InputDrivenNPDA& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* INPUT_DRIVEN_NPDA_H_ */ diff --git a/alib2data/src/automaton/PDA/NPDA.h b/alib2data/src/automaton/PDA/NPDA.h index dbaf1b76d1..f014897309 100644 --- a/alib2data/src/automaton/PDA/NPDA.h +++ b/alib2data/src/automaton/PDA/NPDA.h @@ -89,4 +89,15 @@ public: } /* namespace automaton */ +namespace std { + +template<> +struct compare<automaton::NPDA> { + int operator()(const automaton::NPDA& first, const automaton::NPDA& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* NPDA_H_ */ diff --git a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h index 772e86ac02..b27b051b7a 100644 --- a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h +++ b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicDPDA.h @@ -132,4 +132,15 @@ public: } /* namespace automaton */ +namespace std { + +template<> +struct compare<automaton::RealTimeHeightDeterministicDPDA> { + int operator()(const automaton::RealTimeHeightDeterministicDPDA& first, const automaton::RealTimeHeightDeterministicDPDA& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* REAL_TIME_HEIGHT_DETERMINISTIC_DPDA_H_ */ diff --git a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h index bf74a0fb6f..165381a83c 100644 --- a/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h +++ b/alib2data/src/automaton/PDA/RealTimeHeightDeterministicNPDA.h @@ -132,4 +132,15 @@ public: } /* namespace automaton */ +namespace std { + +template<> +struct compare<automaton::RealTimeHeightDeterministicNPDA> { + int operator()(const automaton::RealTimeHeightDeterministicNPDA& first, const automaton::RealTimeHeightDeterministicNPDA& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* REAL_TIME_HEIGHT_DETERMINISTIC_NPDA_H_ */ diff --git a/alib2data/src/automaton/PDA/SinglePopDPDA.h b/alib2data/src/automaton/PDA/SinglePopDPDA.h index 0601a411a4..7b100c775d 100644 --- a/alib2data/src/automaton/PDA/SinglePopDPDA.h +++ b/alib2data/src/automaton/PDA/SinglePopDPDA.h @@ -95,4 +95,15 @@ public: } /* namespace automaton */ +namespace std { + +template<> +struct compare<automaton::SinglePopDPDA> { + int operator()(const automaton::SinglePopDPDA& first, const automaton::SinglePopDPDA& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* SINGLE_POP_DPDA_H_ */ diff --git a/alib2data/src/automaton/PDA/SinglePopNPDA.h b/alib2data/src/automaton/PDA/SinglePopNPDA.h index cfb143ee80..43b833db66 100644 --- a/alib2data/src/automaton/PDA/SinglePopNPDA.h +++ b/alib2data/src/automaton/PDA/SinglePopNPDA.h @@ -89,4 +89,15 @@ public: } /* namespace automaton */ +namespace std { + +template<> +struct compare<automaton::SinglePopNPDA> { + int operator()(const automaton::SinglePopNPDA& first, const automaton::SinglePopNPDA& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* SINGLE_POP_NPDA_H_ */ diff --git a/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h b/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h index 5337610be8..f44bf960fa 100644 --- a/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h +++ b/alib2data/src/automaton/PDA/VisiblyPushdownDPDA.h @@ -118,4 +118,15 @@ public: } /* namespace automaton */ +namespace std { + +template<> +struct compare<automaton::VisiblyPushdownDPDA> { + int operator()(const automaton::VisiblyPushdownDPDA& first, const automaton::VisiblyPushdownDPDA& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* VISIBLY_PUSHDOWN_DPDA_H_ */ diff --git a/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h b/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h index 90fcae5106..6aa153fe96 100644 --- a/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h +++ b/alib2data/src/automaton/PDA/VisiblyPushdownNPDA.h @@ -118,4 +118,15 @@ public: } /* namespace automaton */ +namespace std { + +template<> +struct compare<automaton::VisiblyPushdownNPDA> { + int operator()(const automaton::VisiblyPushdownNPDA& first, const automaton::VisiblyPushdownNPDA& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* VISIBLY_PUSHDOWN_NPDA_H_ */ diff --git a/alib2data/src/automaton/TM/OneTapeDTM.h b/alib2data/src/automaton/TM/OneTapeDTM.h index b8da5bdc4c..c2590e3da0 100644 --- a/alib2data/src/automaton/TM/OneTapeDTM.h +++ b/alib2data/src/automaton/TM/OneTapeDTM.h @@ -87,4 +87,15 @@ public: } /* namespace automaton */ +namespace std { + +template<> +struct compare<automaton::OneTapeDTM> { + int operator()(const automaton::OneTapeDTM& first, const automaton::OneTapeDTM& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* ONE_TAPE_DTM_H_ */ diff --git a/alib2data/src/container/ContainerBase.h b/alib2data/src/container/ContainerBase.h index 66c2ab8905..58ae13185c 100644 --- a/alib2data/src/container/ContainerBase.h +++ b/alib2data/src/container/ContainerBase.h @@ -37,4 +37,15 @@ public: } /* namespace container */ +namespace std { + +template<> +struct compare<container::ContainerBase> { + int operator()(const container::ContainerBase& first, const container::ContainerBase& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* CONTAINER_BASE_H_ */ diff --git a/alib2data/src/container/ObjectsMap.h b/alib2data/src/container/ObjectsMap.h index fbb2820190..75864401db 100644 --- a/alib2data/src/container/ObjectsMap.h +++ b/alib2data/src/container/ObjectsMap.h @@ -40,4 +40,15 @@ public: } /* namespace container */ +namespace std { + +template<> +struct compare<container::ObjectsMap> { + int operator()(const container::ObjectsMap& first, const container::ObjectsMap& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* OBJECTS_MAP_H_ */ diff --git a/alib2data/src/container/ObjectsPair.h b/alib2data/src/container/ObjectsPair.h index 484a637ec1..65651ce1c3 100644 --- a/alib2data/src/container/ObjectsPair.h +++ b/alib2data/src/container/ObjectsPair.h @@ -42,4 +42,15 @@ public: } /* namespace container */ +namespace std { + +template<> +struct compare<container::ObjectsPair> { + int operator()(const container::ObjectsPair& first, const container::ObjectsPair& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* OBJECTS_PAIR_H_ */ diff --git a/alib2data/src/container/ObjectsSet.h b/alib2data/src/container/ObjectsSet.h index 35382caddf..c704bc77c1 100644 --- a/alib2data/src/container/ObjectsSet.h +++ b/alib2data/src/container/ObjectsSet.h @@ -40,4 +40,15 @@ public: } /* namespace container */ +namespace std { + +template<> +struct compare<container::ObjectsSet> { + int operator()(const container::ObjectsSet& first, const container::ObjectsSet& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* OBJECTS_SET_H_ */ diff --git a/alib2data/src/container/ObjectsVector.h b/alib2data/src/container/ObjectsVector.h index da7c1373bb..7d372d2383 100644 --- a/alib2data/src/container/ObjectsVector.h +++ b/alib2data/src/container/ObjectsVector.h @@ -40,4 +40,15 @@ public: } /* namespace container */ +namespace std { + +template<> +struct compare<container::ObjectsVector> { + int operator()(const container::ObjectsVector& first, const container::ObjectsVector& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* OBJECTS_VECTOR_H_ */ diff --git a/alib2data/src/exception/AlibException.h b/alib2data/src/exception/AlibException.h index 8cadc496a5..f68892c08f 100644 --- a/alib2data/src/exception/AlibException.h +++ b/alib2data/src/exception/AlibException.h @@ -67,4 +67,15 @@ public: } /* namespace exception */ +namespace std { + +template<> +struct compare<::exception::AlibException> { + int operator()(const ::exception::AlibException& first, const ::exception::AlibException& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* ALIB_EXCEPTION_H_ */ diff --git a/alib2data/src/grammar/ContextFree/CFG.h b/alib2data/src/grammar/ContextFree/CFG.h index afb714ca86..720f5f89a3 100644 --- a/alib2data/src/grammar/ContextFree/CFG.h +++ b/alib2data/src/grammar/ContextFree/CFG.h @@ -61,4 +61,15 @@ public: } /* namespace grammar */ +namespace std { + +template<> +struct compare<grammar::CFG> { + int operator()(const grammar::CFG& first, const grammar::CFG& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* CFG_H_ */ diff --git a/alib2data/src/grammar/ContextFree/CNF.h b/alib2data/src/grammar/ContextFree/CNF.h index e972f0eda3..eca8d06616 100644 --- a/alib2data/src/grammar/ContextFree/CNF.h +++ b/alib2data/src/grammar/ContextFree/CNF.h @@ -70,4 +70,15 @@ public: } /* namespace grammar */ +namespace std { + +template<> +struct compare<grammar::CNF> { + int operator()(const grammar::CNF& first, const grammar::CNF& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* CNF_H_ */ diff --git a/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h b/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h index 17addf33f2..1f07c6f2bd 100644 --- a/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h +++ b/alib2data/src/grammar/ContextFree/EpsilonFreeCFG.h @@ -65,4 +65,15 @@ public: } /* namespace grammar */ +namespace std { + +template<> +struct compare<grammar::EpsilonFreeCFG> { + int operator()(const grammar::EpsilonFreeCFG& first, const grammar::EpsilonFreeCFG& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* EPSILON_FREE_CFG_H_ */ diff --git a/alib2data/src/grammar/ContextFree/GNF.h b/alib2data/src/grammar/ContextFree/GNF.h index 6858955ce1..da0fa45949 100644 --- a/alib2data/src/grammar/ContextFree/GNF.h +++ b/alib2data/src/grammar/ContextFree/GNF.h @@ -64,4 +64,15 @@ public: } /* namespace grammar */ +namespace std { + +template<> +struct compare<grammar::GNF> { + int operator()(const grammar::GNF& first, const grammar::GNF& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* GNF_H_ */ diff --git a/alib2data/src/grammar/ContextFree/LG.h b/alib2data/src/grammar/ContextFree/LG.h index c531f4a59a..5e7a233d7c 100644 --- a/alib2data/src/grammar/ContextFree/LG.h +++ b/alib2data/src/grammar/ContextFree/LG.h @@ -66,4 +66,15 @@ public: } /* namespace grammar */ +namespace std { + +template<> +struct compare<grammar::LG> { + int operator()(const grammar::LG& first, const grammar::LG& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* LG_H_ */ diff --git a/alib2data/src/grammar/ContextSensitive/CSG.h b/alib2data/src/grammar/ContextSensitive/CSG.h index 0427a348b6..15f7f56915 100644 --- a/alib2data/src/grammar/ContextSensitive/CSG.h +++ b/alib2data/src/grammar/ContextSensitive/CSG.h @@ -58,4 +58,15 @@ public: } /* namespace grammar */ +namespace std { + +template<> +struct compare<grammar::CSG> { + int operator()(const grammar::CSG& first, const grammar::CSG& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* CSG_H_ */ diff --git a/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h b/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h index fd20c21381..d89d141ec8 100644 --- a/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h +++ b/alib2data/src/grammar/ContextSensitive/NonContractingGrammar.h @@ -58,4 +58,15 @@ public: } /* namespace grammar */ +namespace std { + +template<> +struct compare<grammar::NonContractingGrammar> { + int operator()(const grammar::NonContractingGrammar& first, const grammar::NonContractingGrammar& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* NON_CONTRACTING_GRAMMAR_H_ */ diff --git a/alib2data/src/grammar/GrammarBase.h b/alib2data/src/grammar/GrammarBase.h index 9ad26cb132..0777ad1f82 100644 --- a/alib2data/src/grammar/GrammarBase.h +++ b/alib2data/src/grammar/GrammarBase.h @@ -84,5 +84,16 @@ class VisitableConstRGBase : public VisitableGrammarBase::const_visitor_type { } /* namespace grammar */ +namespace std { + +template<> +struct compare<grammar::GrammarBase> { + int operator()(const grammar::GrammarBase& first, const grammar::GrammarBase& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* GRAMMAR_BASE_H_ */ diff --git a/alib2data/src/grammar/Regular/LeftLG.h b/alib2data/src/grammar/Regular/LeftLG.h index 95e46cb355..b7efe183de 100644 --- a/alib2data/src/grammar/Regular/LeftLG.h +++ b/alib2data/src/grammar/Regular/LeftLG.h @@ -65,4 +65,15 @@ public: } /* namespace grammar */ +namespace std { + +template<> +struct compare<grammar::LeftLG> { + int operator()(const grammar::LeftLG& first, const grammar::LeftLG& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* LEFT_LG_H_ */ diff --git a/alib2data/src/grammar/Regular/LeftRG.h b/alib2data/src/grammar/Regular/LeftRG.h index acfcd932ba..88e4c3a338 100644 --- a/alib2data/src/grammar/Regular/LeftRG.h +++ b/alib2data/src/grammar/Regular/LeftRG.h @@ -153,4 +153,15 @@ public: } /* namespace grammar */ +namespace std { + +template<> +struct compare<grammar::LeftRG> { + int operator()(const grammar::LeftRG& first, const grammar::LeftRG& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* LEFT_RG_H_ */ diff --git a/alib2data/src/grammar/Regular/RightLG.h b/alib2data/src/grammar/Regular/RightLG.h index fd13d01a82..d2ba02c50c 100644 --- a/alib2data/src/grammar/Regular/RightLG.h +++ b/alib2data/src/grammar/Regular/RightLG.h @@ -65,4 +65,15 @@ public: } /* namespace grammar */ +namespace std { + +template<> +struct compare<grammar::RightLG> { + int operator()(const grammar::RightLG& first, const grammar::RightLG& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* RIGHT_LG_H_ */ diff --git a/alib2data/src/grammar/Regular/RightRG.h b/alib2data/src/grammar/Regular/RightRG.h index 0580625a7f..eea1c9c595 100644 --- a/alib2data/src/grammar/Regular/RightRG.h +++ b/alib2data/src/grammar/Regular/RightRG.h @@ -85,4 +85,15 @@ public: } /* namespace grammar */ +namespace std { + +template<> +struct compare<grammar::RightRG> { + int operator()(const grammar::RightRG& first, const grammar::RightRG& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* RIGHT_RG_H_ */ diff --git a/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h b/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h index c781aded66..14c86b9ec2 100644 --- a/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h +++ b/alib2data/src/grammar/Unrestricted/ContextPreservingUnrestrictedGrammar.h @@ -54,4 +54,15 @@ public: } /* namespace grammar */ +namespace std { + +template<> +struct compare<grammar::ContextPreservingUnrestrictedGrammar> { + int operator()(const grammar::ContextPreservingUnrestrictedGrammar& first, const grammar::ContextPreservingUnrestrictedGrammar& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* CONTEXT_PRESERVING_UNRESTRICTED_GRAMMAR_H_ */ diff --git a/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h b/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h index d0b66dbe25..2a445e12b0 100644 --- a/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h +++ b/alib2data/src/grammar/Unrestricted/UnrestrictedGrammar.h @@ -54,4 +54,15 @@ public: } /* namespace grammar */ +namespace std { + +template<> +struct compare<grammar::UnrestrictedGrammar> { + int operator()(const grammar::UnrestrictedGrammar& first, const grammar::UnrestrictedGrammar& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* UNRESTRICTED_GRAMMAR_H_ */ diff --git a/alib2data/src/label/HexavigesimalLabel.h b/alib2data/src/label/HexavigesimalLabel.h index 57494ab60c..2987991840 100644 --- a/alib2data/src/label/HexavigesimalLabel.h +++ b/alib2data/src/label/HexavigesimalLabel.h @@ -52,5 +52,16 @@ public: } /* namespace label */ +namespace std { + +template<> +struct compare<label::HexavigesimalLabel> { + int operator()(const label::HexavigesimalLabel& first, const label::HexavigesimalLabel& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* HEXAVIGESIMAL_LABEL_H_ */ diff --git a/alib2data/src/label/LabelBase.h b/alib2data/src/label/LabelBase.h index 1fea94675d..9fd5af9db4 100644 --- a/alib2data/src/label/LabelBase.h +++ b/alib2data/src/label/LabelBase.h @@ -34,5 +34,16 @@ public: } /* namespace label */ +namespace std { + +template<> +struct compare<label::LabelBase> { + int operator()(const label::LabelBase& first, const label::LabelBase& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* LABEL_BASE_H_ */ diff --git a/alib2data/src/label/LabelPairLabel.h b/alib2data/src/label/LabelPairLabel.h index aeb32623e1..e2d9a8ddcc 100644 --- a/alib2data/src/label/LabelPairLabel.h +++ b/alib2data/src/label/LabelPairLabel.h @@ -56,5 +56,16 @@ public: } /* namespace label */ +namespace std { + +template<> +struct compare<label::LabelPairLabel> { + int operator()(const label::LabelPairLabel& first, const label::LabelPairLabel& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* LABEL_PAIR_LABEL_H_ */ diff --git a/alib2data/src/label/LabelSetLabel.h b/alib2data/src/label/LabelSetLabel.h index 2bc5b77d60..951d106b9c 100644 --- a/alib2data/src/label/LabelSetLabel.h +++ b/alib2data/src/label/LabelSetLabel.h @@ -56,5 +56,16 @@ public: } /* namespace label */ +namespace std { + +template<> +struct compare<label::LabelSetLabel> { + int operator()(const label::LabelSetLabel& first, const label::LabelSetLabel& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* LABEL_SET_LABEL_H_ */ diff --git a/alib2data/src/label/ObjectLabel.h b/alib2data/src/label/ObjectLabel.h index d5485d6c51..f57b0553d9 100644 --- a/alib2data/src/label/ObjectLabel.h +++ b/alib2data/src/label/ObjectLabel.h @@ -55,4 +55,15 @@ public: } /* namespace label */ +namespace std { + +template<> +struct compare<label::ObjectLabel> { + int operator()(const label::ObjectLabel& first, const label::ObjectLabel& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* OBJECT_LABEL_H_ */ diff --git a/alib2data/src/label/PrimitiveLabel.h b/alib2data/src/label/PrimitiveLabel.h index 6faa087a12..ed447b33ce 100644 --- a/alib2data/src/label/PrimitiveLabel.h +++ b/alib2data/src/label/PrimitiveLabel.h @@ -54,5 +54,16 @@ public: } /* namespace label */ +namespace std { + +template<> +struct compare<label::PrimitiveLabel> { + int operator()(const label::PrimitiveLabel& first, const label::PrimitiveLabel& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* PRIMITIVE_LABEL_H_ */ diff --git a/alib2data/src/object/Void.h b/alib2data/src/object/Void.h index 1218433d7d..7a47c43f9b 100644 --- a/alib2data/src/object/Void.h +++ b/alib2data/src/object/Void.h @@ -44,4 +44,15 @@ public: } /* namespace alib */ +namespace std { + +template<> +struct compare<alib::Void> { + int operator()(const alib::Void& first, const alib::Void& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* VOID_H_ */ diff --git a/alib2data/src/primitive/Character.h b/alib2data/src/primitive/Character.h index f36c11e0cc..2edfe63ce5 100644 --- a/alib2data/src/primitive/Character.h +++ b/alib2data/src/primitive/Character.h @@ -52,5 +52,16 @@ public: } /* namespace primitive */ +namespace std { + +template<> +struct compare<primitive::Character> { + int operator()(const primitive::Character& first, const primitive::Character& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* PRIMITIVE_CHARACTER_H_ */ diff --git a/alib2data/src/primitive/Integer.h b/alib2data/src/primitive/Integer.h index 6453e3905b..0b71a0c33f 100644 --- a/alib2data/src/primitive/Integer.h +++ b/alib2data/src/primitive/Integer.h @@ -52,4 +52,15 @@ public: } /* namespace primitive */ +namespace std { + +template<> +struct compare<primitive::Integer> { + int operator()(const primitive::Integer& first, const primitive::Integer& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* PRIMITIVE_INTEGER_H_ */ diff --git a/alib2data/src/primitive/PrimitiveBase.h b/alib2data/src/primitive/PrimitiveBase.h index 7a2dfe9a5f..a408eaef25 100644 --- a/alib2data/src/primitive/PrimitiveBase.h +++ b/alib2data/src/primitive/PrimitiveBase.h @@ -34,5 +34,16 @@ public: } /* namespace primitive */ +namespace std { + +template<> +struct compare<primitive::PrimitiveBase> { + int operator()(const primitive::PrimitiveBase& first, const primitive::PrimitiveBase& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* PRIMITIVE_BASE_H_ */ diff --git a/alib2data/src/primitive/String.h b/alib2data/src/primitive/String.h index dd74681d17..1dc3f12965 100644 --- a/alib2data/src/primitive/String.h +++ b/alib2data/src/primitive/String.h @@ -55,5 +55,16 @@ public: } /* namespace primitive */ +namespace std { + +template<> +struct compare<primitive::String> { + int operator()(const primitive::String& first, const primitive::String& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* PRIMITIVE_STRING_H_ */ diff --git a/alib2data/src/regexp/RegExpBase.h b/alib2data/src/regexp/RegExpBase.h index 639c6f52a7..5c34c32882 100644 --- a/alib2data/src/regexp/RegExpBase.h +++ b/alib2data/src/regexp/RegExpBase.h @@ -33,5 +33,16 @@ public: } /* namespace regexp */ +namespace std { + +template<> +struct compare<regexp::RegExpBase> { + int operator()(const regexp::RegExpBase& first, const regexp::RegExpBase& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* REG_EXP_BASE_H_ */ diff --git a/alib2data/src/regexp/formal/FormalRegExp.h b/alib2data/src/regexp/formal/FormalRegExp.h index 705e59715f..c8045b63e2 100644 --- a/alib2data/src/regexp/formal/FormalRegExp.h +++ b/alib2data/src/regexp/formal/FormalRegExp.h @@ -124,4 +124,15 @@ public: } /* namespace regexp */ +namespace std { + +template<> +struct compare<regexp::FormalRegExp> { + int operator()(const regexp::FormalRegExp& first, const regexp::FormalRegExp& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* FORMAL_REG_EXP_H_ */ diff --git a/alib2data/src/regexp/unbounded/UnboundedRegExp.h b/alib2data/src/regexp/unbounded/UnboundedRegExp.h index 934492fac8..e6f3d531e7 100644 --- a/alib2data/src/regexp/unbounded/UnboundedRegExp.h +++ b/alib2data/src/regexp/unbounded/UnboundedRegExp.h @@ -124,4 +124,15 @@ public: } /* namespace regexp */ +namespace std { + +template<> +struct compare<regexp::UnboundedRegExp> { + int operator()(const regexp::UnboundedRegExp& first, const regexp::UnboundedRegExp& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* UNBOUNDED_REG_EXP_H_ */ diff --git a/alib2data/src/std/compare.hpp b/alib2data/src/std/compare.hpp index ff2317deac..fbb2a3dbe4 100644 --- a/alib2data/src/std/compare.hpp +++ b/alib2data/src/std/compare.hpp @@ -84,7 +84,7 @@ struct compare<map<T, R>> { compare<std::pair<T, R>> comp; for(auto iterF = first.begin(), iterS = second.begin(); iterF != first.end(); iterF++, iterS++) { - int res = compare(*iterF, *iterS); + int res = comp(*iterF, *iterS); if(res != 0) return res; } return 0; diff --git a/alib2data/src/string/CyclicString.h b/alib2data/src/string/CyclicString.h index c85099f747..0d1113a665 100644 --- a/alib2data/src/string/CyclicString.h +++ b/alib2data/src/string/CyclicString.h @@ -69,5 +69,16 @@ public: } /* namespace string */ +namespace std { + +template<> +struct compare<::string::CyclicString> { + int operator()(const ::string::CyclicString& first, const ::string::CyclicString& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* CYCLIC_STRING_H_ */ diff --git a/alib2data/src/string/Epsilon.h b/alib2data/src/string/Epsilon.h index 81ecbf3202..0a2e4b3a2e 100644 --- a/alib2data/src/string/Epsilon.h +++ b/alib2data/src/string/Epsilon.h @@ -59,5 +59,16 @@ public: } /* namespace string */ +namespace std { + +template<> +struct compare<::string::Epsilon> { + int operator()(const ::string::Epsilon& first, const ::string::Epsilon& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* EPSILON_H_ */ diff --git a/alib2data/src/string/LinearString.h b/alib2data/src/string/LinearString.h index a74a468fb1..a6921c5225 100644 --- a/alib2data/src/string/LinearString.h +++ b/alib2data/src/string/LinearString.h @@ -77,5 +77,16 @@ public: } /* namespace string */ +namespace std { + +template<> +struct compare<::string::LinearString> { + int operator()(const ::string::LinearString& first, const ::string::LinearString& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* LINEAR_STRING_H_ */ diff --git a/alib2data/src/string/StringBase.h b/alib2data/src/string/StringBase.h index de7461bcde..cda2b7a8dc 100644 --- a/alib2data/src/string/StringBase.h +++ b/alib2data/src/string/StringBase.h @@ -33,5 +33,16 @@ public: } /* namespace string */ +namespace std { + +template<> +struct compare<::string::StringBase> { + int operator()(const ::string::StringBase& first, const ::string::StringBase& second) const { + return first.compare(second); + } +}; + +} /* namespace std */ + #endif /* STRING_BASE_H_ */ -- GitLab