summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/callable.cpp7
-rw-r--r--lib/factory.cpp7
2 files changed, 14 insertions, 0 deletions
diff --git a/lib/callable.cpp b/lib/callable.cpp
index a7bc7da..59ada7f 100644
--- a/lib/callable.cpp
+++ b/lib/callable.cpp
@@ -3,6 +3,7 @@
#include <gras/callable.hpp>
#include <boost/foreach.hpp>
#include <boost/shared_ptr.hpp>
+#include <boost/format.hpp>
#include <stdexcept>
#include <map>
@@ -62,3 +63,9 @@ CallableRegistryEntry::~CallableRegistryEntry(void)
{
//NOP
}
+
+void CallableRegistryEntry::arg_check(const PMCList &args, const size_t nargs)
+{
+ if (args.size() != nargs) throw std::runtime_error(str(boost::format(
+ "callable expected %u arguments but for %u") % nargs % args.size()));
+}
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 <gras/factory.hpp>
+#include <boost/format.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/thread/mutex.hpp>
#include <stdexcept>
@@ -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<std::string, boost::shared_ptr<FactoryRegistryEntry> > FactoryRegistryType;
static FactoryRegistryType &get_factory_registry(void)