20#ifndef _BOUNDED_FUNCTION_H_
21#define _BOUNDED_FUNCTION_H_
23#include "mbsim/functions/function.h"
24#include "mbsim/utils/utils.h"
31 template<
typename Ret,
typename Arg>
34 double lowerBound, upperBound;
36 BoundedFunction() : lowerBound(-std::numeric_limits<double>::max()), upperBound(std::numeric_limits<double>::max()) { }
37 void setLowerBound(
double lowerBound_) { lowerBound = lowerBound_; }
38 void setUpperBound(
double upperBound_) { upperBound = upperBound_; }
39 int getArgSize()
const override {
return 1; }
40 std::pair<int, int> getRetSize()
const override {
return std::make_pair(1,1); }
41 Ret operator()(
const Arg &x_)
override {
49 void initializeUsingXML(xercesc::DOMElement *element)
override {
50 xercesc::DOMElement *e;
51 e=MBXMLUtils::E(element)->getFirstElementChildNamed(MBSIM%
"lowerBound");
52 setLowerBound(MBXMLUtils::E(e)->getText<double>());
53 e=MBXMLUtils::E(element)->getFirstElementChildNamed(MBSIM%
"upperBound");
54 setUpperBound(MBXMLUtils::E(e)->getText<double>());
Definition: bounded_function.h:29
Definition: function.h:53
namespace MBSim
Definition: bilateral_constraint.cc:30