AIM
 All Classes Functions Variables Typedefs Enumerations
TopLocations Class Reference

#include <TopLocations.h>

Inheritance diagram for TopLocations:
AIM

Public Member Functions

 TopLocations (std::string name="top_locations")
 
virtual void addData (const AIMData &newData)
 
void doTick ()
 
virtual AIMValue setProperty (const std::string &key, AIMValue value)
 
virtual void setProperties (const std::map< std::string, AIMValue > &properties)
 
std::vector< AIMValuegetRequirements () const
 
bool requirementsAreUpdated (bool reset=true) const
 
std::map< std::string, AIMValue > & getProperties ()
 
- Public Member Functions inherited from AIM
 AIM (std::string name="")
 
 AIM (const AIM &other)
 
AIMoperator= (const AIM &rhs)
 
virtual void addDataSubscriber (const std::string &key, AIM *subscriber)
 
virtual void removeDataSubscriber (const std::string &key)
 
virtual AIMValue getProperty (std::string key) const
 
virtual void sendData ()
 
virtual std::string exportProperties ()
 
virtual std::vector< std::pair
< std::string, AIMValue > > 
getOutputData (bool clear_output=false)
 
virtual std::vector< std::pair
< std::string, AIMValue > > 
getInputData (bool clear_input=false)
 
virtual AIMgetDataSubscriber (std::string subscriber)
 
virtual std::string getName () const
 

Static Public Attributes

static const std::string PROPERTY_MAX_INTERPOLATION_INTERVAL
 
static const std::string PROPERTY_RESIDING_UPDATE_INTERVAL = "min visit time interval"
 
static const std::string PROPERTY_MIN_VISIT_TIME = "min_initial_time"
 
static const std::string PROPERTY_MAX_NR_TOP = "max_nr_top"
 
static const std::string PROPERTY_LAST_TOP_LOCATIONS = "last data point"
 
static const double DEFAULT_MAX_INTERPOLATION_INTERVAL = 2 * 60 * 60
 
static const double DEFAULT_MIN_VISIT_TIME = 5 * 60
 
static const double DEFAULT_RESIDING_UPDATE_INTERVAL = 60 * 60
 
static const int DEFAULT_MAX_NR_TOP = 100
 
static const std::string VERSION = "1.0.1"
 
- Static Public Attributes inherited from AIM
static const std::string VERSION = AIM_VERSION
 

Additional Inherited Members

- Public Types inherited from AIM
typedef std::pair< std::string,
AIMValue
AIMData
 
typedef std::queue< AIMDataAIMDataQueue
 
typedef std::queue< AIMValueAIMValueQueue
 
typedef std::map< std::string,
AIMValueQueue
InputDataQueue
 
- Protected Member Functions inherited from AIM
void setDataSubscribers (const std::map< std::string, AIM * > &subscribers)
 
void setInputDataQueue (const InputDataQueue &inputDataQueue)
 
void setOutputDataQueue (const AIMDataQueue &outputDataQueue)
 
- Protected Attributes inherited from AIM
std::string name
 
std::vector< AIMValuerequirements
 
bool requirementsUpdated
 
std::map< std::string, AIM * > dataSubscribers
 
std::map< std::string, AIMValueproperties
 
InputDataQueue inputDataQueue
 
AIMDataQueue outputDataQueue
 

Detailed Description

TopLocations produces a ranked list of visited locations based on a position sensor. A visit means that some time was spend at the location, in contrast to just passing by the location.

Output:
An ordered json array where each elements contains the following fields:

  • "rank": The rank of the location, starting at 1
  • "latitude", "longitude": Coordinates of the location. These might change slightly, don't use for identification!
  • "id": Identifier of the location. This identifier is guaranteed to be unique for this location.
  • "time visited": The total time this location has been visited in seconds
  • "address": Optional, a human readable address.

A new data point is produced whenever

  1. A location is entered or left
  2. When residing at a location a new data point is produced every PROPERTY_RESIDING_UPDATE_INTERVAL seconds.

Properties:

  • MAX_INTERPOLATION_INTERVAL: Maximum interval (in seconds) between datapoints that the algorithm does interpolation
  • MIN_VISIT_TIME: Minimum consecutive time to be at a location for it to be considered a visit.
  • MAX_NR_TOP: Maximum Number of locations to be included in the "top locations" output.
  • RESIDING_UPDATE_INTERVAL: Update interval when residing at the same location

Member Function Documentation

void TopLocations::addData ( const AIMData data)
virtual

Add data

This method adds data to the input queue of the AI-module The AIMData object

Parameters
AIMDatadata The input data

Reimplemented from AIM.

void TopLocations::doTick ( )
virtual

Do an AIM tick

This method is called to tick the AI-module to do its processing. During this tick the AI module grabs it's input data, does its processing, and sends the data to its data receivers. This method can be used in combination with AIM priorities, to streamline the data flow and timers for timed AI modules.

Reimplemented from AIM.

std::map< std::string, AIMValue > & TopLocations::getProperties ( )
virtual

TODO: create function import properties

  • read the properties from a JSON string (easier to call setProperty from Java/IOS)

Reimplemented from AIM.

vector< AIMValue > TopLocations::getRequirements ( ) const
virtual

Get the requirements of the module.

Returns
vector<AIMValue> The list of requirements.

Reimplemented from AIM.

bool TopLocations::requirementsAreUpdated ( bool  reset = true) const
virtual

Return wether the requirements have been updated since the last call to this function.

Parameters
resetIf false, don't reset wether the requirements have been updated.
Returns
true if the requirements are updated since the last call to this function, otherwise false.

Reimplemented from AIM.

void TopLocations::setProperties ( const std::map< std::string, AIMValue > &  properties)
virtual

Set the module properties

Set the defined properties. Old property values will remain if no new values are specified for a property.

Parameters
mapproperties The properties to set

Reimplemented from AIM.

AIMValue TopLocations::setProperty ( const std::string &  key,
AIMValue  value 
)
virtual

Set property

This method sets the value of a property. An AIMValue response value is returned and it can have the type EMPTY if no response data is present.

Parameters
stringkey The key of the property
AIMValuevalue The value of the property
Returns
AIMValue An optional response value.

Reimplemented from AIM.

Member Data Documentation

const std::string TopLocations::PROPERTY_MAX_INTERPOLATION_INTERVAL
static
Initial value:
=
"max_interpolation_interval"

The documentation for this class was generated from the following files: