Simbody
3.4 (development)
|
00001 #ifndef SimTK_SimTKCOMMON_STUDY_GUTS_H_ 00002 #define SimTK_SimTKCOMMON_STUDY_GUTS_H_ 00003 00004 /* -------------------------------------------------------------------------- * 00005 * Simbody(tm): SimTKcommon * 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: Michael Sherman * 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/basics.h" 00028 #include "SimTKcommon/Simmatrix.h" 00029 #include "SimTKcommon/internal/State.h" 00030 00031 namespace SimTK { 00032 00033 // TODO: more to come. 00034 00069 class SimTK_SimTKCOMMON_EXPORT Study::Guts { 00070 class GutsRep; 00071 friend class GutsRep; 00072 00073 // This is the only data member in this class. 00074 GutsRep* rep; // opaque implementation of Study::Guts base class. 00075 public: 00076 // Note that this serves as a default constructor since both arguments have defaults. 00077 explicit Guts(const String& name="<UNNAMED STUDY>", 00078 const String& version="0.0.0"); 00079 virtual ~Guts(); 00080 00081 const String& getName() const; 00082 const String& getVersion() const; 00083 00084 // Obtain the owner handle for this Study::Guts object. 00085 const Study& getStudy() const; 00086 Study& updStudy(); 00087 00088 void setOwnerHandle(Study&); 00089 bool hasOwnerHandle() const; 00090 00091 explicit Guts(class GutsRep* r) : rep(r) { } 00092 bool hasRep() const {return rep!=0;} 00093 const GutsRep& getRep() const {assert(rep); return *rep;} 00094 GutsRep& updRep() const {assert(rep); return *rep;} 00095 00096 // Wrap the cloneImpl virtual method. 00097 Study::Guts* clone() const; 00098 00099 protected: 00100 Guts(const Guts&); // copies the base class; for use from derived class copy constructors 00101 00102 // The destructor is already virtual; see above. 00103 00104 virtual Study::Guts* cloneImpl() const = 0; 00105 00106 private: 00107 Guts& operator=(const Guts&); // suppress default copy assignment operator 00108 }; 00109 00110 } // namespace SimTK 00111 00112 #endif // SimTK_SimTKCOMMON_STUDY_GUTS_H_