From a3b5a07cf7c64f1a038839d3ef2f7b1d9fbf6c42 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sat, 27 Jul 2013 19:20:35 -0700 Subject: gras: added arg check with nice warning to callable and factory --- lib/factory.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib/factory.cpp') diff --git a/lib/factory.cpp b/lib/factory.cpp index 5c405f3..35b1b24 100644 --- a/lib/factory.cpp +++ b/lib/factory.cpp @@ -1,6 +1,7 @@ // Copyright (C) by Josh Blum. See LICENSE.txt for licensing information. #include +#include #include #include #include @@ -18,6 +19,12 @@ FactoryRegistryEntry::~FactoryRegistryEntry(void) //NOP } +void FactoryRegistryEntry::arg_check(const PMCList &args, const size_t nargs) +{ + if (args.size() != nargs) throw std::runtime_error(str(boost::format( + "factory expected %u arguments but for %u") % nargs % args.size())); +} + typedef std::map > FactoryRegistryType; static FactoryRegistryType &get_factory_registry(void) -- cgit