summaryrefslogtreecommitdiff
path: root/include/gras
diff options
context:
space:
mode:
Diffstat (limited to 'include/gras')
-rw-r--r--include/gras/callable.hpp40
-rw-r--r--include/gras/detail/callable.hpp64
-rw-r--r--include/gras/element.i4
3 files changed, 54 insertions, 54 deletions
diff --git a/include/gras/callable.hpp b/include/gras/callable.hpp
index 792be93..60d0fb0 100644
--- a/include/gras/callable.hpp
+++ b/include/gras/callable.hpp
@@ -42,71 +42,71 @@ public:
//! Destructor (virtual for subclasses)
virtual ~Callable(void);
- //! Get a list of keys for registered calls
- std::vector<std::string> get_registered_keys(void) const;
+ //! Get a list of names for registered calls
+ std::vector<std::string> get_registered_names(void) const;
protected:
/*!
* Unregister a previously registered call.
- * Throws if the key is not found in the registry.
+ * Throws if the name is not found in the registry.
*/
- void unregister_call(const std::string &key);
+ void unregister_call(const std::string &name);
/*******************************************************************
* Register API - don't look here, template magic, not helpful
******************************************************************/
protected:
template <typename ClassType, typename ReturnType>
- void register_call(const std::string &key, ReturnType(ClassType::*fcn)(void));
+ void register_call(const std::string &name, ReturnType(ClassType::*fcn)(void));
template <typename ClassType>
- void register_call(const std::string &key, void(ClassType::*fcn)(void));
+ void register_call(const std::string &name, void(ClassType::*fcn)(void));
template <typename ClassType, typename ReturnType, typename Arg0>
- void register_call(const std::string &key, ReturnType(ClassType::*fcn)(const Arg0 &));
+ void register_call(const std::string &name, ReturnType(ClassType::*fcn)(const Arg0 &));
template <typename ClassType, typename Arg0>
- void register_call(const std::string &key, void(ClassType::*fcn)(const Arg0 &));
+ void register_call(const std::string &name, void(ClassType::*fcn)(const Arg0 &));
template <typename ClassType, typename ReturnType, typename Arg0, typename Arg1>
- void register_call(const std::string &key, ReturnType(ClassType::*fcn)(const Arg0 &, const Arg1 &));
+ void register_call(const std::string &name, ReturnType(ClassType::*fcn)(const Arg0 &, const Arg1 &));
template <typename ClassType, typename Arg0, typename Arg1>
- void register_call(const std::string &key, void(ClassType::*fcn)(const Arg0 &, const Arg1 &));
+ void register_call(const std::string &name, void(ClassType::*fcn)(const Arg0 &, const Arg1 &));
template <typename ClassType, typename ReturnType, typename Arg0, typename Arg1, typename Arg2>
- void register_call(const std::string &key, ReturnType(ClassType::*fcn)(const Arg0 &, const Arg1 &, const Arg2 &));
+ void register_call(const std::string &name, ReturnType(ClassType::*fcn)(const Arg0 &, const Arg1 &, const Arg2 &));
template <typename ClassType, typename Arg0, typename Arg1, typename Arg2>
- void register_call(const std::string &key, void(ClassType::*fcn)(const Arg0 &, const Arg1 &, const Arg2 &));
+ void register_call(const std::string &name, void(ClassType::*fcn)(const Arg0 &, const Arg1 &, const Arg2 &));
/*******************************************************************
* Call API - don't look here, template magic, not helpful
******************************************************************/
public:
template <typename ReturnType>
- ReturnType x(const std::string &key);
+ ReturnType x(const std::string &name);
inline
- void x(const std::string &key);
+ void x(const std::string &name);
template <typename ReturnType, typename Arg0>
- ReturnType x(const std::string &key, const Arg0 &);
+ ReturnType x(const std::string &name, const Arg0 &);
template <typename Arg0>
- void x(const std::string &key, const Arg0 &);
+ void x(const std::string &name, const Arg0 &);
template <typename ReturnType, typename Arg0, typename Arg1>
- ReturnType x(const std::string &key, const Arg0 &, const Arg1 &);
+ ReturnType x(const std::string &name, const Arg0 &, const Arg1 &);
template <typename Arg0, typename Arg1>
- void x(const std::string &key, const Arg0 &, const Arg1 &);
+ void x(const std::string &name, const Arg0 &, const Arg1 &);
template <typename ReturnType, typename Arg0, typename Arg1, typename Arg2>
- ReturnType x(const std::string &key, const Arg0 &, const Arg1 &, const Arg2 &);
+ ReturnType x(const std::string &name, const Arg0 &, const Arg1 &, const Arg2 &);
template <typename Arg0, typename Arg1, typename Arg2>
- void x(const std::string &key, const Arg0 &, const Arg1 &, const Arg2 &);
+ void x(const std::string &name, const Arg0 &, const Arg1 &, const Arg2 &);
/*******************************************************************
* Private registration hooks
diff --git a/include/gras/detail/callable.hpp b/include/gras/detail/callable.hpp
index ddc8f55..98fa29d 100644
--- a/include/gras/detail/callable.hpp
+++ b/include/gras/detail/callable.hpp
@@ -35,11 +35,11 @@ struct CallableRegistryEntryImpl0 : CallableRegistryEntry
};
template <typename ClassType, typename ReturnType>
-void Callable::register_call(const std::string &key, ReturnType(ClassType::*fcn)(void))
+void Callable::register_call(const std::string &name, ReturnType(ClassType::*fcn)(void))
{
ClassType *obj = dynamic_cast<ClassType *>(this);
void *fr = new CallableRegistryEntryImpl0<ClassType, ReturnType>(obj, fcn);
- _register_call(key, fr);
+ _register_call(name, fr);
}
template <typename ClassType>
@@ -56,11 +56,11 @@ struct CallableRegistryEntryImplVoid0 : CallableRegistryEntry
};
template <typename ClassType>
-void Callable::register_call(const std::string &key, void(ClassType::*fcn)(void))
+void Callable::register_call(const std::string &name, void(ClassType::*fcn)(void))
{
ClassType *obj = dynamic_cast<ClassType *>(this);
void *fr = new CallableRegistryEntryImplVoid0<ClassType>(obj, fcn);
- _register_call(key, fr);
+ _register_call(name, fr);
}
/***********************************************************************
@@ -81,11 +81,11 @@ struct CallableRegistryEntryImpl1 : CallableRegistryEntry
};
template <typename ClassType, typename ReturnType, typename Arg0>
-void Callable::register_call(const std::string &key, ReturnType(ClassType::*fcn)(const Arg0 &))
+void Callable::register_call(const std::string &name, ReturnType(ClassType::*fcn)(const Arg0 &))
{
ClassType *obj = dynamic_cast<ClassType *>(this);
void *fr = new CallableRegistryEntryImpl1<ClassType, ReturnType, Arg0>(obj, fcn);
- _register_call(key, fr);
+ _register_call(name, fr);
}
template <typename ClassType, typename Arg0>
@@ -103,11 +103,11 @@ struct CallableRegistryEntryImplVoid1 : CallableRegistryEntry
};
template <typename ClassType, typename Arg0>
-void Callable::register_call(const std::string &key, void(ClassType::*fcn)(const Arg0 &))
+void Callable::register_call(const std::string &name, void(ClassType::*fcn)(const Arg0 &))
{
ClassType *obj = dynamic_cast<ClassType *>(this);
void *fr = new CallableRegistryEntryImplVoid1<ClassType, Arg0>(obj, fcn);
- _register_call(key, fr);
+ _register_call(name, fr);
}
/***********************************************************************
@@ -128,11 +128,11 @@ struct CallableRegistryEntryImpl2 : CallableRegistryEntry
};
template <typename ClassType, typename ReturnType, typename Arg0, typename Arg1>
-void Callable::register_call(const std::string &key, ReturnType(ClassType::*fcn)(const Arg0 &, const Arg1 &))
+void Callable::register_call(const std::string &name, ReturnType(ClassType::*fcn)(const Arg0 &, const Arg1 &))
{
ClassType *obj = dynamic_cast<ClassType *>(this);
void *fr = new CallableRegistryEntryImpl2<ClassType, ReturnType, Arg0, Arg1>(obj, fcn);
- _register_call(key, fr);
+ _register_call(name, fr);
}
template <typename ClassType, typename Arg0, typename Arg1>
@@ -150,11 +150,11 @@ struct CallableRegistryEntryImplVoid2 : CallableRegistryEntry
};
template <typename ClassType, typename Arg0, typename Arg1>
-void Callable::register_call(const std::string &key, void(ClassType::*fcn)(const Arg0 &, const Arg1 &))
+void Callable::register_call(const std::string &name, void(ClassType::*fcn)(const Arg0 &, const Arg1 &))
{
ClassType *obj = dynamic_cast<ClassType *>(this);
void *fr = new CallableRegistryEntryImplVoid2<ClassType, Arg0, Arg1>(obj, fcn);
- _register_call(key, fr);
+ _register_call(name, fr);
}
/***********************************************************************
@@ -175,11 +175,11 @@ struct CallableRegistryEntryImpl3 : CallableRegistryEntry
};
template <typename ClassType, typename ReturnType, typename Arg0, typename Arg1, typename Arg2>
-void Callable::register_call(const std::string &key, ReturnType(ClassType::*fcn)(const Arg0 &, const Arg1 &, const Arg2 &))
+void Callable::register_call(const std::string &name, ReturnType(ClassType::*fcn)(const Arg0 &, const Arg1 &, const Arg2 &))
{
ClassType *obj = dynamic_cast<ClassType *>(this);
void *fr = new CallableRegistryEntryImpl3<ClassType, ReturnType, Arg0, Arg1, Arg2>(obj, fcn);
- _register_call(key, fr);
+ _register_call(name, fr);
}
template <typename ClassType, typename Arg0, typename Arg1, typename Arg2>
@@ -197,95 +197,95 @@ struct CallableRegistryEntryImplVoid3 : CallableRegistryEntry
};
template <typename ClassType, typename Arg0, typename Arg1, typename Arg2>
-void Callable::register_call(const std::string &key, void(ClassType::*fcn)(const Arg0 &, const Arg1 &, const Arg2 &))
+void Callable::register_call(const std::string &name, void(ClassType::*fcn)(const Arg0 &, const Arg1 &, const Arg2 &))
{
ClassType *obj = dynamic_cast<ClassType *>(this);
void *fr = new CallableRegistryEntryImplVoid3<ClassType, Arg0, Arg1, Arg2>(obj, fcn);
- _register_call(key, fr);
+ _register_call(name, fr);
}
/***********************************************************************
* Call implementations with 0 args
**********************************************************************/
template <typename ReturnType>
-ReturnType Callable::x(const std::string &key)
+ReturnType Callable::x(const std::string &name)
{
PMCList args(0);
- PMCC r = _handle_call(key, PMC_M(args));
+ PMCC r = _handle_call(name, PMC_M(args));
return r.safe_as<ReturnType>();
}
inline
-void Callable::x(const std::string &key)
+void Callable::x(const std::string &name)
{
PMCList args(0);
- _handle_call(key, PMC_M(args));
+ _handle_call(name, PMC_M(args));
}
/***********************************************************************
* Call implementations with 1 args
**********************************************************************/
template <typename ReturnType, typename Arg0>
-ReturnType Callable::x(const std::string &key, const Arg0 &a0)
+ReturnType Callable::x(const std::string &name, const Arg0 &a0)
{
PMCList args(1);
args[0] = PMC_M(a0);
- PMCC r = _handle_call(key, PMC_M(args));
+ PMCC r = _handle_call(name, PMC_M(args));
return r.safe_as<ReturnType>();
}
template <typename Arg0>
-void Callable::x(const std::string &key, const Arg0 &a0)
+void Callable::x(const std::string &name, const Arg0 &a0)
{
PMCList args(1);
args[0] = PMC_M(a0);
- _handle_call(key, PMC_M(args));
+ _handle_call(name, PMC_M(args));
}
/***********************************************************************
* Call implementations with 2 args
**********************************************************************/
template <typename ReturnType, typename Arg0, typename Arg1>
-ReturnType Callable::x(const std::string &key, const Arg0 &a0, const Arg1 &a1)
+ReturnType Callable::x(const std::string &name, const Arg0 &a0, const Arg1 &a1)
{
PMCList args(2);
args[0] = PMC_M(a0);
args[1] = PMC_M(a1);
- PMCC r = _handle_call(key, PMC_M(args));
+ PMCC r = _handle_call(name, PMC_M(args));
return r.safe_as<ReturnType>();
}
template <typename Arg0, typename Arg1>
-void Callable::x(const std::string &key, const Arg0 &a0, const Arg1 &a1)
+void Callable::x(const std::string &name, const Arg0 &a0, const Arg1 &a1)
{
PMCList args(2);
args[0] = PMC_M(a0);
args[1] = PMC_M(a1);
- _handle_call(key, PMC_M(args));
+ _handle_call(name, PMC_M(args));
}
/***********************************************************************
* Call implementations with 3 args
**********************************************************************/
template <typename ReturnType, typename Arg0, typename Arg1, typename Arg2>
-ReturnType Callable::x(const std::string &key, const Arg0 &a0, const Arg1 &a1, const Arg2 &a2)
+ReturnType Callable::x(const std::string &name, const Arg0 &a0, const Arg1 &a1, const Arg2 &a2)
{
PMCList args(3);
args[0] = PMC_M(a0);
args[1] = PMC_M(a1);
args[2] = PMC_M(a2);
- PMCC r = _handle_call(key, PMC_M(args));
+ PMCC r = _handle_call(name, PMC_M(args));
return r.safe_as<ReturnType>();
}
template <typename Arg0, typename Arg1, typename Arg2>
-void Callable::x(const std::string &key, const Arg0 &a0, const Arg1 &a1, const Arg2 &a2)
+void Callable::x(const std::string &name, const Arg0 &a0, const Arg1 &a1, const Arg2 &a2)
{
PMCList args(3);
args[0] = PMC_M(a0);
args[1] = PMC_M(a1);
args[2] = PMC_M(a2);
- _handle_call(key, PMC_M(args));
+ _handle_call(name, PMC_M(args));
}
} //namespace gras
diff --git a/include/gras/element.i b/include/gras/element.i
index 5857548..d462370 100644
--- a/include/gras/element.i
+++ b/include/gras/element.i
@@ -40,9 +40,9 @@ from PMC import *
{
%insert("python")
%{
- def x(self, key, *args):
+ def x(self, name, *args):
pmcargs = PMC_M(list(args))
- pmcret = self._handle_call(key, pmcargs)
+ pmcret = self._handle_call(name, pmcargs)
return pmcret()
def __getattr__(self, name):