Molmodel
|
00001 /* -------------------------------------------------------------------------- * 00002 * SimTK Core: SimTK Molmodel * 00003 * -------------------------------------------------------------------------- * 00004 * This is part of the SimTK Core biosimulation toolkit originating from * 00005 * Simbios, the NIH National Center for Physics-Based Simulation of * 00006 * Biological Structures at Stanford, funded under the NIH Roadmap for * 00007 * Medical Research, grant U54 GM072970. See https://simtk.org. * 00008 * * 00009 * Portions copyright (c) 2008 Stanford University and the Authors. * 00010 * Authors: Christopher Bruns * 00011 * Contributors: * 00012 * * 00013 * Permission is hereby granted, free of charge, to any person obtaining a * 00014 * copy of this software and associated documentation files (the "Software"), * 00015 * to deal in the Software without restriction, including without limitation * 00016 * the rights to use, copy, modify, merge, publish, distribute, sublicense, * 00017 * and/or sell copies of the Software, and to permit persons to whom the * 00018 * Software is furnished to do so, subject to the following conditions: * 00019 * * 00020 * The above copyright notice and this permission notice shall be included in * 00021 * all copies or substantial portions of the Software. * 00022 * * 00023 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * 00024 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * 00025 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * 00026 * THE AUTHORS, CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * 00027 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * 00028 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * 00029 * USE OR OTHER DEALINGS IN THE SOFTWARE. * 00030 * -------------------------------------------------------------------------- */ 00031 00032 #ifndef SimTK_MOLMODEL_PERIODICVMDREPORTER_H_ 00033 #define SimTK_MOLMODEL_PERIODICVMDREPORTER_H_ 00034 00035 #include "SimTKsimbody.h" 00036 #include "molmodel/internal/common.h" 00037 #include "molmodel/internal/Compound.h" 00038 #include "molmodel/internal/VmdConnection.h" 00039 00040 namespace SimTK { 00041 00044 class SimTK_MOLMODEL_EXPORT PeriodicVmdReporter : public PeriodicEventReporter { 00045 public: 00046 PeriodicVmdReporter( 00047 const CompoundSystem& system, 00048 Real interval, 00049 int localSocketNumber, 00050 bool blockWaitingForVmdConnection = false 00051 ) 00052 : PeriodicEventReporter(interval), 00053 system(system), 00054 vmdConnection(localSocketNumber), 00055 blockWaitingForVmdConnection(blockWaitingForVmdConnection) 00056 {} 00057 00058 00059 void handleEvent(const State& state) const; 00060 00061 private: 00062 const CompoundSystem& system; 00063 mutable VmdConnection vmdConnection; 00064 bool blockWaitingForVmdConnection; 00065 }; 00066 00067 } // namespace SimTK 00068 00069 #endif // SimTK_MOLMODEL_PERIODICVMDREPORTER_H_