diff --git a/alib2abstraction/src/common/ParamQualifiers.hpp b/alib2abstraction/src/common/ParamQualifiers.hpp index 01fea43d2bc039f45080558fc235ab17c29acb68..7975f2f052687b6c960d25c9e18cb8c722cfbece 100644 --- a/alib2abstraction/src/common/ParamQualifiers.hpp +++ b/alib2abstraction/src/common/ParamQualifiers.hpp @@ -29,6 +29,21 @@ public: return res; } + + friend std::ostream & operator << ( std::ostream & os, const ParamQualifier & paramQualifier ) { + switch ( paramQualifier ) { + case ParamQualifier::LREF: + os << "LValue reference"; + break; + case ParamQualifier::RREF: + os << "RValue reference"; + break; + case ParamQualifier::CONST: + os << "Constant"; + break; + } + return os; + } }; } /* namespace abstraction */ diff --git a/alib2abstraction/src/registry/AlgorithmRegistry.hpp b/alib2abstraction/src/registry/AlgorithmRegistry.hpp index f58dc6bb587449e8d602b0f908a4f055708acf09..291fdc2f09d50a68ec2a9a16e658aeb77246a0ad 100644 --- a/alib2abstraction/src/registry/AlgorithmRegistry.hpp +++ b/alib2abstraction/src/registry/AlgorithmRegistry.hpp @@ -130,7 +130,7 @@ public: ext::pair < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier > > result = convertReturnType < ReturnType > ( ); if ( isRegistered ( algorithm, templateParams, category, params ) ) - throw std::invalid_argument ( "Callback for " + algorithm + " already registered." ); + throw std::invalid_argument ( "Callback for " + algorithm + " with params " + ext::to_string ( params ) + " already registered." ); registerInternal ( std::move ( algorithm ), std::move ( templateParams ), category, std::move ( result ), std::move ( params ), std::make_shared < MemberImpl < ObjectType &, ReturnType, ParamTypes ... > > ( callback ) ); } @@ -147,7 +147,7 @@ public: ext::pair < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier > > result = convertReturnType < ReturnType > ( ); if ( isRegistered ( algorithm, templateParams, category, params ) ) - throw std::invalid_argument ( "Callback for " + algorithm + " already registered." ); + throw std::invalid_argument ( "Callback for " + algorithm + " with params " + ext::to_string ( params ) + " already registered." ); registerInternal ( std::move ( algorithm ), std::move ( templateParams ), category, std::move ( result ), std::move ( params ), std::make_shared < MemberImpl < const ObjectType &, ReturnType, ParamTypes ... > > ( callback ) ); } @@ -161,7 +161,7 @@ public: ext::pair < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier > > result = convertReturnType < ReturnType > ( ); if ( isRegistered ( algorithm, templateParams, category, params ) ) - throw std::invalid_argument ( "Callback for " + algorithm + " already registered." ); + throw std::invalid_argument ( "Callback for " + algorithm + " with params " + ext::to_string ( params ) + " already registered." ); registerInternal ( std::move ( algorithm ), std::move ( templateParams ), category, std::move ( result ), std::move ( params ), std::make_shared < EntryImpl < ReturnType, ParamTypes ... > > ( callback ) ); } @@ -178,7 +178,7 @@ public: ext::pair < std::string, ext::set < abstraction::ParamQualifiers::ParamQualifier > > result = convertReturnType < ReturnType > ( ); if ( isRegistered ( algorithm, templateParams, category, params ) ) - return; + throw std::invalid_argument ( "Callback for " + algorithm + " with params " + ext::to_string ( params ) + " already registered." ); registerInternal ( std::move ( algorithm ), std::move ( templateParams ), category, std::move ( result ), std::move ( params ), std::make_shared < WrapperImpl < ReturnType, ParamTypes ... > > ( callback ) ); } diff --git a/alib2data/src/PrimitiveRegistrator.cpp b/alib2data/src/PrimitiveRegistrator.cpp index d1e5bbd2d2ab60f2b0cf26f41cdf0b4678ba3856..a72f94cb6028fdf6efdf5035ebc8fec307038306 100644 --- a/alib2data/src/PrimitiveRegistrator.cpp +++ b/alib2data/src/PrimitiveRegistrator.cpp @@ -34,7 +34,6 @@ public: abstraction::XmlContainerParserRegistry::registerSet < common::ranked_symbol < object::Object, unsigned > > ( "RankedSymbol" ); registration::XmlWriterRegister < ext::set < common::ranked_symbol < object::Object, unsigned > > > ( ); - registration::XmlWriterRegister < common::ranked_symbol < object::Object, unsigned > > ( ); registration::XmlWriterRegister < ext::vector < ext::map < std::pair < object::Object, object::Object >, ext::map < object::Object, object::Object > > > > ( ); registration::XmlWriterRegister < ext::vector < ext::vector < ext::set < object::Object > > > > ( ); registration::XmlWriterRegister < ext::map < common::ranked_symbol < object::Object, unsigned >, size_t > > ( ); diff --git a/alib2raw/src/registration/RawRegistration.hpp b/alib2raw/src/registration/RawRegistration.hpp index bbb5bebf6bf016665569fe9fea861c023f1dbf65..f72486a3bd7cb8de14d85a1f80979de8839e46d3 100644 --- a/alib2raw/src/registration/RawRegistration.hpp +++ b/alib2raw/src/registration/RawRegistration.hpp @@ -37,7 +37,7 @@ class RawReaderRegister { public: RawReaderRegister ( ) { abstraction::RawReaderRegistry::registerRawReader < Type > ( ); - abstraction::AlgorithmRegistry::registerWrapper < raw::Parse < Type >, abstraction::UnspecifiedType, const std::string & > ( raw::Parse < Type >::abstractionFromString, std::array < std::string, 1 > { { "arg0" } } ); + abstraction::AlgorithmRegistry::registerWrapper < raw::Parse < Type >, Type, const std::string & > ( raw::Parse < Type >::abstractionFromString, std::array < std::string, 1 > { { "arg0" } } ); } }; diff --git a/alib2str/src/automaton/string/ObjectGroupRegister.cpp b/alib2str/src/automaton/string/ObjectGroupRegister.cpp new file mode 100644 index 0000000000000000000000000000000000000000..28acf127a6330448d2437f43a44727b56c26981b --- /dev/null +++ b/alib2str/src/automaton/string/ObjectGroupRegister.cpp @@ -0,0 +1,16 @@ +/* + * AutomatonGroupGegister.cpp + * + * Created on: Sep 27, 2017 + * Author: Jan Travnicek + */ + +#include <automaton/Automaton.h> + +#include <registration/StringRegistration.hpp> + +namespace { + +static auto stringReaderGroup = registration::StringReaderGroupRegister < automaton::Automaton > ( ); + +} /* namespace */ diff --git a/alib2str/src/grammar/string/GrammarGroupRegister.cpp b/alib2str/src/grammar/string/GrammarGroupRegister.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6e76600cd1f97eb8e5a4fb3952069a647fcb8b89 --- /dev/null +++ b/alib2str/src/grammar/string/GrammarGroupRegister.cpp @@ -0,0 +1,16 @@ +/* + * GrammarGroupGegister.cpp + * + * Created on: Sep 27, 2017 + * Author: Jan Travnicek + */ + +#include <grammar/Grammar.h> + +#include <registration/StringRegistration.hpp> + +namespace { + +static auto stringReaderGroup = registration::StringReaderGroupRegister < grammar::Grammar > ( ); + +} /* namespace */ diff --git a/alib2str/src/object/string/ObjectGroupRegister.cpp b/alib2str/src/object/string/ObjectGroupRegister.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5daacc45dda241d7f7bdc8ea44eb316b0b198145 --- /dev/null +++ b/alib2str/src/object/string/ObjectGroupRegister.cpp @@ -0,0 +1,16 @@ +/* + * ObjectGroupGegister.cpp + * + * Created on: Sep 27, 2017 + * Author: Jan Travnicek + */ + +#include <object/Object.h> + +#include <registration/StringRegistration.hpp> + +namespace { + +static auto stringReaderGroup = registration::StringReaderGroupRegister < object::Object > ( ); + +} /* namespace */ diff --git a/alib2str/src/regexp/string/RegexpGroupRegister.cpp b/alib2str/src/regexp/string/RegexpGroupRegister.cpp new file mode 100644 index 0000000000000000000000000000000000000000..1b615bfac9dae8d4d7678c01ce461d861ee1d074 --- /dev/null +++ b/alib2str/src/regexp/string/RegexpGroupRegister.cpp @@ -0,0 +1,16 @@ +/* + * RegExpGroupGegister.cpp + * + * Created on: Sep 27, 2017 + * Author: Jan Travnicek + */ + +#include <regexp/RegExp.h> + +#include <registration/StringRegistration.hpp> + +namespace { + +static auto stringReaderGroup = registration::StringReaderGroupRegister < regexp::RegExp > ( ); + +} /* namespace */ diff --git a/alib2str/src/registration/StringRegistration.hpp b/alib2str/src/registration/StringRegistration.hpp index 523f093ec1d841afa09cc2dc410fe6d3a38b2521..38c645fb8f9405f2a173e96f217686df9deeaad4 100644 --- a/alib2str/src/registration/StringRegistration.hpp +++ b/alib2str/src/registration/StringRegistration.hpp @@ -37,6 +37,13 @@ class StringReaderRegister { public: StringReaderRegister ( ) { abstraction::StringReaderRegistry::registerStringReader < Group, Type > ( ); + } +}; + +template < class Group > +class StringReaderGroupRegister { +public: + StringReaderGroupRegister ( ) { abstraction::AlgorithmRegistry::registerWrapper < string::Parse < Group >, abstraction::UnspecifiedType, std::string && > ( string::Parse < Group >::abstractionFromString, std::array < std::string, 1 > { { "arg0" } } ); } }; diff --git a/alib2str/src/string/string/StringGroupRegister.cpp b/alib2str/src/string/string/StringGroupRegister.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bd7d54c5a79151058aa1a5ddd442994efd45e35b --- /dev/null +++ b/alib2str/src/string/string/StringGroupRegister.cpp @@ -0,0 +1,16 @@ +/* + * StringGroupGegister.cpp + * + * Created on: Sep 27, 2017 + * Author: Jan Travnicek + */ + +#include <string/String.h> + +#include <registration/StringRegistration.hpp> + +namespace { + +static auto stringReaderGroup = registration::StringReaderGroupRegister < string::String > ( ); + +} /* namespace */ diff --git a/alib2str/src/tree/string/TreeGroupRegister.cpp b/alib2str/src/tree/string/TreeGroupRegister.cpp new file mode 100644 index 0000000000000000000000000000000000000000..128e63e59934bedc19da0f5273612a7ed0e1a318 --- /dev/null +++ b/alib2str/src/tree/string/TreeGroupRegister.cpp @@ -0,0 +1,16 @@ +/* + * TreeGroupGegister.cpp + * + * Created on: Sep 27, 2017 + * Author: Jan Travnicek + */ + +#include <tree/Tree.h> + +#include <registration/StringRegistration.hpp> + +namespace { + +static auto stringReaderGroup = registration::StringReaderGroupRegister < tree::Tree > ( ); + +} /* namespace */ diff --git a/alib2xml/src/PrimitiveRegistrator.cpp b/alib2xml/src/PrimitiveRegistrator.cpp index 5a3b8ff2140a33a98d97820d183fe4f556bf9f29..cecb0dcae2684da39148bcbebd86f6f425f4ab4e 100644 --- a/alib2xml/src/PrimitiveRegistrator.cpp +++ b/alib2xml/src/PrimitiveRegistrator.cpp @@ -40,7 +40,6 @@ public: registration::XmlWriterRegister < ext::set < int > > ( ); registration::XmlWriterRegister < ext::map < object::Object, size_t > > ( ); registration::XmlWriterRegister < object::Object > ( ); - registration::XmlWriterRegister < ext::set < object::Object > > ( ); abstraction::ContainerRegistry::registerSet < object::Object > ( "Object" ); abstraction::XmlContainerParserRegistry::registerSet < object::Object > ( "Object" );