SamplingMetricBase.h
Go to the documentation of this file.
// This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions Inc.
//
// 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.
#ifndef SURGSIM_FRAMEWORK_SAMPLINGMETRICBASE_H
#define SURGSIM_FRAMEWORK_SAMPLINGMETRICBASE_H
#include <deque>
#include "SurgSim/Framework/Behavior.h"
#include "SurgSim/Framework/ObjectFactory.h"
namespace SurgSim
{
namespace Framework
{
class Logger;
};
};
namespace SurgSim
{
namespace Framework
{
class SamplingMetricBase : public SurgSim::Framework::Behavior
{
public:
explicit SamplingMetricBase(const std::string& name);
typedef std::pair<double, double> MeasurementEntryType;
typedef std::deque<MeasurementEntryType> MeasurementsType;
void update(double dt) override;
void setTargetManagerType(int targetManagerType);
int getTargetManagerType() const override;
void setMaxNumberOfMeasurements(size_t numberOfMeasurements);
size_t getMaxNumberOfMeasurements() const;
size_t getCurrentNumberOfMeasurements() const;
double getElapsedTime() const;
virtual MeasurementsType getMeasurementValues();
protected:
bool doWakeUp() override;
bool doInitialize() override;
virtual bool canMeasure(double dt);
virtual double performMeasurement(double dt) = 0;
std::shared_ptr<SurgSim::Framework::Logger> m_logger;
private:
MeasurementsType m_measurementValues;
int m_targetManagerType;
double m_elapsedTime;
size_t m_maxNumberOfMeasurements;
};
};
};
#endif // SURGSIM_FRAMEWORK_SAMPLINGMETRICBASE_H
SurgSim
Definition: CompoundShapeToGraphics.cpp:29
SurgSim::Framework::SamplingMetricBase::m_logger
std::shared_ptr< SurgSim::Framework::Logger > m_logger
Definition: SamplingMetricBase.h:113
SurgSim::Framework::SamplingMetricBase::m_measurementValues
MeasurementsType m_measurementValues
measurement list
Definition: SamplingMetricBase.h:117
SurgSim::Framework::SamplingMetricBase::MeasurementEntryType
std::pair< double, double > MeasurementEntryType
Type of the individual entries in the measurement data structure.
Definition: SamplingMetricBase.h:55
ObjectFactory.h
SurgSim::Framework::SamplingMetricBase::m_targetManagerType
int m_targetManagerType
Definition: SamplingMetricBase.h:118
SurgSim::Framework::SamplingMetricBase
SamplingMetricBase provides a base class to support metric development.
Definition: SamplingMetricBase.h:45
SurgSim::Framework::SamplingMetricBase::m_maxNumberOfMeasurements
size_t m_maxNumberOfMeasurements
Definition: SamplingMetricBase.h:120
Behavior.h
SurgSim::Framework::SamplingMetricBase::m_elapsedTime
double m_elapsedTime
Definition: SamplingMetricBase.h:119
SurgSim::Framework::Behavior
Behaviors perform actions.
Definition: Behavior.h:40
SurgSim::Framework::SamplingMetricBase::MeasurementsType
std::deque< MeasurementEntryType > MeasurementsType
Type of the cumulative entries data structure.
Definition: SamplingMetricBase.h:63