convert to taking a std::shared_ptr<Monitor> instead of a Monitor *. Implement Name() which just returns the std::string label.
parent
dd1d194ec7
commit
78a87517f6
|
@ -825,7 +825,7 @@ bool Zone::ParseZoneString(const char *zone_string, int &zone_id, int &colour, P
|
||||||
return result;
|
return result;
|
||||||
} // end bool Zone::ParseZoneString(const char *zone_string, int &zone_id, int &colour, Polygon &polygon)
|
} // end bool Zone::ParseZoneString(const char *zone_string, int &zone_id, int &colour, Polygon &polygon)
|
||||||
|
|
||||||
std::vector<Zone> Zone::Load(Monitor *monitor) {
|
std::vector<Zone> Zone::Load(std::shared_ptr<Monitor>monitor) {
|
||||||
std::vector<Zone> zones;
|
std::vector<Zone> zones;
|
||||||
|
|
||||||
std::string sql = stringtf("SELECT Id,Name,Type+0,Units,Coords,AlarmRGB,CheckMethod+0,"
|
std::string sql = stringtf("SELECT Id,Name,Type+0,Units,Coords,AlarmRGB,CheckMethod+0,"
|
||||||
|
|
|
@ -62,7 +62,7 @@ class Zone {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Inputs
|
// Inputs
|
||||||
Monitor *monitor;
|
std::shared_ptr<Monitor>&monitor;
|
||||||
|
|
||||||
int id;
|
int id;
|
||||||
std::string label;
|
std::string label;
|
||||||
|
@ -126,7 +126,7 @@ class Zone {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Zone(
|
Zone(
|
||||||
Monitor *p_monitor,
|
std::shared_ptr<Monitor>p_monitor,
|
||||||
int p_id,
|
int p_id,
|
||||||
const char *p_label,
|
const char *p_label,
|
||||||
ZoneType p_type,
|
ZoneType p_type,
|
||||||
|
@ -156,7 +156,7 @@ class Zone {
|
||||||
Setup(p_type, p_polygon, p_alarm_rgb, p_check_method, p_min_pixel_threshold, p_max_pixel_threshold, p_min_alarm_pixels, p_max_alarm_pixels, p_filter_box, p_min_filter_pixels, p_max_filter_pixels, p_min_blob_pixels, p_max_blob_pixels, p_min_blobs, p_max_blobs, p_overload_frames, p_extend_alarm_frames );
|
Setup(p_type, p_polygon, p_alarm_rgb, p_check_method, p_min_pixel_threshold, p_max_pixel_threshold, p_min_alarm_pixels, p_max_alarm_pixels, p_filter_box, p_min_filter_pixels, p_max_filter_pixels, p_min_blob_pixels, p_max_blob_pixels, p_min_blobs, p_max_blobs, p_overload_frames, p_extend_alarm_frames );
|
||||||
}
|
}
|
||||||
|
|
||||||
Zone(Monitor *p_monitor, int p_id, const char *p_label, const Polygon &p_polygon)
|
Zone(std::shared_ptr<Monitor>&p_monitor, int p_id, const char *p_label, const Polygon &p_polygon)
|
||||||
:
|
:
|
||||||
monitor(p_monitor),
|
monitor(p_monitor),
|
||||||
id(p_id),
|
id(p_id),
|
||||||
|
@ -166,7 +166,7 @@ class Zone {
|
||||||
{
|
{
|
||||||
Setup(Zone::INACTIVE, p_polygon, kRGBBlack, (Zone::CheckMethod)0, 0, 0, 0, 0, Vector2(0, 0), 0, 0, 0, 0, 0, 0, 0, 0);
|
Setup(Zone::INACTIVE, p_polygon, kRGBBlack, (Zone::CheckMethod)0, 0, 0, 0, 0, Vector2(0, 0), 0, 0, 0, 0, 0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
Zone(Monitor *p_monitor, int p_id, const char *p_label, ZoneType p_type, const Polygon &p_polygon)
|
Zone(std::shared_ptr<Monitor>&p_monitor, int p_id, const char *p_label, ZoneType p_type, const Polygon &p_polygon)
|
||||||
:
|
:
|
||||||
monitor(p_monitor),
|
monitor(p_monitor),
|
||||||
id(p_id),
|
id(p_id),
|
||||||
|
@ -182,6 +182,7 @@ class Zone {
|
||||||
|
|
||||||
inline int Id() const { return id; }
|
inline int Id() const { return id; }
|
||||||
inline const char *Label() const { return label.c_str(); }
|
inline const char *Label() const { return label.c_str(); }
|
||||||
|
const std::string &Name() const { return label; }
|
||||||
inline ZoneType Type() const { return type; }
|
inline ZoneType Type() const { return type; }
|
||||||
inline bool IsActive() const { return( type == ACTIVE ); }
|
inline bool IsActive() const { return( type == ACTIVE ); }
|
||||||
inline bool IsInclusive() const { return( type == INCLUSIVE ); }
|
inline bool IsInclusive() const { return( type == INCLUSIVE ); }
|
||||||
|
@ -214,7 +215,7 @@ class Zone {
|
||||||
|
|
||||||
static bool ParsePolygonString( const char *polygon_string, Polygon &polygon );
|
static bool ParsePolygonString( const char *polygon_string, Polygon &polygon );
|
||||||
static bool ParseZoneString( const char *zone_string, int &zone_id, int &colour, Polygon &polygon );
|
static bool ParseZoneString( const char *zone_string, int &zone_id, int &colour, Polygon &polygon );
|
||||||
static std::vector<Zone> Load(Monitor *monitor);
|
static std::vector<Zone> Load(std::shared_ptr<Monitor>monitor);
|
||||||
//=================================================
|
//=================================================
|
||||||
bool CheckOverloadCount();
|
bool CheckOverloadCount();
|
||||||
int GetOverloadCount();
|
int GetOverloadCount();
|
||||||
|
|
Loading…
Reference in New Issue