Remove image argument in new functions

This commit is contained in:
Emmanuel Papin 2015-01-17 18:30:24 +01:00
parent 2227d9c852
commit 70a062a609
5 changed files with 24 additions and 19 deletions

View File

@ -232,15 +232,15 @@ bool Detector::Detect(const Image &zmImage, Zone** zones, Event::StringSet &zone
} }
void Detector::_onCreateEvent(const Image &zmImage, Zone** zones) void Detector::_onCreateEvent(Zone** zones, Event* event)
{ {
for(std::vector<unsigned int>::iterator it = m_vnPluginZones.begin(); it != m_vnPluginZones.end(); ++it) for(std::vector<unsigned int>::iterator it = m_vnPluginZones.begin(); it != m_vnPluginZones.end(); ++it)
onCreateEvent(zones[*it], *it, const Image *zmImage); onCreateEvent(zones[*it], *it, Event* event);
} }
void Detector::_onCloseEvent(const Image &zmImage, Zone** zones) void Detector::_onCloseEvent(Zone** zones, Event* event)
{ {
for(std::vector<unsigned int>::iterator it = m_vnPluginZones.begin(); it != m_vnPluginZones.end(); ++it) for(std::vector<unsigned int>::iterator it = m_vnPluginZones.begin(); it != m_vnPluginZones.end(); ++it)
onCloseEvent(zones[*it], *it, const Image *zmImage); onCloseEvent(zones[*it], *it, Event* event);
} }

View File

@ -78,9 +78,8 @@ public:
//! Detect (in an image later) //! Detect (in an image later)
bool Detect(const Image &image, Zone** zones, Event::StringSet &zoneSet, unsigned int &score); bool Detect(const Image &image, Zone** zones, Event::StringSet &zoneSet, unsigned int &score);
void _onCreateEvent(Zone** zones, Event *event);
void _onCreateEvent(const Image &zmImage, Zone** zones); void _onCloseEvent(Zone** zones, Event *event);
void _onCloseEvent(const Image &zmImage, Zone** zones);
//! Load detector's parameters. //! Load detector's parameters.
virtual int loadConfig(string sConfigFileName, map<unsigned int,map<string,string> > mapPluginConf) = 0; virtual int loadConfig(string sConfigFileName, map<unsigned int,map<string,string> > mapPluginConf) = 0;
@ -102,9 +101,8 @@ protected:
//! Do detection inside one given zone. //! Do detection inside one given zone.
virtual bool checkZone(Zone *zone, unsigned int n_zone, const Image *zmImage) = 0; virtual bool checkZone(Zone *zone, unsigned int n_zone, const Image *zmImage) = 0;
virtual void onCreateEvent(Zone *zone, unsigned int n_zone, Event *event) = 0;
virtual void onCreateEvent(Zone *zone, unsigned int n_zone, const Image *zmImage) = 0; virtual void onCloseEvent(Zone *zone, unsigned int n_zone, Event *event) = 0;
virtual void onCloseEvent(Zone *zone, unsigned int n_zone, const Image *zmImage) = 0;
//! Log messages to the SYSLOG. //! Log messages to the SYSLOG.
void log(int, string sLevel, string sMessage); void log(int, string sLevel, string sMessage);

View File

@ -41,24 +41,24 @@ ImageAnalyser::~ImageAnalyser()
delete *It; delete *It;
} }
void ImageAnalyser::onCreateEvent(const Image &comp_image, Zone** zones, Event* event) void ImageAnalyser::onCreateEvent(Zone** zones, Event* event)
{ {
for ( DetectorsList::iterator It = m_Detectors.begin(); for ( DetectorsList::iterator It = m_Detectors.begin();
It != m_Detectors.end(); It != m_Detectors.end();
++It ) ++It )
{ {
(*It)->_onCreateEvent(const comp_image, zones, event); (*It)->_onCreateEvent(zones, event);
} }
} }
void ImageAnalyser::onCloseEvent(const Image &comp_image, Zone** zones, Event* event) void ImageAnalyser::onCloseEvent(Zone** zones, Event* event)
{ {
for ( DetectorsList::iterator It = m_Detectors.begin(); for ( DetectorsList::iterator It = m_Detectors.begin();
It != m_Detectors.end(); It != m_Detectors.end();
++It ) ++It )
{ {
(*It)->_onCloseEvent(const comp_image, zones, event); (*It)->_onCloseEvent(zones, event);
} } }
} }
/*!\fn ImageAnalyser::DoDetection(const Image &comp_image, Zone** zones, Event::StringSetMap noteSetMap, string& det_cause) /*!\fn ImageAnalyser::DoDetection(const Image &comp_image, Zone** zones, Event::StringSetMap noteSetMap, string& det_cause)

View File

@ -75,8 +75,8 @@ class ImageAnalyser {
m_Detectors.push_back(Det.release()); m_Detectors.push_back(Det.release());
} }
void onCreateEvent(const Image &comp_image, Zone** zones); void onCreateEvent(Zone** zones, Event* event);
void onCloseEvent(const Image &comp_image, Zone** zones); void onCloseEvent(Zone** zones, Event* event);
//! Do detection in an image by calling all available detectors. //! Do detection in an image by calling all available detectors.
bool DoDetection(const Image &comp_image, Zone** zones, Event::StringSetMap& noteSetMap, std::string& det_cause, unsigned int& score); bool DoDetection(const Image &comp_image, Zone** zones, Event::StringSetMap& noteSetMap, std::string& det_cause, unsigned int& score);

View File

@ -1522,7 +1522,7 @@ bool Monitor::Analyse()
shared_data->last_event = event->Id(); shared_data->last_event = event->Id();
#if ZM_PLUGINS_ON #if ZM_PLUGINS_ON
if (config.load_plugins) if (config.load_plugins)
ThePluginManager.getImageAnalyser().onCreateEvent( *snap_image, zones, event ); ThePluginManager.getImageAnalyser().onCreateEvent( zones, event );
#endif // ZM_PLUGINS_ON #endif // ZM_PLUGINS_ON
Info( "%s: %03d - Opening new event %d, section start", name, image_count, event->Id() ); Info( "%s: %03d - Opening new event %d, section start", name, image_count, event->Id() );
@ -1581,7 +1581,10 @@ bool Monitor::Analyse()
} }
event = new Event( this, *(image_buffer[pre_index].timestamp), cause, noteSetMap ); event = new Event( this, *(image_buffer[pre_index].timestamp), cause, noteSetMap );
shared_data->last_event = event->Id(); shared_data->last_event = event->Id();
#if ZM_PLUGINS_ON
if (config.load_plugins)
ThePluginManager.getImageAnalyser().onCreateEvent( zones, event );
#endif // ZM_PLUGINS_ON
Info( "%s: %03d - Opening new event %d, alarm start", name, image_count, event->Id() ); Info( "%s: %03d - Opening new event %d, alarm start", name, image_count, event->Id() );
if ( pre_event_images ) if ( pre_event_images )
@ -3117,6 +3120,10 @@ bool Monitor::closeEvent()
{ {
gettimeofday( &(event->EndTime()), NULL ); gettimeofday( &(event->EndTime()), NULL );
} }
else ( function == ANALYSIS && config.load_plugins )
{
ThePluginManager.getImageAnalyser().onCloseEvent( zones, event );
}
delete event; delete event;
event = 0; event = 0;
return( true ); return( true );