00001 /* 00002 * SomeInternalFunctionExample.cpp 00003 * 00004 * Created on: Oct 28, 2013 00005 * Author: blackpc 00006 */ 00007 00008 #include <scriptable_monitor/SomeInternalFunctionExample.h> 00009 00010 REGISTER_INTERNAL_FUNCTION(SomeFunction) 00011 00012 string SomeFunction::functionName() 00013 { 00014 return "SomeFunction"; 00015 } 00016 00017 void SomeFunction::process(Parameters& input, Parameters& output) 00018 { 00019 size_t size = input.size(); 00020 double sum = 0; 00021 00022 for(size_t i = 0; i < size; i++) { 00023 double value = input.get<double>(i); 00024 sum += value; 00025 } 00026 00027 double average = sum / size; 00028 00029 output.set<double>(average); 00030 }