Commit 86f82fd6 authored by Pascal Palenda's avatar Pascal Palenda
Browse files

Better define default behaviour

parent 29dad0a9
......@@ -55,11 +55,10 @@ namespace ITA
/// A filter might have a condition that has to be fulfilled to be actually useful.
/// Another filter might just be a conditional filter.
/// This function should handle both of these cases.
/// \note Default behaviour it to return true;
/// \note Default behaviour it to return true if \p previousState was created before \p newUpdate.
/// \param previousState the previous state of the scene to check against.
/// \param newUpdate the CUpdateScene to check.
/// \return true if the condition is fulfilled, else false.
/// \todo Check time stamps that this function was used correctly.
///
virtual bool conditionFulfilled(const CUpdateScene& previousState, const CUpdateScene& newUpdate);
......@@ -68,11 +67,10 @@ namespace ITA
/// \brief Check if the change between \p previousState and \p newUpdate is audible.
///
/// This function might call ::conditionFulfilled to check if the condition for its test is fulfilled.
/// \note Default behaviour it to return true;
/// \note Default behaviour it to return the result of conditionFulfilled.
/// \param previousState the previous state of the scene to check against.
/// \param newUpdate the CUpdateScene to check for audibility.
/// \return true if the change between \p previousState and \p newUpdate is audible, else false.
/// \todo Check time stamps that this function was used correctly.
///
virtual bool changeIsAudible(const CUpdateScene& previousState, const CUpdateScene& newUpdate);
};
......
#include <ITA/simulation_scheduler/audibility_filter/audibility_filter_interface.h>
// simulation scheduler includes
#include <ITA/simulation_scheduler/update_scene.h>
namespace ITA
{
namespace simulation_scheduler
......@@ -9,18 +12,17 @@ namespace ITA
std::map<std::string, CAudibilityFilterFactory::CreateCallback> CAudibilityFilterFactory::m_mFilters;
// Definition of the pure virtual destructor.
IAudibilityFilter::~IAudibilityFilter()
{
}
IAudibilityFilter::~IAudibilityFilter ( )
{ }
bool IAudibilityFilter::conditionFulfilled(const CUpdateScene& previousState, const CUpdateScene& newUpdate)
bool IAudibilityFilter::conditionFulfilled ( const CUpdateScene& previousState, const CUpdateScene& newUpdate )
{
return true;
return previousState.getTimeStamp ( ) < newUpdate.getTimeStamp ( );
}
bool IAudibilityFilter::changeIsAudible(const CUpdateScene& previousState, const CUpdateScene& newUpdate)
bool IAudibilityFilter::changeIsAudible ( const CUpdateScene& previousState, const CUpdateScene& newUpdate )
{
return true;
return conditionFulfilled ( previousState, newUpdate );
}
void CAudibilityFilterFactory::registerFilter ( const std::string& type, CreateCallback createFunction )
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment