Simbody
3.4 (development)
|
00001 #ifndef SimTK_SIMBODY_TEXT_DATA_EVENT_REPORTER_H_ 00002 #define SimTK_SIMBODY_TEXT_DATA_EVENT_REPORTER_H_ 00003 00004 /* -------------------------------------------------------------------------- * 00005 * Simbody(tm) * 00006 * -------------------------------------------------------------------------- * 00007 * This is part of the SimTK biosimulation toolkit originating from * 00008 * Simbios, the NIH National Center for Physics-Based Simulation of * 00009 * Biological Structures at Stanford, funded under the NIH Roadmap for * 00010 * Medical Research, grant U54 GM072970. See https://simtk.org/home/simbody. * 00011 * * 00012 * Portions copyright (c) 2007-12 Stanford University and the Authors. * 00013 * Authors: Peter Eastman * 00014 * Contributors: * 00015 * * 00016 * Licensed under the Apache License, Version 2.0 (the "License"); you may * 00017 * not use this file except in compliance with the License. You may obtain a * 00018 * copy of the License at http://www.apache.org/licenses/LICENSE-2.0. * 00019 * * 00020 * Unless required by applicable law or agreed to in writing, software * 00021 * distributed under the License is distributed on an "AS IS" BASIS, * 00022 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * 00023 * See the License for the specific language governing permissions and * 00024 * limitations under the License. * 00025 * -------------------------------------------------------------------------- */ 00026 00027 #include "SimTKcommon.h" 00028 #include "simbody/internal/common.h" 00029 00030 namespace SimTK { 00031 00032 00041 class SimTK_SIMBODY_EXPORT TextDataEventReporter 00042 : public PeriodicEventReporter { 00043 public: 00044 00048 template <class T> class UserFunction { 00049 public: 00050 virtual ~UserFunction() {} 00051 virtual T evaluate(const System& system, const State& state) = 0; 00052 }; 00053 00057 TextDataEventReporter(const System& system, 00058 UserFunction<Real>* function, 00059 Real reportInterval); 00060 00064 TextDataEventReporter(const System& system, 00065 UserFunction<Vector>* function, 00066 Real reportInterval); 00069 ~TextDataEventReporter(); 00070 00072 void handleEvent(const State& state) const OVERRIDE_11; 00073 00074 class TextDataEventReporterRep; 00075 protected: 00076 TextDataEventReporterRep* rep; 00077 const TextDataEventReporterRep& getRep() const {assert(rep); return *rep;} 00078 TextDataEventReporterRep& updRep() const {assert(rep); return *rep;} 00079 }; 00080 00081 } // namespace SimTK 00082 00083 #endif // SimTK_SIMBODY_TEXT_DATA_EVENT_REPORTER_H_