##

Timer.hh
Go to the documentation of this file.
/*
* Copyright (C) 2012 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
/* Desc: A timer class
* Author: Nate Koenig
* Date: 22 Nov 2009
*/
#ifndef _TIMER_HH_
#define _TIMER_HH_
#include "gazebo/common/Console.hh"
#include "gazebo/common/Time.hh"
#include "gazebo/util/system.hh"
namespace gazebo
{
namespace common
{
class GZ_COMMON_VISIBLE Timer
{
public: Timer();
public: Timer(const Time &_maxTime, const bool _countdown = true);
public: virtual ~Timer();
public: virtual void Start();
public: virtual void Stop();
public: bool GetRunning() const;
public: Time GetElapsed() const;
public: void Reset();
public: friend std::ostream &operator<<(std::ostream &out,
const gazebo::common::Timer &t)
{
out << t.GetElapsed();
return out;
}
private: bool reset;
private: bool running;
private: bool countdown;
private: Time start;
private: Time stop;
private: Time maxTime;
};
}
}
#endif
gazebo::common::Timer::Stop
virtual void Stop()
Stop the timer.
gazebo::common::Timer::Timer
Timer()
Default constructor.
gazebo::common::Timer::Start
virtual void Start()
Start the timer.
Time.hh
gazebo::common::Timer::operator<<
friend std::ostream & operator<<(std::ostream &out, const gazebo::common::Timer &t)
Stream operator friendly.
Definition: Timer.hh:70
gazebo
Forward declarations for the common classes.
Definition: Animation.hh:26
gazebo::common::Time
A Time class, can be used to hold wall- or sim-time. stored as sec and nano-sec.
Definition: Time.hh:47
common
common
Definition: FuelModelDatabase.hh:37
Console.hh
system.hh
gazebo::common::Timer::GetRunning
bool GetRunning() const
Returns true if the timer is running.
gazebo::common::Timer::GetElapsed
Time GetElapsed() const
Get the elapsed time.
gazebo::common::Timer
A timer class, used to time things in real world walltime.
Definition: Timer.hh:38
gazebo::common::Timer::Reset
void Reset()
Reset the timer.
gazebo::sensors::running
GAZEBO_VISIBLE bool running()
Return true if the manager is running.
gazebo::common::Timer::~Timer
virtual ~Timer()
Destructor.
gazebo::gui::stop
void stop()