AGX Dynamics 2.42.3.1
Loading...
Searching...
No Matches
agxPlot::DataSeries Class Reference

Class that encapsulates data to be plotted, including methods for accessing the data, either via lambdas, Listeners or Uuid:s found in a simulation. More...

#include <DataSeries.h>

+ Inheritance diagram for agxPlot::DataSeries:

Public Types

enum  Settings { DATASERIES_SETTINGS_NONE = 0 , DATASERIES_SETTINGS_ISTIME = 1 }
 

Public Member Functions

 DataSeries (agxPlot::DataGenerator *dataGenerator, const agx::String &name)
 Create a DataSeries that calls getValue on the given DataGenerator to generate data.
 
 DataSeries (agxPlot::DataListener *listener, const agx::String &name)
 Create a DataSeries that calls the getValue operator of the DataListener to generate data.
 
 DataSeries (agxPlot::DataSeries *source)
 Create a DataSeries that gets fed by the source specified.
 
 DataSeries (agxPlot::DataSeries *sourceA, agxPlot::DataSeries *sourceB)
 Create a DataSeries that gets fed by two sources and adding their data.
 
 DataSeries (const agx::String &dataPath, agxSDK::Simulation *simulation, const agx::String &name)
 Create a DataSeries that calls the getValue operator of the DataListener to generate data.
 
 DataSeries (const agx::String &name="")
 Create a DataSeries that can only get values by manually pushing them.
 
 DataSeries (const agx::Uuid &entityId, const agx::String &dataPath, agxSDK::Simulation *simulation, const agx::String &name)
 Create a DataSeries that takes fields from the object specified by the entity ID.
 
 DataSeries (std::function< double()> lambdaFunction, const agx::String &name)
 Create a DataSeries that calls the specified function to generate data.
 
void clearData ()
 Remove all values in stored.
 
void generateCurrentValue ()
 Fetches the current value from the specified way of generation and append it to the series.
 
const agx::RealVector & getAllValues () const
 Get all values that have been generated so far.
 
const agx::String & getDataPath () const
 
void getDescription (agxJson::Value &root) const
 Get the description of the following format.
 
agx::Uuid getEntityId () const
 
agx::UInt getID () const
 
bool getLogarithmic () const
 
const agx::String & getName () const
 Get the name of the data series.
 
size_t getNewValueMarker () const
 Get the index of the oldest new value.
 
const agxUtil::Statistic * getStatistic () const
 Return the statistic, if any, through which data from generator is passed before being added to the data series.
 
const agx::String & getUnit () const
 Get the unit of the data series.
 
bool hasDataPath () const
 
bool hasImportedJournalData () const
 
void importedJournal ()
 
bool isTime () const
 Time works different, thus the time data series have this flag.
 
void push (agx::Real value)
 Manually add a value at the end of the DataSeries.
 
void resetDirty ()
 All current values are now observed and dirty flags can be cleaned up.
 
void setFromDescription (const agxJson::Value &root)
 Set from a description of the format from getDescription.
 
void setLogarithmic (bool isLogarithmic)
 Should the axis be logarithmic if displayed.
 
void setName (const agx::String &name)
 Set the name of the data series.
 
void setSettings (agx::UInt16 settings)
 Set special settings for the data series.
 
void setStatistic (agxUtil::Statistic *statistic)
 Pass data read from the data generator through the given statistic before adding it to the data series.
 
void setStatistic (agxUtil::StatisticHandleRef statistic)
 Pass data read from the data generator through the given statistic before adding it to the data series.
 
void setUnit (const agx::String &unit)
 Set a string representing the unit of the data series.
 
- Public Member Functions inherited from agx::Referenced
 Referenced ()
 Default constructor.
 
 Referenced (const Referenced &)
 
template<typename T >
T * as ()
 Subclass casting.
 
template<typename T >
const T * as () const
 
template<typename T >
T * asSafe ()
 Safe subclass casting, return nullptr if template type does not match.
 
template<typename T >
const T * asSafe () const
 
int getReferenceCount () const
 
template<typename T >
bool is () const
 Subclass test.
 
Referenced & operator= (const Referenced &)
 Assignment operator. Will increment the number of references to the referenced object.
 
void reference (void *ptr=nullptr) const
 Explicitly increment the reference count by one, indicating that this object has another pointer which is referencing it.
 
void unreference (void *ptr=nullptr) const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 
void unreference_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
 

Public Attributes

agx::Event representationChanged
 

Protected Member Functions

virtual ~DataSeries ()
 
void init (DataGeneratorRef generator, const agx::String &name)
 
- Protected Member Functions inherited from agx::Referenced
virtual ~Referenced ()
 Destructor.
 
void allocateObserverVector () const
 
void deleteUsingDeleteHandler () const
 

Additional Inherited Members

- Static Public Member Functions inherited from agx::Referenced
template<typename T >
static bool ValidateCast (const Referenced *object)
 
- Static Protected Member Functions inherited from agx::Referenced
static DeleteHandler * getDeleteHandler ()
 
static void setDeleteHandler (DeleteHandler *handler)
 Internal: Set a DeleteHandler to which deletion of all referenced counted objects will be delegated to.
 
- Protected Attributes inherited from agx::Referenced
Mutex m_mutex
 
ObserverContainer m_observers
 
AtomicValue m_refCount
 

Detailed Description

Class that encapsulates data to be plotted, including methods for accessing the data, either via lambdas, Listeners or Uuid:s found in a simulation.

Definition at line 44 of file DataSeries.h.

Member Enumeration Documentation

◆ Settings

Enumerator
DATASERIES_SETTINGS_NONE 
DATASERIES_SETTINGS_ISTIME 

Definition at line 47 of file DataSeries.h.

Constructor & Destructor Documentation

◆ DataSeries() [1/8]

agxPlot::DataSeries::DataSeries ( const agx::Uuid &  entityId,
const agx::String &  dataPath,
agxSDK::Simulation *  simulation,
const agx::String &  name 
)

Create a DataSeries that takes fields from the object specified by the entity ID.

A good way to directly access fields in the Journal.

◆ DataSeries() [2/8]

agxPlot::DataSeries::DataSeries ( std::function< double()>  lambdaFunction,
const agx::String &  name 
)

Create a DataSeries that calls the specified function to generate data.

◆ DataSeries() [3/8]

agxPlot::DataSeries::DataSeries ( agxPlot::DataListener *  listener,
const agx::String &  name 
)

Create a DataSeries that calls the getValue operator of the DataListener to generate data.

◆ DataSeries() [4/8]

agxPlot::DataSeries::DataSeries ( agxPlot::DataGenerator *  dataGenerator,
const agx::String &  name 
)

Create a DataSeries that calls getValue on the given DataGenerator to generate data.

◆ DataSeries() [5/8]

agxPlot::DataSeries::DataSeries ( const agx::String &  dataPath,
agxSDK::Simulation *  simulation,
const agx::String &  name 
)

Create a DataSeries that calls the getValue operator of the DataListener to generate data.

◆ DataSeries() [6/8]

agxPlot::DataSeries::DataSeries ( agxPlot::DataSeries *  source)

Create a DataSeries that gets fed by the source specified.

A good way to connect simulations.

◆ DataSeries() [7/8]

agxPlot::DataSeries::DataSeries ( agxPlot::DataSeries *  sourceA,
agxPlot::DataSeries *  sourceB 
)

Create a DataSeries that gets fed by two sources and adding their data.

Used for contacts where we want a statistic on one of them but not the other.

Sets name and unit from sourceA

◆ DataSeries() [8/8]

agxPlot::DataSeries::DataSeries ( const agx::String &  name = "")

Create a DataSeries that can only get values by manually pushing them.

◆ ~DataSeries()

virtual agxPlot::DataSeries::~DataSeries ( )
protectedvirtual

Member Function Documentation

◆ clearData()

void agxPlot::DataSeries::clearData ( )

Remove all values in stored.

◆ generateCurrentValue()

void agxPlot::DataSeries::generateCurrentValue ( )

Fetches the current value from the specified way of generation and append it to the series.

◆ getAllValues()

const agx::RealVector & agxPlot::DataSeries::getAllValues ( ) const

Get all values that have been generated so far.

◆ getDataPath()

const agx::String & agxPlot::DataSeries::getDataPath ( ) const

◆ getDescription()

void agxPlot::DataSeries::getDescription ( agxJson::Value &  root) const

Get the description of the following format.

["name"] = the name of the data series (axis) ["unit"] = the unit of the data series ["isLogarithmic"] = should the data series be viewed as logarithmic ["isTime"] = the data series represents time ["id"] = the id of the data series

◆ getEntityId()

agx::Uuid agxPlot::DataSeries::getEntityId ( ) const

◆ getID()

agx::UInt agxPlot::DataSeries::getID ( ) const

◆ getLogarithmic()

bool agxPlot::DataSeries::getLogarithmic ( ) const

◆ getName()

const agx::String & agxPlot::DataSeries::getName ( ) const

Get the name of the data series.

◆ getNewValueMarker()

size_t agxPlot::DataSeries::getNewValueMarker ( ) const

Get the index of the oldest new value.

All values after this are 'dirty'.

◆ getStatistic()

const agxUtil::Statistic * agxPlot::DataSeries::getStatistic ( ) const

Return the statistic, if any, through which data from generator is passed before being added to the data series.

May be nullptr.

◆ getUnit()

const agx::String & agxPlot::DataSeries::getUnit ( ) const

Get the unit of the data series.

◆ hasDataPath()

bool agxPlot::DataSeries::hasDataPath ( ) const

◆ hasImportedJournalData()

bool agxPlot::DataSeries::hasImportedJournalData ( ) const

◆ importedJournal()

void agxPlot::DataSeries::importedJournal ( )

◆ init()

void agxPlot::DataSeries::init ( DataGeneratorRef  generator,
const agx::String &  name 
)
protected

◆ isTime()

bool agxPlot::DataSeries::isTime ( ) const

Time works different, thus the time data series have this flag.

◆ push()

void agxPlot::DataSeries::push ( agx::Real  value)

Manually add a value at the end of the DataSeries.

Parameters
valuethe new value to append

◆ resetDirty()

void agxPlot::DataSeries::resetDirty ( )

All current values are now observed and dirty flags can be cleaned up.

◆ setFromDescription()

void agxPlot::DataSeries::setFromDescription ( const agxJson::Value &  root)

Set from a description of the format from getDescription.

◆ setLogarithmic()

void agxPlot::DataSeries::setLogarithmic ( bool  isLogarithmic)

Should the axis be logarithmic if displayed.

◆ setName()

void agxPlot::DataSeries::setName ( const agx::String &  name)

Set the name of the data series.

◆ setSettings()

void agxPlot::DataSeries::setSettings ( agx::UInt16  settings)

Set special settings for the data series.

◆ setStatistic() [1/2]

void agxPlot::DataSeries::setStatistic ( agxUtil::Statistic *  statistic)

Pass data read from the data generator through the given statistic before adding it to the data series.

This DataSeries will take ownership of the given statistic object and will call delete on it when destroyed.

◆ setStatistic() [2/2]

void agxPlot::DataSeries::setStatistic ( agxUtil::StatisticHandleRef  statistic)

Pass data read from the data generator through the given statistic before adding it to the data series.

This DataSeries will take ownership of the statitic in the given statistic handle and will call delete on it when destroyed. The given statistic handle will be empty and cannot be reused when setStatistic returns.

◆ setUnit()

void agxPlot::DataSeries::setUnit ( const agx::String &  unit)

Set a string representing the unit of the data series.

Member Data Documentation

◆ representationChanged

agx::Event agxPlot::DataSeries::representationChanged

Definition at line 214 of file DataSeries.h.


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