convert.cpp debuginfo.cpp dictionary.cpp dictionary-script.cpp dynamicobject.cpp dynamicobject.thpp dynamictype.cpp
exception.cpp fifo.cpp filelogger.cpp filelogger.thpp initialize.cpp json.cpp logger.cpp logger.thpp math-script.cpp
netstring.cpp networkstream.cpp number.cpp number-script.cpp object.cpp object-script.cpp primitivetype.cpp process.cpp
- ringbuffer.cpp scriptframe.cpp scriptfunction.cpp scriptfunction-script.cpp scriptfunctionwrapper.cpp scriptglobal.cpp
+ ringbuffer.cpp scriptframe.cpp function.cpp function-script.cpp functionwrapper.cpp scriptglobal.cpp
scriptutils.cpp serializer.cpp socket.cpp stacktrace.cpp
statsfunction.cpp stdiostream.cpp stream.cpp streamlogger.cpp streamlogger.thpp string.cpp string-script.cpp
sysloglogger.cpp sysloglogger.thpp tcpsocket.cpp thinmutex.cpp threadpool.cpp timer.cpp
******************************************************************************/
#include "base/array.hpp"
-#include "base/scriptfunction.hpp"
-#include "base/scriptfunctionwrapper.hpp"
+#include "base/function.hpp"
+#include "base/functionwrapper.hpp"
#include "base/scriptframe.hpp"
#include "base/objectlock.hpp"
self->Clear();
}
-static bool ArraySortCmp(const ScriptFunction::Ptr& cmp, const Value& a, const Value& b)
+static bool ArraySortCmp(const Function::Ptr& cmp, const Value& a, const Value& b)
{
std::vector<Value> args;
args.push_back(a);
if (!prototype) {
prototype = new Dictionary();
- prototype->Set("len", new ScriptFunction(WrapScriptFunction(ArrayLen)));
- prototype->Set("set", new ScriptFunction(WrapScriptFunction(ArraySet)));
- prototype->Set("add", new ScriptFunction(WrapScriptFunction(ArrayAdd)));
- prototype->Set("remove", new ScriptFunction(WrapScriptFunction(ArrayRemove)));
- prototype->Set("contains", new ScriptFunction(WrapScriptFunction(ArrayContains)));
- prototype->Set("clear", new ScriptFunction(WrapScriptFunction(ArrayClear)));
- prototype->Set("sort", new ScriptFunction(WrapScriptFunction(ArraySort)));
- prototype->Set("clone", new ScriptFunction(WrapScriptFunction(ArrayClone)));
+ prototype->Set("len", new Function(WrapFunction(ArrayLen)));
+ prototype->Set("set", new Function(WrapFunction(ArraySet)));
+ prototype->Set("add", new Function(WrapFunction(ArrayAdd)));
+ prototype->Set("remove", new Function(WrapFunction(ArrayRemove)));
+ prototype->Set("contains", new Function(WrapFunction(ArrayContains)));
+ prototype->Set("clear", new Function(WrapFunction(ArrayClear)));
+ prototype->Set("sort", new Function(WrapFunction(ArraySort)));
+ prototype->Set("clone", new Function(WrapFunction(ArrayClone)));
}
return prototype;
#include "base/boolean.hpp"
#include "base/convert.hpp"
-#include "base/scriptfunction.hpp"
-#include "base/scriptfunctionwrapper.hpp"
+#include "base/function.hpp"
+#include "base/functionwrapper.hpp"
#include "base/scriptframe.hpp"
using namespace icinga;
if (!prototype) {
prototype = new Dictionary();
- prototype->Set("to_string", new ScriptFunction(WrapScriptFunction(BooleanToString)));
+ prototype->Set("to_string", new Function(WrapFunction(BooleanToString)));
}
return prototype;
******************************************************************************/
#include "base/dictionary.hpp"
-#include "base/scriptfunction.hpp"
-#include "base/scriptfunctionwrapper.hpp"
+#include "base/function.hpp"
+#include "base/functionwrapper.hpp"
#include "base/scriptframe.hpp"
using namespace icinga;
if (!prototype) {
prototype = new Dictionary();
- prototype->Set("len", new ScriptFunction(WrapScriptFunction(DictionaryLen)));
- prototype->Set("set", new ScriptFunction(WrapScriptFunction(DictionarySet)));
- prototype->Set("remove", new ScriptFunction(WrapScriptFunction(DictionaryRemove)));
- prototype->Set("contains", new ScriptFunction(WrapScriptFunction(DictionaryContains)));
- prototype->Set("clone", new ScriptFunction(WrapScriptFunction(DictionaryClone)));
+ prototype->Set("len", new Function(WrapFunction(DictionaryLen)));
+ prototype->Set("set", new Function(WrapFunction(DictionarySet)));
+ prototype->Set("remove", new Function(WrapFunction(DictionaryRemove)));
+ prototype->Set("contains", new Function(WrapFunction(DictionaryContains)));
+ prototype->Set("clone", new Function(WrapFunction(DictionaryClone)));
}
return prototype;
#include "base/objectlock.hpp"
#include "base/logger.hpp"
#include "base/exception.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include "base/initialize.hpp"
#include "base/workqueue.hpp"
#include "base/context.hpp"
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
-#include "base/scriptfunction.hpp"
-#include "base/scriptfunctionwrapper.hpp"
+#include "base/function.hpp"
+#include "base/functionwrapper.hpp"
#include "base/scriptframe.hpp"
#include "base/objectlock.hpp"
#include "base/exception.hpp"
using namespace icinga;
-static Value ScriptFunctionCall(const std::vector<Value>& args)
+static Value FunctionCall(const std::vector<Value>& args)
{
if (args.size() < 1)
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for call()"));
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
- ScriptFunction::Ptr self = static_cast<ScriptFunction::Ptr>(vframe->Self);
+ Function::Ptr self = static_cast<Function::Ptr>(vframe->Self);
ScriptFrame uframe(args[0]);
std::vector<Value> uargs(args.begin() + 1, args.end());
return self->Invoke(uargs);
}
-static Value ScriptFunctionCallV(const Value& thisArg, const Array::Ptr& args)
+static Value FunctionCallV(const Value& thisArg, const Array::Ptr& args)
{
ScriptFrame *vframe = ScriptFrame::GetCurrentFrame();
- ScriptFunction::Ptr self = static_cast<ScriptFunction::Ptr>(vframe->Self);
+ Function::Ptr self = static_cast<Function::Ptr>(vframe->Self);
ScriptFrame uframe(thisArg);
std::vector<Value> uargs;
}
-Object::Ptr ScriptFunction::GetPrototype(void)
+Object::Ptr Function::GetPrototype(void)
{
static Dictionary::Ptr prototype;
if (!prototype) {
prototype = new Dictionary();
- prototype->Set("call", new ScriptFunction(WrapScriptFunction(ScriptFunctionCall)));
- prototype->Set("callv", new ScriptFunction(WrapScriptFunction(ScriptFunctionCallV)));
+ prototype->Set("call", new Function(WrapFunction(FunctionCall)));
+ prototype->Set("callv", new Function(WrapFunction(FunctionCallV)));
}
return prototype;
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include "base/primitivetype.hpp"
#include "base/dictionary.hpp"
using namespace icinga;
-REGISTER_PRIMITIVE_TYPE(ScriptFunction, ScriptFunction::GetPrototype());
+REGISTER_PRIMITIVE_TYPE(Function, Function::GetPrototype());
-ScriptFunction::ScriptFunction(const Callback& function)
+Function::Function(const Callback& function)
: m_Callback(function)
{ }
-Value ScriptFunction::Invoke(const std::vector<Value>& arguments)
+Value Function::Invoke(const std::vector<Value>& arguments)
{
return m_Callback(arguments);
}
#include "base/i2-base.hpp"
#include "base/value.hpp"
-#include "base/scriptfunctionwrapper.hpp"
+#include "base/functionwrapper.hpp"
#include "base/scriptglobal.hpp"
#include <vector>
#include <boost/function.hpp>
*
* @ingroup base
*/
-class I2_BASE_API ScriptFunction : public Object
+class I2_BASE_API Function : public Object
{
public:
- DECLARE_OBJECT(ScriptFunction);
+ DECLARE_OBJECT(Function);
typedef boost::function<Value (const std::vector<Value>& arguments)> Callback;
- ScriptFunction(const Callback& function);
+ Function(const Callback& function);
Value Invoke(const std::vector<Value>& arguments);
#define REGISTER_SCRIPTFUNCTION(name, callback) \
namespace { namespace UNIQUE_NAME(sf) { namespace sf ## name { \
void RegisterFunction(void) { \
- ScriptFunction::Ptr sf = new icinga::ScriptFunction(WrapScriptFunction(callback)); \
+ Function::Ptr sf = new icinga::Function(WrapFunction(callback)); \
ScriptGlobal::Set(#name, sf); \
} \
INITIALIZE_ONCE(RegisterFunction); \
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
******************************************************************************/
-#include "base/scriptfunctionwrapper.hpp"
+#include "base/functionwrapper.hpp"
using namespace icinga;
-Value icinga::ScriptFunctionWrapperVV(void (*function)(void), const std::vector<Value>&)
+Value icinga::FunctionWrapperVV(void (*function)(void), const std::vector<Value>&)
{
function();
return Empty;
}
-Value icinga::ScriptFunctionWrapperVA(void (*function)(const std::vector<Value>&), const std::vector<Value>& arguments)
+Value icinga::FunctionWrapperVA(void (*function)(const std::vector<Value>&), const std::vector<Value>& arguments)
{
function(arguments);
return Empty;
}
-boost::function<Value (const std::vector<Value>& arguments)> icinga::WrapScriptFunction(void (*function)(void))
+boost::function<Value (const std::vector<Value>& arguments)> icinga::WrapFunction(void (*function)(void))
{
- return boost::bind(&ScriptFunctionWrapperVV, function, _1);
+ return boost::bind(&FunctionWrapperVV, function, _1);
}
namespace icinga
{
-Value ScriptFunctionWrapperVV(void (*function)(void), const std::vector<Value>& arguments);
-Value ScriptFunctionWrapperVA(void (*function)(const std::vector<Value>&), const std::vector<Value>& arguments);
+Value FunctionWrapperVV(void (*function)(void), const std::vector<Value>& arguments);
+Value FunctionWrapperVA(void (*function)(const std::vector<Value>&), const std::vector<Value>& arguments);
-boost::function<Value (const std::vector<Value>& arguments)> I2_BASE_API WrapScriptFunction(void (*function)(void));
+boost::function<Value (const std::vector<Value>& arguments)> I2_BASE_API WrapFunction(void (*function)(void));
template<typename TR>
-Value ScriptFunctionWrapperR(TR (*function)(void), const std::vector<Value>&)
+Value FunctionWrapperR(TR (*function)(void), const std::vector<Value>&)
{
return function();
}
template<typename TR>
-boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(TR (*function)(void))
+boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(TR (*function)(void))
{
- return boost::bind(&ScriptFunctionWrapperR<TR>, function, _1);
+ return boost::bind(&FunctionWrapperR<TR>, function, _1);
}
template<typename T0>
-Value ScriptFunctionWrapperV(void (*function)(T0), const std::vector<Value>& arguments)
+Value FunctionWrapperV(void (*function)(T0), const std::vector<Value>& arguments)
{
if (arguments.size() < 1)
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
}
template<typename T0>
-boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(void (*function)(T0))
+boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(void (*function)(T0))
{
- return boost::bind(&ScriptFunctionWrapperV<T0>, function, _1);
+ return boost::bind(&FunctionWrapperV<T0>, function, _1);
}
template<typename TR, typename T0>
-Value ScriptFunctionWrapperR(TR (*function)(T0), const std::vector<Value>& arguments)
+Value FunctionWrapperR(TR (*function)(T0), const std::vector<Value>& arguments)
{
if (arguments.size() < 1)
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
}
template<typename TR, typename T0>
-boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(TR (*function)(T0))
+boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(TR (*function)(T0))
{
- return boost::bind(&ScriptFunctionWrapperR<TR, T0>, function, _1);
+ return boost::bind(&FunctionWrapperR<TR, T0>, function, _1);
}
template<typename T0, typename T1>
-Value ScriptFunctionWrapperV(void (*function)(T0, T1), const std::vector<Value>& arguments)
+Value FunctionWrapperV(void (*function)(T0, T1), const std::vector<Value>& arguments)
{
if (arguments.size() < 2)
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
}
template<typename T0, typename T1>
-boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(void (*function)(T0, T1))
+boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(void (*function)(T0, T1))
{
- return boost::bind(&ScriptFunctionWrapperV<T0, T1>, function, _1);
+ return boost::bind(&FunctionWrapperV<T0, T1>, function, _1);
}
template<typename TR, typename T0, typename T1>
-Value ScriptFunctionWrapperR(TR (*function)(T0, T1), const std::vector<Value>& arguments)
+Value FunctionWrapperR(TR (*function)(T0, T1), const std::vector<Value>& arguments)
{
if (arguments.size() < 2)
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
}
template<typename TR, typename T0, typename T1>
-boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(TR (*function)(T0, T1))
+boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(TR (*function)(T0, T1))
{
- return boost::bind(&ScriptFunctionWrapperR<TR, T0, T1>, function, _1);
+ return boost::bind(&FunctionWrapperR<TR, T0, T1>, function, _1);
}
template<typename T0, typename T1, typename T2>
-Value ScriptFunctionWrapperV(void (*function)(T0, T1, T2), const std::vector<Value>& arguments)
+Value FunctionWrapperV(void (*function)(T0, T1, T2), const std::vector<Value>& arguments)
{
if (arguments.size() < 3)
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
}
template<typename T0, typename T1, typename T2>
-boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(void (*function)(T0, T1, T2))
+boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(void (*function)(T0, T1, T2))
{
- return boost::bind(&ScriptFunctionWrapperV<T0, T1, T2>, function, _1);
+ return boost::bind(&FunctionWrapperV<T0, T1, T2>, function, _1);
}
template<typename TR, typename T0, typename T1, typename T2>
-Value ScriptFunctionWrapperR(TR (*function)(T0, T1, T2), const std::vector<Value>& arguments)
+Value FunctionWrapperR(TR (*function)(T0, T1, T2), const std::vector<Value>& arguments)
{
if (arguments.size() < 3)
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
}
template<typename TR, typename T0, typename T1, typename T2>
-boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(TR (*function)(T0, T1, T2))
+boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(TR (*function)(T0, T1, T2))
{
- return boost::bind(&ScriptFunctionWrapperR<TR, T0, T1, T2>, function, _1);
+ return boost::bind(&FunctionWrapperR<TR, T0, T1, T2>, function, _1);
}
template<typename T0, typename T1, typename T2, typename T3>
-Value ScriptFunctionWrapperV(void (*function)(T0, T1, T2, T3), const std::vector<Value>& arguments)
+Value FunctionWrapperV(void (*function)(T0, T1, T2, T3), const std::vector<Value>& arguments)
{
if (arguments.size() < 4)
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
}
template<typename T0, typename T1, typename T2, typename T3>
-boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(void (*function)(T0, T1, T2, T3))
+boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(void (*function)(T0, T1, T2, T3))
{
- return boost::bind(&ScriptFunctionWrapperV<T0, T1, T2, T3>, function, _1);
+ return boost::bind(&FunctionWrapperV<T0, T1, T2, T3>, function, _1);
}
template<typename TR, typename T0, typename T1, typename T2, typename T3>
-Value ScriptFunctionWrapperR(TR (*function)(T0, T1, T2, T3), const std::vector<Value>& arguments)
+Value FunctionWrapperR(TR (*function)(T0, T1, T2, T3), const std::vector<Value>& arguments)
{
if (arguments.size() < 4)
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
}
template<typename TR, typename T0, typename T1, typename T2, typename T3>
-boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(TR (*function)(T0, T1, T2, T3))
+boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(TR (*function)(T0, T1, T2, T3))
{
- return boost::bind(&ScriptFunctionWrapperR<TR, T0, T1, T2, T3>, function, _1);
+ return boost::bind(&FunctionWrapperR<TR, T0, T1, T2, T3>, function, _1);
}
template<typename T0, typename T1, typename T2, typename T3, typename T4>
-Value ScriptFunctionWrapperV(void (*function)(T0, T1, T2, T3, T4), const std::vector<Value>& arguments)
+Value FunctionWrapperV(void (*function)(T0, T1, T2, T3, T4), const std::vector<Value>& arguments)
{
if (arguments.size() < 5)
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
}
template<typename T0, typename T1, typename T2, typename T3, typename T4>
-boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(void (*function)(T0, T1, T2, T3, T4))
+boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(void (*function)(T0, T1, T2, T3, T4))
{
- return boost::bind(&ScriptFunctionWrapperV<T0, T1, T2, T3, T4>, function, _1);
+ return boost::bind(&FunctionWrapperV<T0, T1, T2, T3, T4>, function, _1);
}
template<typename TR, typename T0, typename T1, typename T2, typename T3, typename T4>
-Value ScriptFunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4), const std::vector<Value>& arguments)
+Value FunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4), const std::vector<Value>& arguments)
{
if (arguments.size() < 5)
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
}
template<typename TR, typename T0, typename T1, typename T2, typename T3, typename T4>
-boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(TR (*function)(T0, T1, T2, T3, T4))
+boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(TR (*function)(T0, T1, T2, T3, T4))
{
- return boost::bind(&ScriptFunctionWrapperR<TR, T0, T1, T2, T3, T4>, function, _1);
+ return boost::bind(&FunctionWrapperR<TR, T0, T1, T2, T3, T4>, function, _1);
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
-Value ScriptFunctionWrapperV(void (*function)(T0, T1, T2, T3, T4, T5), const std::vector<Value>& arguments)
+Value FunctionWrapperV(void (*function)(T0, T1, T2, T3, T4, T5), const std::vector<Value>& arguments)
{
if (arguments.size() < 6)
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
-boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(void (*function)(T0, T1, T2, T3, T4, T5))
+boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(void (*function)(T0, T1, T2, T3, T4, T5))
{
- return boost::bind(&ScriptFunctionWrapperV<T0, T1, T2, T3, T4, T5>, function, _1);
+ return boost::bind(&FunctionWrapperV<T0, T1, T2, T3, T4, T5>, function, _1);
}
template<typename TR, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
-Value ScriptFunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4, T5), const std::vector<Value>& arguments)
+Value FunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4, T5), const std::vector<Value>& arguments)
{
if (arguments.size() < 6)
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
}
template<typename TR, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5>
-boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(TR (*function)(T0, T1, T2, T3, T4, T5))
+boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(TR (*function)(T0, T1, T2, T3, T4, T5))
{
- return boost::bind(&ScriptFunctionWrapperR<TR, T0, T1, T2, T3, T4, T5>, function, _1);
+ return boost::bind(&FunctionWrapperR<TR, T0, T1, T2, T3, T4, T5>, function, _1);
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
-Value ScriptFunctionWrapperV(void (*function)(T0, T1, T2, T3, T4, T5, T6), const std::vector<Value>& arguments)
+Value FunctionWrapperV(void (*function)(T0, T1, T2, T3, T4, T5, T6), const std::vector<Value>& arguments)
{
if (arguments.size() < 7)
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
-boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(void (*function)(T0, T1, T2, T3, T4, T5, T6))
+boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(void (*function)(T0, T1, T2, T3, T4, T5, T6))
{
- return boost::bind(&ScriptFunctionWrapperV<T0, T1, T2, T3, T4, T5, T6>, function, _1);
+ return boost::bind(&FunctionWrapperV<T0, T1, T2, T3, T4, T5, T6>, function, _1);
}
template<typename TR, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
-Value ScriptFunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4, T5, T6), const std::vector<Value>& arguments)
+Value FunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4, T5, T6), const std::vector<Value>& arguments)
{
if (arguments.size() < 7)
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
}
template<typename TR, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
-boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(TR (*function)(T0, T1, T2, T3, T4, T5, T6))
+boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(TR (*function)(T0, T1, T2, T3, T4, T5, T6))
{
- return boost::bind(&ScriptFunctionWrapperR<TR, T0, T1, T2, T3, T4, T5, T6>, function, _1);
+ return boost::bind(&FunctionWrapperR<TR, T0, T1, T2, T3, T4, T5, T6>, function, _1);
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
-Value ScriptFunctionWrapperV(void (*function)(T0, T1, T2, T3, T4, T5, T6, T7), const std::vector<Value>& arguments)
+Value FunctionWrapperV(void (*function)(T0, T1, T2, T3, T4, T5, T6, T7), const std::vector<Value>& arguments)
{
if (arguments.size() < 8)
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
}
template<typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
-boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(void (*function)(T0, T1, T2, T3, T4, T5, T6, T7))
+boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(void (*function)(T0, T1, T2, T3, T4, T5, T6, T7))
{
- return boost::bind(&ScriptFunctionWrapperV<T0, T1, T2, T3, T4, T5, T6, T7>, function, _1);
+ return boost::bind(&FunctionWrapperV<T0, T1, T2, T3, T4, T5, T6, T7>, function, _1);
}
template<typename TR, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
-Value ScriptFunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4, T5, T6, T7), const std::vector<Value>& arguments)
+Value FunctionWrapperR(TR (*function)(T0, T1, T2, T3, T4, T5, T6, T7), const std::vector<Value>& arguments)
{
if (arguments.size() < 8)
BOOST_THROW_EXCEPTION(std::invalid_argument("Too few arguments for function."));
}
template<typename TR, typename T0, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7>
-boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(TR (*function)(T0, T1, T2, T3, T4, T5, T6, T7))
+boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(TR (*function)(T0, T1, T2, T3, T4, T5, T6, T7))
{
- return boost::bind(&ScriptFunctionWrapperR<TR, T0, T1, T2, T3, T4, T5, T6, T7>, function, _1);
+ return boost::bind(&FunctionWrapperR<TR, T0, T1, T2, T3, T4, T5, T6, T7>, function, _1);
}
template<typename TR>
-boost::function<TR (const std::vector<Value>& arguments)> WrapScriptFunction(TR (*function)(const std::vector<Value>&))
+boost::function<TR (const std::vector<Value>& arguments)> WrapFunction(TR (*function)(const std::vector<Value>&))
{
return boost::bind<TR>(function, _1);
}
-inline boost::function<Value (const std::vector<Value>& arguments)> WrapScriptFunction(void (*function)(const std::vector<Value>&))
+inline boost::function<Value (const std::vector<Value>& arguments)> WrapFunction(void (*function)(const std::vector<Value>&))
{
- return boost::bind(&ScriptFunctionWrapperVA, function, _1);
+ return boost::bind(&FunctionWrapperVA, function, _1);
}
}
******************************************************************************/
#include "base/dictionary.hpp"
-#include "base/scriptfunction.hpp"
-#include "base/scriptfunctionwrapper.hpp"
+#include "base/function.hpp"
+#include "base/functionwrapper.hpp"
#include "base/scriptframe.hpp"
#include "base/initialize.hpp"
#include <boost/math/special_functions/round.hpp>
mathObj->Set("SQRT2", 1.41421356237309504880);
/* Methods */
- mathObj->Set("abs", new ScriptFunction(WrapScriptFunction(MathAbs)));
- mathObj->Set("acos", new ScriptFunction(WrapScriptFunction(MathAcos)));
- mathObj->Set("asin", new ScriptFunction(WrapScriptFunction(MathAsin)));
- mathObj->Set("atan", new ScriptFunction(WrapScriptFunction(MathAtan)));
- mathObj->Set("atan2", new ScriptFunction(WrapScriptFunction(MathAtan2)));
- mathObj->Set("ceil", new ScriptFunction(WrapScriptFunction(MathCeil)));
- mathObj->Set("cos", new ScriptFunction(WrapScriptFunction(MathCos)));
- mathObj->Set("exp", new ScriptFunction(WrapScriptFunction(MathExp)));
- mathObj->Set("floor", new ScriptFunction(WrapScriptFunction(MathFloor)));
- mathObj->Set("log", new ScriptFunction(WrapScriptFunction(MathLog)));
- mathObj->Set("max", new ScriptFunction(WrapScriptFunction(MathMax)));
- mathObj->Set("min", new ScriptFunction(WrapScriptFunction(MathMin)));
- mathObj->Set("pow", new ScriptFunction(WrapScriptFunction(MathPow)));
- mathObj->Set("random", new ScriptFunction(WrapScriptFunction(MathRandom)));
- mathObj->Set("round", new ScriptFunction(WrapScriptFunction(MathRound)));
- mathObj->Set("sin", new ScriptFunction(WrapScriptFunction(MathSin)));
- mathObj->Set("sqrt", new ScriptFunction(WrapScriptFunction(MathSqrt)));
- mathObj->Set("tan", new ScriptFunction(WrapScriptFunction(MathTan)));
- mathObj->Set("isnan", new ScriptFunction(WrapScriptFunction(MathIsnan)));
- mathObj->Set("isinf", new ScriptFunction(WrapScriptFunction(MathIsinf)));
- mathObj->Set("sign", new ScriptFunction(WrapScriptFunction(MathSign)));
+ mathObj->Set("abs", new Function(WrapFunction(MathAbs)));
+ mathObj->Set("acos", new Function(WrapFunction(MathAcos)));
+ mathObj->Set("asin", new Function(WrapFunction(MathAsin)));
+ mathObj->Set("atan", new Function(WrapFunction(MathAtan)));
+ mathObj->Set("atan2", new Function(WrapFunction(MathAtan2)));
+ mathObj->Set("ceil", new Function(WrapFunction(MathCeil)));
+ mathObj->Set("cos", new Function(WrapFunction(MathCos)));
+ mathObj->Set("exp", new Function(WrapFunction(MathExp)));
+ mathObj->Set("floor", new Function(WrapFunction(MathFloor)));
+ mathObj->Set("log", new Function(WrapFunction(MathLog)));
+ mathObj->Set("max", new Function(WrapFunction(MathMax)));
+ mathObj->Set("min", new Function(WrapFunction(MathMin)));
+ mathObj->Set("pow", new Function(WrapFunction(MathPow)));
+ mathObj->Set("random", new Function(WrapFunction(MathRandom)));
+ mathObj->Set("round", new Function(WrapFunction(MathRound)));
+ mathObj->Set("sin", new Function(WrapFunction(MathSin)));
+ mathObj->Set("sqrt", new Function(WrapFunction(MathSqrt)));
+ mathObj->Set("tan", new Function(WrapFunction(MathTan)));
+ mathObj->Set("isnan", new Function(WrapFunction(MathIsnan)));
+ mathObj->Set("isinf", new Function(WrapFunction(MathIsinf)));
+ mathObj->Set("sign", new Function(WrapFunction(MathSign)));
ScriptGlobal::Set("Math", mathObj);
}
#include "base/number.hpp"
#include "base/convert.hpp"
-#include "base/scriptfunction.hpp"
-#include "base/scriptfunctionwrapper.hpp"
+#include "base/function.hpp"
+#include "base/functionwrapper.hpp"
#include "base/scriptframe.hpp"
using namespace icinga;
if (!prototype) {
prototype = new Dictionary();
- prototype->Set("to_string", new ScriptFunction(WrapScriptFunction(NumberToString)));
+ prototype->Set("to_string", new Function(WrapFunction(NumberToString)));
}
return prototype;
#include "base/object.hpp"
#include "base/dictionary.hpp"
-#include "base/scriptfunction.hpp"
-#include "base/scriptfunctionwrapper.hpp"
+#include "base/function.hpp"
+#include "base/functionwrapper.hpp"
#include "base/scriptframe.hpp"
using namespace icinga;
if (!prototype) {
prototype = new Dictionary();
- prototype->Set("to_string", new ScriptFunction(WrapScriptFunction(ObjectToString)));
+ prototype->Set("to_string", new Function(WrapFunction(ObjectToString)));
}
return prototype;
******************************************************************************/
#include "base/scriptutils.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include "base/utility.hpp"
#include "base/convert.hpp"
#include "base/json.hpp"
#include "base/object.hpp"
#include "base/dictionary.hpp"
-#include "base/scriptfunction.hpp"
-#include "base/scriptfunctionwrapper.hpp"
+#include "base/function.hpp"
+#include "base/functionwrapper.hpp"
#include "base/scriptframe.hpp"
#include "base/exception.hpp"
#include <boost/algorithm/string.hpp>
if (!prototype) {
prototype = new Dictionary();
- prototype->Set("len", new ScriptFunction(WrapScriptFunction(StringLen)));
- prototype->Set("to_string", new ScriptFunction(WrapScriptFunction(StringToString)));
- prototype->Set("substr", new ScriptFunction(WrapScriptFunction(StringSubstr)));
- prototype->Set("upper", new ScriptFunction(WrapScriptFunction(StringUpper)));
- prototype->Set("lower", new ScriptFunction(WrapScriptFunction(StringLower)));
- prototype->Set("split", new ScriptFunction(WrapScriptFunction(StringSplit)));
- prototype->Set("find", new ScriptFunction(WrapScriptFunction(StringFind)));
- prototype->Set("replace", new ScriptFunction(WrapScriptFunction(StringReplace)));
+ prototype->Set("len", new Function(WrapFunction(StringLen)));
+ prototype->Set("to_string", new Function(WrapFunction(StringToString)));
+ prototype->Set("substr", new Function(WrapFunction(StringSubstr)));
+ prototype->Set("upper", new Function(WrapFunction(StringUpper)));
+ prototype->Set("lower", new Function(WrapFunction(StringLower)));
+ prototype->Set("split", new Function(WrapFunction(StringSplit)));
+ prototype->Set("find", new Function(WrapFunction(StringFind)));
+ prototype->Set("replace", new Function(WrapFunction(StringReplace)));
}
return prototype;
#include "base/convert.hpp"
#include "base/application.hpp"
#include "base/utility.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include "base/statsfunction.hpp"
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include "base/serializer.hpp"
#include "base/json.hpp"
#include "base/exception.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include <sstream>
#include <fstream>
#include <boost/foreach.hpp>
#include "base/objectlock.hpp"
#include "base/convert.hpp"
#include "base/singleton.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
String validator = ruleList->GetValidator();
if (!validator.IsEmpty()) {
- ScriptFunction::Ptr func = ScriptGlobal::Get(validator, &Empty);
+ Function::Ptr func = ScriptGlobal::Get(validator, &Empty);
if (!func)
BOOST_THROW_EXCEPTION(std::invalid_argument("Validator function '" + validator + "' does not exist."));
String validator = ruleList->GetValidator();
if (!validator.IsEmpty()) {
- ScriptFunction::Ptr func = ScriptGlobal::Get(validator, &Empty);
+ Function::Ptr func = ScriptGlobal::Get(validator, &Empty);
if (!func)
BOOST_THROW_EXCEPTION(std::invalid_argument("Validator function '" + validator + "' does not exist."));
else
vfunc = m_FName->Evaluate(frame);
- if (!vfunc.IsObjectType<ScriptFunction>())
+ if (!vfunc.IsObjectType<Function>())
BOOST_THROW_EXCEPTION(ScriptError("Argument is not a callable object.", m_DebugInfo));
- ScriptFunction::Ptr func = vfunc;
+ Function::Ptr func = vfunc;
std::vector<Value> arguments;
BOOST_FOREACH(Expression *arg, m_Args) {
#include "base/debuginfo.hpp"
#include "base/array.hpp"
#include "base/dictionary.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include "base/exception.hpp"
#include "base/scriptframe.hpp"
#include "base/convert.hpp"
#include "base/debuginfo.hpp"
#include "base/array.hpp"
#include "base/dictionary.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include "base/scriptglobal.hpp"
#include "base/exception.hpp"
#include "base/convert.hpp"
return ScriptGlobal::Get(name);
}
- static inline Value FunctionCall(ScriptFrame& frame, const Value& self, const ScriptFunction::Ptr& func, const std::vector<Value>& arguments)
+ static inline Value FunctionCall(ScriptFrame& frame, const Value& self, const Function::Ptr& func, const std::vector<Value>& arguments)
{
boost::shared_ptr<ScriptFrame> vframe;
static inline Value NewFunction(ScriptFrame& frame, const std::vector<String>& args,
std::map<String, Expression *> *closedVars, const boost::shared_ptr<Expression>& expression)
{
- return new ScriptFunction(boost::bind(&FunctionWrapper, _1, args,
+ return new Function(boost::bind(&FunctionWrapper, _1, args,
EvaluateClosedVars(frame, closedVars), expression));
}
#include "base/utility.hpp"
#include "base/initialize.hpp"
#include "base/logger.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include "base/exception.hpp"
#include <boost/foreach.hpp>
#include "icinga/checkable.hpp"
#include "base/objectlock.hpp"
#include "base/utility.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include "base/exception.hpp"
#include <boost/foreach.hpp>
#include <boost/bind/apply.hpp>
******************************************************************************/
#include "icinga/command.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include "base/exception.hpp"
using namespace icinga;
******************************************************************************/
#include "icinga/customvarobject.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
namespace icinga
{
default {{{ return 60; }}}
};
[config] Dictionary::Ptr env;
- [config] ScriptFunction::Ptr execute;
+ [config] Function::Ptr execute;
};
}
#include "icinga/dependency.hpp"
#include "icinga/service.hpp"
#include "base/logger.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include "base/exception.hpp"
#include <boost/foreach.hpp>
******************************************************************************/
#include "icinga/legacytimeperiod.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include "base/convert.hpp"
#include "base/exception.hpp"
#include "base/objectlock.hpp"
#include "base/exception.hpp"
#include "base/initialize.hpp"
#include "base/scriptglobal.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
******************************************************************************/
#include "icinga/customvarobject.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
namespace icinga
{
}}}
};
[config] Dictionary::Ptr ranges;
- [config] ScriptFunction::Ptr update;
+ [config] Function::Ptr update;
[state] Value valid_begin;
[state] Value valid_end;
[state] Array::Ptr segments;
#include "icinga/usergroup.hpp"
#include "icinga/notification.hpp"
#include "icinga/usergroup.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include "base/objectlock.hpp"
#include "base/exception.hpp"
#include <boost/foreach.hpp>
#include "base/unixsocket.hpp"
#include "base/networkstream.hpp"
#include "base/application.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include "base/statsfunction.hpp"
#include "base/convert.hpp"
#include "icinga/icingaapplication.hpp"
#include "base/dynamictype.hpp"
#include "base/logger.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include "base/utility.hpp"
#include "base/process.hpp"
#include <boost/algorithm/string/classification.hpp>
#include "base/objectlock.hpp"
#include "base/convert.hpp"
#include "base/utility.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include "base/dynamictype.hpp"
#include <boost/algorithm/string/join.hpp>
#include <boost/foreach.hpp>
#include "remote/apilistener.hpp"
#include "remote/endpoint.hpp"
#include "remote/zone.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include <boost/foreach.hpp>
using namespace icinga;
#include "base/application.hpp"
#include "base/objectlock.hpp"
#include "base/utility.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include "base/dynamictype.hpp"
using namespace icinga;
#include "icinga/perfdatavalue.hpp"
#include "base/utility.hpp"
#include "base/convert.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include "base/logger.hpp"
using namespace icinga;
******************************************************************************/
#include "methods/nulleventtask.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include "base/logger.hpp"
using namespace icinga;
#include "icinga/icingaapplication.hpp"
#include "base/dynamictype.hpp"
#include "base/logger.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include "base/utility.hpp"
#include "base/process.hpp"
#include "base/convert.hpp"
#include "icinga/icingaapplication.hpp"
#include "base/dynamictype.hpp"
#include "base/logger.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include "base/utility.hpp"
#include "base/process.hpp"
#include "base/convert.hpp"
#include "icinga/service.hpp"
#include "icinga/macroprocessor.hpp"
#include "icinga/icingaapplication.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include "base/logger.hpp"
#include "base/utility.hpp"
#include "base/process.hpp"
#include "icinga/perfdatavalue.hpp"
#include "base/utility.hpp"
#include "base/convert.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
#include "base/logger.hpp"
using namespace icinga;
******************************************************************************/
#include "methods/timeperiodtask.hpp"
-#include "base/scriptfunction.hpp"
+#include "base/function.hpp"
using namespace icinga;