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
30namespace SimTK {
31
32
42: public PeriodicEventReporter {
43public:
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
58 UserFunction<Real>* function,
59 Real reportInterval);
60
65 UserFunction<Vector>* function,
66 Real reportInterval);
70
72 void handleEvent(const State& state) const override;
73
74 class TextDataEventReporterRep;
75protected:
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_
Includes internal headers providing declarations for the basic SimTK Core classes,...
Every Simbody header and source file should include this header before any other Simbody header.
#define SimTK_SIMBODY_EXPORT
Definition: Simbody/include/simbody/internal/common.h:68
PeriodicEventReporter is a subclass of ScheduledEventReporter which generates a series of uniformly s...
Definition: EventReporter.h:138
This object is intended to contain all state information for a SimTK::System, except topological info...
Definition: State.h:280
This is the base class that serves as the parent of all SimTK System objects; most commonly Simbody's...
Definition: System.h:97
This template class defines a standard interface for objects that calculate a function based on a Sys...
Definition: TextDataEventReporter.h:48
virtual ~UserFunction()
Definition: TextDataEventReporter.h:50
virtual T evaluate(const System &system, const State &state)=0
This is an EventReporter which prints out numeric data at regular intervals in tabular form.
Definition: TextDataEventReporter.h:42
TextDataEventReporter(const System &system, UserFunction< Vector > *function, Real reportInterval)
Create a TextDataEventReporter which calculates a vector of numbers at each reporting interval,...
TextDataEventReporterRep & updRep() const
Definition: TextDataEventReporter.h:78
TextDataEventReporterRep * rep
Definition: TextDataEventReporter.h:76
void handleEvent(const State &state) const override
This is the implementation of the EventReporter virtual.
TextDataEventReporter(const System &system, UserFunction< Real > *function, Real reportInterval)
Create a TextDataEventReporter which calculates a single number at each reporting interval,...
~TextDataEventReporter()
The destructor will take care of deleting the UserFunction object; don't delete it yourself.
const TextDataEventReporterRep & getRep() const
Definition: TextDataEventReporter.h:77
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
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