mirror of
https://github.com/mcneel/opennurbs.git
synced 2026-03-17 14:56:02 +08:00
Update source to v6.14.19098.19271
This commit is contained in:
@@ -26,4 +26,83 @@ bool operator==(const struct ON_UUID_struct& a, const struct ON_UUID_struct& b);
|
||||
bool operator!=(const struct ON_UUID_struct& a, const struct ON_UUID_struct& b);
|
||||
#endif
|
||||
|
||||
class ON_CLASS ON_StopWatch
|
||||
{
|
||||
public:
|
||||
ON_StopWatch() = default;
|
||||
~ON_StopWatch() = default;
|
||||
ON_StopWatch(const ON_StopWatch&) = default;
|
||||
ON_StopWatch& operator=(const ON_StopWatch&) = default;
|
||||
|
||||
public:
|
||||
enum class State : unsigned char
|
||||
{
|
||||
///<summary>
|
||||
/// The stopwatch is off.
|
||||
///</summary>
|
||||
Off = 0,
|
||||
|
||||
///<summary>
|
||||
/// The stopwatch is started and running.
|
||||
///</summary>
|
||||
Running = 1,
|
||||
|
||||
///<summary>
|
||||
/// The stopwatch has been started and stopped.
|
||||
///</summary>
|
||||
Stopped = 2
|
||||
};
|
||||
|
||||
/*
|
||||
Description:
|
||||
If the stopwatch is off or stopped, it is started. Otherwise nothing happens.
|
||||
*/
|
||||
void Start();
|
||||
|
||||
/*
|
||||
Description:
|
||||
If the stopwatch is running, then it is stopped. Otherwise nothing happens.
|
||||
Returns:
|
||||
If the stopwatch was running, the elapsed time from the most recent Start().
|
||||
Otherwise, 0.0 is returned.
|
||||
*/
|
||||
double Stop();
|
||||
|
||||
/*
|
||||
Description:
|
||||
The stopwatch is reset and turned off. Any previously set times are lost.
|
||||
*/
|
||||
void Reset();
|
||||
|
||||
/*
|
||||
Returns:
|
||||
Current state of the stopwatch.
|
||||
*/
|
||||
ON_StopWatch::State CurrentState() const;
|
||||
|
||||
|
||||
/*
|
||||
Returns:
|
||||
The elapsed time in seconds.
|
||||
Remarks:
|
||||
If the stopwatch is running, the elapsed time is the duration from the most recent Start() to now.
|
||||
If the stopwatch is stopped, the elapsed time is the duration between the most recent Start() and Stop().
|
||||
If the stopwatch is off, the elapsed time is zero.
|
||||
*/
|
||||
double ElapsedTime() const;
|
||||
|
||||
private:
|
||||
// current state
|
||||
ON_StopWatch::State m_state = ON_StopWatch::State::Off;
|
||||
#pragma ON_PRAGMA_WARNING_PUSH
|
||||
#pragma ON_PRAGMA_WARNING_DISABLE_MSC( 4251 )
|
||||
// C4251: ... : class 'std::...'
|
||||
// needs to have dll-interface to be used by clients ...
|
||||
// m_start and m_stop are private and all code that manages them is explicitly implemented in the DLL.
|
||||
std::chrono::high_resolution_clock::time_point m_start; // most recent Start() time.
|
||||
std::chrono::high_resolution_clock::time_point m_stop; // most recent Stop() time.
|
||||
#pragma ON_PRAGMA_WARNING_POP
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user