Simbody  3.5
StudyGuts.h
Go to the documentation of this file.
1 #ifndef SimTK_SimTKCOMMON_STUDY_GUTS_H_
2 #define SimTK_SimTKCOMMON_STUDY_GUTS_H_
3 
4 /* -------------------------------------------------------------------------- *
5  * Simbody(tm): SimTKcommon *
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: Michael Sherman *
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/basics.h"
28 #include "SimTKcommon/Simmatrix.h"
30 
31 namespace SimTK {
32 
33 // TODO: more to come.
34 
70  class GutsRep;
71  friend class GutsRep;
72 
73  // This is the only data member in this class.
74  GutsRep* rep; // opaque implementation of Study::Guts base class.
75 public:
76  // Note that this serves as a default constructor since both arguments have defaults.
77  explicit Guts(const String& name="<UNNAMED STUDY>",
78  const String& version="0.0.0");
79  virtual ~Guts();
80 
81  const String& getName() const;
82  const String& getVersion() const;
83 
84  // Obtain the owner handle for this Study::Guts object.
85  const Study& getStudy() const;
86  Study& updStudy();
87 
88  void setOwnerHandle(Study&);
89  bool hasOwnerHandle() const;
90 
91  explicit Guts(class GutsRep* r) : rep(r) { }
92  bool hasRep() const {return rep!=0;}
93  const GutsRep& getRep() const {assert(rep); return *rep;}
94  GutsRep& updRep() const {assert(rep); return *rep;}
95 
96  // Wrap the cloneImpl virtual method.
97  Study::Guts* clone() const;
98 
99 protected:
100  Guts(const Guts&); // copies the base class; for use from derived class copy constructors
101 
102  // The destructor is already virtual; see above.
103 
104  virtual Study::Guts* cloneImpl() const = 0;
105 
106 private:
107  Guts& operator=(const Guts&); // suppress default copy assignment operator
108 };
109 
110 } // namespace SimTK
111 
112 #endif // SimTK_SimTKCOMMON_STUDY_GUTS_H_
#define SimTK_SimTKCOMMON_EXPORT
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:218
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
GutsRep & updRep() const
Definition: StudyGuts.h:94
This is the declaration for the Study::Guts class, the abstract object to which a Study handle points...
Definition: StudyGuts.h:69
const GutsRep & getRep() const
Definition: StudyGuts.h:93
bool hasRep() const
Definition: StudyGuts.h:92
SimTK::String is a plug-compatible std::string replacement (plus some additional functionality) inten...
Definition: String.h:62
Declares the user-visible part of a SimTK::State, the implementation is done in a separate internal c...
Guts(class GutsRep *r)
Definition: StudyGuts.h:91
Definition: Study.h:56
This is the header which should be included in user programs that would like to make use of all the S...
Includes internal headers providing declarations for the basic SimTK Core classes.