1 #ifndef SimTK_SimTKCOMMON_EVENT_H_
2 #define SimTK_SimTKCOMMON_EVENT_H_
137 operator Num()
const {
return value;}
190 return Trigger(transition & mask);
214 bool shouldTriggerOnRisingSignTransition()
const;
215 bool shouldTriggerOnFallingSignTransition()
const;
216 Real getRequiredLocalizationTimeWindow()
const;
226 if (shouldTriggerOnRisingSignTransition()) {
229 if (shouldTriggerOnFallingSignTransition()) {
243 assert(!
"impossible event transition situation");
248 class EventTriggerInfoRep;
251 EventTriggerInfoRep* rep;
253 const EventTriggerInfoRep& getRep()
const {assert(rep);
return *rep;}
254 EventTriggerInfoRep& updRep() {assert(rep);
return *rep;}
276 UseInfinityNorm = 0x0002
282 { clear(); setAccuracy(accuracy); }
284 { clear(); setOption(opt); }
290 { optionSet=0; setAccuracyDefaults();
return *
this; }
296 assert(accuracy > 0);
297 requiredAccuracy = accuracy;
304 { optionSet &= ~(unsigned)opt;
return *
this; }
308 { optionSet |= (unsigned)opt;
return *
this; }
319 { optionSet |= opts.optionSet;
return *
this; }
321 { optionSet &= opts.optionSet;
return *
this; }
323 { optionSet &= ~opts.optionSet;
return *
this; }
329 Real requiredAccuracy;
332 void setAccuracyDefaults() {
333 requiredAccuracy = getDefaultAccuracy();
364 m_exitStatus = Invalid;
365 m_anyChangeMade =
false;
370 bool isValid()
const {
return m_exitStatus != Invalid;}
374 { assert(isValid());
return m_anyChangeMade; }
376 { assert(isValid());
return m_lowestModifiedStage; }
378 { assert(isValid());
return m_message; }
381 { m_exitStatus=status;
return *
this; }
383 { m_anyChangeMade=changeMade;
return *
this; }
385 { m_lowestModifiedStage=stage;
return *
this; }
387 { m_message=message;
return *
this; }
390 bool m_anyChangeMade;
391 Stage m_lowestModifiedStage;
397 #endif // SimTK_SimTKCOMMON_EVENT_H_
#define SimTK_SimTKCOMMON_EXPORT
Definition: SimTKcommon/include/SimTKcommon/internal/common.h:202
Trigger
Triggered Events respond to zero crossings of their associated trigger function.
Definition: Event.h:155
SimTK_DEFINE_UNIQUE_INDEX_TYPE(AssemblyConditionIndex)
HandleEventsOptions & operator-=(const HandleEventsOptions &opts)
Definition: Event.h:322
static std::string eventTriggerString(Trigger)
This is useful for debugging; it translates an Event::Trigger or a mask formed by a union of Event::T...
static Trigger classifyTransition(int before, int after)
Classify a before/after sign transition.
Definition: Event.h:174
This class is basically a glorified enumerated type, type-safe and range checked but permitting conve...
Definition: Stage.h:50
HandleEventsOptions & setAccuracy(Real accuracy)
The norm of the constraint errors must be driven to below this value for a project() to be considered...
Definition: Event.h:295
Status getExitStatus() const
Definition: Event.h:371
bool isValid() const
Definition: Event.h:140
HandleEventsResults & setExitStatus(Status status)
Definition: Event.h:380
HandleEventsOptions & clearOption(Option opt)
Remove a given option from the set.
Definition: Event.h:303
bool isOptionSet(Option opt) const
Definition: Event.h:313
HandleEventsResults & setMessage(const String &message)
Definition: Event.h:386
HandleEventsOptions & setOption(Option opt)
Select a given option from the set.
Definition: Event.h:307
An Event is "something that happens" during a Study that is advancing through time.
Definition: Event.h:76
Num
Definition: Event.h:125
HandleEventsResults & setAnyChangeMade(bool changeMade)
Definition: Event.h:382
These are all the possible causes for events.
Definition: Event.h:123
HandleEventsOptions & operator-=(Option opt)
Definition: Event.h:326
Option
Definition: Event.h:267
HandleEventsOptions & clear()
Restore this object to its default-constructed state (no options selected, default accuracy)...
Definition: Event.h:289
HandleEventsOptions & operator|=(Option opt)
Definition: Event.h:325
HandleEventsOptions & operator|=(const HandleEventsOptions &opts)
Definition: Event.h:318
Cause()
Definition: Event.h:135
HandleEventsOptions()
Definition: Event.h:280
Stage getLowestModifiedStage() const
Definition: Event.h:375
static const char * getCauseName(Cause)
This is useful for debugging; it translates an Event::Cause into a readable string.
Higher than any legitimate Stage.
Definition: Stage.h:63
Real getAccuracy() const
Return the current value for the accuracy option.
Definition: Event.h:311
HandleEventsOptions & operator&=(const HandleEventsOptions &opts)
Definition: Event.h:320
const Real Infinity
This is the IEEE positive infinity constant for this implementation of the default-precision Real typ...
HandleEventsResults & clear()
Restore this object to its default-constructed state, with the return status set to Invalid...
Definition: Event.h:363
HandleEventsResults()
Definition: Event.h:343
SimTK::String is a plug-compatible std::string replacement (plus some additional functionality) inten...
Definition: String.h:62
Event::Trigger calcTransitionMask() const
Definition: Event.h:224
static Trigger maskTransition(Trigger transition, Trigger mask)
Given an observed transition, weed out ignorable ones using the supplied mask.
Definition: Event.h:188
Cause(Num n)
Definition: Event.h:136
Status
Definition: Event.h:345
This class is used to communicate between the System and an Integrator regarding the properties of a ...
Definition: Event.h:205
bool getAnyChangeMade() const
Definition: Event.h:373
Results returned by the handleEvent() method.
Definition: Event.h:341
HandleEventsOptions(Option opt)
Definition: Event.h:283
bool isValid() const
Definition: Event.h:370
Includes internal headers providing declarations for the basic SimTK Core classes.
HandleEventsOptions(Real accuracy)
Definition: Event.h:281
Cause & operator=(Num n)
Definition: Event.h:138
HandleEventsResults & setLowestModifiedStage(Stage stage)
Definition: Event.h:384
const String & getMessage() const
Definition: Event.h:377
static Real getDefaultAccuracy()
Definition: Event.h:315
Options for the handleEvent() method.
Definition: Event.h:265
This is a class to represent unique IDs for events in a type-safe way.