All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
function.h
1 /* Copyright (C) MBSim Development Team
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2.1 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library; if not, write to the Free Software
15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16  */
17 
18 #ifndef _MBSIM_FUNCTION_H_
19 #define _MBSIM_FUNCTION_H_
20 
21 #include "mbsim/element.h"
22 #include "fmatvec/function.h"
23 #include <string>
24 #include <xercesc/dom/DOMElement.hpp>
25 
26 namespace {
27  std::string uniqueDummyName(void *p) {
28  std::stringstream str;
29  str<<"Function_"<<p;
30  return str.str();
31  }
32 }
33 
34 namespace MBSim {
35 
37  class FunctionBase : public Element {
38  public:
41  FunctionBase() : Element(uniqueDummyName(this)) {}
42  virtual Element* getDependency() const { return 0; }
43  };
44 
48  template<typename Sig>
49  class Function : public fmatvec::Function<Sig>, public FunctionBase {
50  public:
53  Function() : fmatvec::Function<Sig>(), FunctionBase() {}
54 
55  void initializeUsingXML(xercesc::DOMElement *element);
56  };
57 
58  template<typename Sig>
59  void Function<Sig>::initializeUsingXML(xercesc::DOMElement *element) {
60  FunctionBase::initializeUsingXML(element);
61  if(MBXMLUtils::E(element)->hasAttribute("name"))
62  THROW_MBSIMERROR("No 'name' attribute allowed for Function's.");
63  }
64 
65 }
66 
67 #endif
basic class of MBSim mainly for plotting
Definition: element.h:58
Definition: planar_contour.h:31
Function()
Definition: function.h:53
FunctionBase()
Definition: function.h:41
Definition: function.h:37

Impressum / Disclaimer / Datenschutz Generated by doxygen 1.8.5 Valid HTML