PEvent Class Reference

Detailed Description

The PEvent class represents an event detected by a video analytics algorithm (PAnalytics); NOT thread-safe.

This class can be inherited.

For instance, SafeZoneEdge2d analytics plugin is an advanced plug-and-play motion detection on video streams. Each time you call Apply() to analyse a frame, it returns a list of PEvent which contains bounding boxes of all detected persons or vehicles (list can be empty is no motion detected).

To build an event, the simplest approach is to use the builder pattern, see following example: PEvent e = PEvent::Create("alarm", "", myDetector.GetId()).Certainty(0.7).Done(); Unless you develop a new PAnalytics plugin, you should not have to build your own events.

Definition at line 41 of file PEvent.h.

#include <PEvent.h>

Member Enumeration Documentation

◆ EEventTimeGranularity

All the available time granularity for events.

Enumerator
E_MILLISECONDS 
E_SECONDS 
E_MINUTES 
E_HOURS 
E_DAYS 
E_UNDEFINED 

Definition at line 47 of file PEvent.h.

Constructor & Destructor Documentation

◆ PEvent() [1/2]

PEvent::PEvent ( )

Constructs an empty event.

The state of the object is the following:

  • EventType is set to empty
  • EventAnnotation is set to empty
  • EventSource is set to PGuid::Null()
  • Payload is set to empty
  • EventCertainty is set to 0
  • OccurrenceTime is set to an invalid PDateTime
  • TimeGranularity is set to PEvent::E_UNDEFINED
  • DetectionTime is set to an invalid PDateTime
  • EventId is set to PGuid::Null()
  • EventComposition is set to false

◆ PEvent() [2/2]

PEvent::PEvent ( const PEvent other)

Constructs a shared copy of other.

◆ ~PEvent()

virtual PEvent::~PEvent ( )
virtual

Destroys this object.

Member Function Documentation

◆ Create()

static PEventBuilder PEvent::Create ( const PString type,
const PString annotation = PString::Empty(),
const PGuid sourceId = PGuid::Null() 
)
static

Returns a builder object to be able to create any event.

Typical usage is: PEvent e = PEvent::Create("alarm", "", myDetector.GetId()).Certainty(0.7).Done();

The following default parameters are applied:

◆ GetAnnotation()

const PString& PEvent::GetAnnotation ( ) const

Returns the text explanation of what happened in this event.

◆ GetCertainty()

double PEvent::GetCertainty ( ) const

Returns the certainty if this event.

◆ GetComposition()

bool PEvent::GetComposition ( ) const

Is this event part of other events?

◆ GetDetectionTime()

const PDateTime& PEvent::GetDetectionTime ( ) const

Returns the detection time of this event, the time at which the event became known to the system.

◆ GetEventId()

const PGuid& PEvent::GetEventId ( ) const

Returns the identifier of this event.

◆ GetOccurrenceTime()

const PDateTime& PEvent::GetOccurrenceTime ( ) const

Returns the time at which the event occurred in the external system.

The precision of this timestamp is given by the event-types temporal granularity.

◆ GetPayload()

const PProperties& PEvent::GetPayload ( ) const

Gets the payload associated with this event (read-only).

◆ GetSource()

const PGuid& PEvent::GetSource ( ) const

Gets the source identifier of this event.

◆ GetTimeGranularity()

EEventTimeGranularity PEvent::GetTimeGranularity ( ) const

Returns the time granularity of this event.

◆ GetType()

const PString& PEvent::GetType ( ) const

Returns the event-type of this event.

◆ operator=()

PEvent& PEvent::operator= ( const PEvent other)

Performs a shared copy of other to this object.

◆ operator==()

bool PEvent::operator== ( const PEvent other) const

Returns true if this object is the same instance than other, false otherwise.

◆ SetAnnotation()

void PEvent::SetAnnotation ( const PString eventAnnotation)

Sets the event annotation which is a free text explanation of what happened in this event.

◆ SetCertainty()

void PEvent::SetCertainty ( double  eventCertainty)

Sets the event certainty which is an estimate of certainty of this event.

◆ SetComposition()

void PEvent::SetComposition ( bool  eventComposition)

Sets if this event is composed or not.

◆ SetDetectionTime()

void PEvent::SetDetectionTime ( const PDateTime detectionTime)

Sets the detection time, the time at which the event became known to the system.

◆ SetEventId()

void PEvent::SetEventId ( const PGuid eventId)

Sets the event identifier.

Should be a system-generated unique ID for this event.

◆ SetOccurrenceTime()

void PEvent::SetOccurrenceTime ( const PDateTime occurrenceTime)

Sets the time at which the event occurred in the external system.

The precision of this timestamp is given by the event-types temporal granularity.

◆ SetPayload()

PProperties& PEvent::SetPayload ( ) const

Returns the internal payload of this event; can be used to store any event specific information here.

◆ SetSource()

void PEvent::SetSource ( const PGuid sourceId)

Sets the source identifier of this event.

◆ SetTimeGranularity()

void PEvent::SetTimeGranularity ( EEventTimeGranularity  eventGranularity)

Sets the precision of the any date/times in this event.

◆ SetType()

void PEvent::SetType ( const PString eventType) const

Sets the event-type of this event.

The event-type uniquely identifies the type of event we are dealing with.

Friends And Related Function Documentation

◆ PEventBuilder

friend class PEventBuilder
friend

Definition at line 224 of file PEvent.h.

◆ PEventImpl

friend class PEventImpl
friend

Definition at line 225 of file PEvent.h.