Simbody  3.7
TextDataEventReporter.h
Go to the documentation of this file.
1 #ifndef SimTK_SIMBODY_TEXT_DATA_EVENT_REPORTER_H_
2 #define SimTK_SIMBODY_TEXT_DATA_EVENT_REPORTER_H_
3 
4 /* -------------------------------------------------------------------------- *
5  * Simbody(tm) *
6  * -------------------------------------------------------------------------- *
7  * This is part of the SimTK biosimulation toolkit originating from *
8  * Simbios, the NIH National Center for Physics-Based Simulation of *
9  * Biological Structures at Stanford, funded under the NIH Roadmap for *
10  * Medical Research, grant U54 GM072970. See https://simtk.org/home/simbody. *
11  * *
12  * Portions copyright (c) 2007-12 Stanford University and the Authors. *
13  * Authors: Peter Eastman *
14  * Contributors: *
15  * *
16  * Licensed under the Apache License, Version 2.0 (the "License"); you may *
17  * not use this file except in compliance with the License. You may obtain a *
18  * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. *
19  * *
20  * Unless required by applicable law or agreed to in writing, software *
21  * distributed under the License is distributed on an "AS IS" BASIS, *
22  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
23  * See the License for the specific language governing permissions and *
24  * limitations under the License. *
25  * -------------------------------------------------------------------------- */
26 
27 #include "SimTKcommon.h"
29 
30 namespace SimTK {
31 
32 
42 : public PeriodicEventReporter {
43 public:
44 
48  template <class T> class UserFunction {
49  public:
50  virtual ~UserFunction() {}
51  virtual T evaluate(const System& system, const State& state) = 0;
52  };
53 
57  TextDataEventReporter(const System& system,
58  UserFunction<Real>* function,
59  Real reportInterval);
60 
64  TextDataEventReporter(const System& system,
65  UserFunction<Vector>* function,
66  Real reportInterval);
70 
72  void handleEvent(const State& state) const override;
73 
74  class TextDataEventReporterRep;
75 protected:
76  TextDataEventReporterRep* rep;
77  const TextDataEventReporterRep& getRep() const {assert(rep); return *rep;}
78  TextDataEventReporterRep& updRep() const {assert(rep); return *rep;}
79 };
80 
81 } // namespace SimTK
82 
83 #endif // SimTK_SIMBODY_TEXT_DATA_EVENT_REPORTER_H_
TextDataEventReporterRep * rep
Definition: TextDataEventReporter.h:74
This template class defines a standard interface for objects that calculate a function based on a Sys...
Definition: TextDataEventReporter.h:48
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
virtual ~UserFunction()
Definition: TextDataEventReporter.h:50
Every Simbody header and source file should include this header before any other Simbody header...
TextDataEventReporterRep & updRep() const
Definition: TextDataEventReporter.h:78
SimTK_Real Real
This is the default compiled-in floating point type for SimTK, either float or double.
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:606
This object is intended to contain all state information for a SimTK::System, except topological info...
Definition: State.h:280
PeriodicEventReporter is a subclass of ScheduledEventReporter which generates a series of uniformly s...
Definition: EventReporter.h:138
Includes internal headers providing declarations for the basic SimTK Core classes, including Simmatrix.
This is an EventReporter which prints out numeric data at regular intervals in tabular form...
Definition: TextDataEventReporter.h:41
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:68
This is the base class that serves as the parent of all SimTK System objects; most commonly Simbody&#39;s...
Definition: System.h:97
const TextDataEventReporterRep & getRep() const
Definition: TextDataEventReporter.h:77