ClockWork DB CoreAPI 1.0.48
Abstract Time Series and Storage/Management Library
Loading...
Searching...
No Matches
tom::tsdb::time_series Class Referenceabstract

#include <tom-tsdb/time_series.hpp>

+ Inheritance diagram for tom::tsdb::time_series:
+ Collaboration diagram for tom::tsdb::time_series:

Public Types

typedef std::map< tom::string, tom::stringattribute_map_t
 
typedef std::set< tom::stringattribute_set_t
 
typedef bool(tom::tsdb::datastore::* populate_data_func) (tom::collections::time_series &ts, const tom::string &name, tom::tsdb::native_data_type data_t, tom::calendars::calendar &cal, tom::calendars::date_int_type from, tom::calendars::date_int_type to)
 

Public Member Functions

bool alias_set_touched () const
 
virtual bool exists () const
 
size_t get_added_aliases (alias_set &added) const
 
virtual aggregation_type get_aggregation_type () const =0
 
virtual alias_setget_alias_set ()
 
virtual const alias_setget_alias_set () const
 
const tom::Stringget_attribute (const char *att_name, bool check_datastore=true) const
 
const tom::Stringget_attribute (const tom::observation &att_name, bool check_datastore=true) const
 
const tom::Stringget_attribute (const tom::String &att_name, bool check_datastore=true) const
 
virtual const attribute_set_t & get_changed_attribute_names () const
 
virtual const tom::calendars::date_time & get_create_date_time () const =0
 
virtual const values::data_type & get_data_type () const =0
 
virtual tom::tsdb::datastoreget_datastore () const =0
 
size_t get_dropped_aliases (alias_set &dropped) const
 
virtual tom::calendars::date_int_type get_first_dirty_date_int () const =0
 
virtual tom::calendars::date_int_type get_last_dirty_date_int () const =0
 
virtual const tom::calendars::date_time & get_modify_date_time () const =0
 
virtual const tom::stringget_name () const =0
 
virtual const void * get_raw_data () const =0
 
virtual bool is_sparse_series () const =0
 
bool operator!= (const time_series &rhs) const
 
bool operator== (const time_series &rhs) const
 
virtual void save (bool overwrite=false)
 
virtual void set_aggregation_type (aggregation_type)=0
 
void set_attribute (const char *att_name, const char *att_value)
 
void set_attribute (const tom::observation &att_name, const tom::observation &att_value)
 
void set_attribute (const tom::String &att_name, const tom::String &att_value)
 
- Public Member Functions inherited from tom::collections::time_series
virtual time_series_iteratorbegin () const =0
 
virtual const void * data () const
 
virtual time_series_iteratorend () const =0
 
virtual tom::calendars::calendarget_calendar () const =0
 
date get_first_date () const
 
virtual date_int_type get_first_date_int () const
 
date get_last_date () const
 
virtual date_int_type get_last_date_int () const
 
virtual const observationget_observation (date d) const =0
 
virtual const observationget_observation (date_int_type d) const =0
 
virtual const observationoperator[] (date d) const =0
 
virtual observationoperator[] (date d)=0
 
virtual const observationoperator[] (date_int_type d) const =0
 
virtual observationoperator[] (date_int_type d)=0
 
virtual std::ostream & print (std::ostream &) const =0
 
void set_observation (const Date &d, bool f)
 
virtual void set_observation (const Date &d, const char *f)
 
virtual void set_observation (const Date &d, const observation &val)
 
virtual void set_observation (const Date &d, const std::string &f)
 
void set_observation (const Date &d, double f)
 
void set_observation (const Date &d, float f)
 
void set_observation (const Date &d, int f)
 
void set_observation (const Date &d, tom::value_type f)
 
void set_observation (date d, bool f)
 
virtual void set_observation (date d, const char *f)
 
virtual void set_observation (date d, const Date &)=0
 
virtual void set_observation (date d, const observation &val)=0
 
virtual void set_observation (date d, const std::string &f)
 
void set_observation (date d, double f)
 
void set_observation (date d, float f)
 
void set_observation (date d, int f)
 
void set_observation (date d, tom::value_type f)
 
void set_observation (date_int_type d, bool f)
 
virtual void set_observation (date_int_type d, const char *f)
 
virtual void set_observation (date_int_type d, const Date &)=0
 
virtual void set_observation (date_int_type d, const observation &val)=0
 
virtual void set_observation (date_int_type d, const std::string &f)
 
void set_observation (date_int_type d, double f)
 
void set_observation (date_int_type d, float f)
 
void set_observation (date_int_type d, int f)
 
void set_observation (date_int_type d, tom::value_type f)
 

Protected Member Functions

bool populate_alias_set () const
 
virtual void set_create_date_time (const tom::calendars::date_time &)=0
 
virtual void set_modify_date_time (const tom::calendars::date_time &)=0
 
- Protected Member Functions inherited from tom::collections::time_series
date_int_type set_first_date_int (const date_int_type d)
 
date_int_type set_last_date_int (const date_int_type d)
 

Protected Attributes

alias_set m_alias_set
 
bool m_alias_set_touched
 
attribute_map_t m_attributes
 
attribute_set_t m_changed_attributes
 
alias_set m_original_alias_set
 
- Protected Attributes inherited from tom::collections::time_series
date_int_type m_end_date_int
 
date_int_type m_start_date_int
 

Friends

class ::tom::tsdb::datastore
 

Detailed Description

time_series derive from tom::collection::time_series adding the requirements needed for persistent management. These include a name, or identifier, alias_sets, data and aggregation information, user defined attributes, indication if the series is sparse, and several others.

Time_series are internally heavily templatized classes that have excellant runtime characteristics and typically amortized constant performance on basic operations like copying, and 0(N) on iterative operations like visiting all data observations.

Time_series are also garbage collected entities and may be passed through out a program without concern for memory management issues.

Finally, while there are concrete template classes, it is far easier to use the datastore::create_time_series(...) methods to create both time_series and sparse_series objects.

Constructor & Destructor Documentation

◆ ~time_series()

virtual tom::tsdb::time_series::~time_series ( )
inlinevirtual

Reimplemented from tom::collections::time_series.

Member Function Documentation

◆ alias_set_touched()

bool tom::tsdb::time_series::alias_set_touched ( ) const

Check if anyone has accessed the alias_set. This is mainly useful for persistence back-ends who need to check if the alias_set should be checked for changes.

◆ exists()

bool tom::tsdb::time_series::exists ( ) const
virtual

Does the time_series already exist in the datastore?

◆ get_added_aliases()

size_t tom::tsdb::time_series::get_added_aliases ( alias_set added) const

Get a count of the number of aliases added, and the added aliases added to the passed alias_set. This method is mainly useful for persistence back-ends/

◆ get_aggregation_type()

virtual aggregation_type tom::tsdb::time_series::get_aggregation_type ( ) const
pure virtual

◆ get_alias_set() [1/2]

alias_set & tom::tsdb::time_series::get_alias_set ( )
virtual

get the alias_set for the time_series. this may then be queried and/or updated and will be saved when the time_series object is itself changed.

◆ get_alias_set() [2/2]

const alias_set & tom::tsdb::time_series::get_alias_set ( ) const
virtual

get the alias_set for the time_series. this may then be queried but not updated and no changes can be saved when the time_series object is itself changed.

◆ get_attribute() [1/3]

const tom::String & tom::tsdb::time_series::get_attribute ( const char *  att_name,
bool  check_datastore = true 
) const
inline

get a user defined attribute for the time_series object. Users may associate any type of observation with time_series objects using a unique key for the object. For instance, users may want to store a description of a time_series, which may later be retrieved with this method, e.g., descr = time_series::get_attribute( "description" );

◆ get_attribute() [2/3]

const tom::String & tom::tsdb::time_series::get_attribute ( const tom::observation att_name,
bool  check_datastore = true 
) const
inline

get a user defined attribute for the time_series object. Users may associate any type of observation with time_series objects using a unique key for the object. For instance, users may want to store a description of a time_series, which may later be retrieved with this method, e.g., descr = time_series::get_attribute( "description" );

◆ get_attribute() [3/3]

const tom::String & tom::tsdb::time_series::get_attribute ( const tom::String att_name,
bool  check_datastore = true 
) const

get a user defined attribute for the time_series object. Users may associate any type of observation with time_series objects using a unique key for the object. For instance, users may want to store a description of a time_series, which may later be retrieved with this method, e.g., descr = time_series::get_attribute( "description" );

◆ get_create_date_time()

virtual const tom::calendars::date_time & tom::tsdb::time_series::get_create_date_time ( ) const
pure virtual

get the date_time of the time_series objects creation within the datastore.

Implemented in tom::tsdb::collections::sparse_series< T, NATIVE_TYPE >, and tom::tsdb::collections::time_series< T, NATIVE_TYPE >.

◆ get_data_type()

virtual const values::data_type & tom::tsdb::time_series::get_data_type ( ) const
pure virtual

◆ get_datastore()

virtual tom::tsdb::datastore & tom::tsdb::time_series::get_datastore ( ) const
pure virtual

◆ get_dropped_aliases()

size_t tom::tsdb::time_series::get_dropped_aliases ( alias_set dropped) const

Get a count of the number of aliases dropped, and the dropped aliases added to the passed alias_set. This method is mainly useful for persistence back-ends/

◆ get_first_dirty_date_int()

virtual tom::calendars::date_int_type tom::tsdb::time_series::get_first_dirty_date_int ( ) const
pure virtual

get the date_int_type for the earliest changed observation. This is mainly useful for persistence back-ends, but may be useful for you too.

Implemented in tom::tsdb::collections::sparse_series< T, NATIVE_TYPE >, and tom::tsdb::collections::time_series< T, NATIVE_TYPE >.

◆ get_last_dirty_date_int()

virtual tom::calendars::date_int_type tom::tsdb::time_series::get_last_dirty_date_int ( ) const
pure virtual

get the date_int_type for the latest changed observation. This is mainly useful for persistence back-ends, but may be useful for you too.

Implemented in tom::tsdb::collections::sparse_series< T, NATIVE_TYPE >, and tom::tsdb::collections::time_series< T, NATIVE_TYPE >.

◆ get_modify_date_time()

virtual const tom::calendars::date_time & tom::tsdb::time_series::get_modify_date_time ( ) const
pure virtual

get the date_time of the time_series objects last modification within the datastore.

Implemented in tom::tsdb::collections::sparse_series< T, NATIVE_TYPE >, and tom::tsdb::collections::time_series< T, NATIVE_TYPE >.

◆ get_name()

virtual const tom::string & tom::tsdb::time_series::get_name ( ) const
pure virtual

◆ is_sparse_series()

virtual bool tom::tsdb::time_series::is_sparse_series ( ) const
pure virtual

indicates if the time_series contains only sparse data, or data at near regular intervals

Implemented in tom::tsdb::collections::sparse_series< T, NATIVE_TYPE >, and tom::tsdb::collections::time_series< T, NATIVE_TYPE >.

◆ operator!=()

bool tom::tsdb::time_series::operator!= ( const time_series rhs) const

Check for time_series object inequality. This checks all facets of the time_series such as aliases, data, data type, etc.

◆ operator==()

bool tom::tsdb::time_series::operator== ( const time_series rhs) const

Check for time_series object equality. This checks all facets of the time_series such as aliases, data, data type, etc.

◆ save()

void tom::tsdb::time_series::save ( bool  overwrite = false)
virtual

save the time_series object in the parent datastore. if overwrite is true, objects having the same name but different type, calendar, etc. will be overwritten by this time_series.

This method may throw a derivative of the std::runtime_error if persistence errors occur and hence should be wrapped in a try block for safety.

◆ set_aggregation_type()

virtual void tom::tsdb::time_series::set_aggregation_type ( aggregation_type  )
pure virtual

◆ set_attribute() [1/3]

void tom::tsdb::time_series::set_attribute ( const char *  att_name,
const char *  att_value 
)
inline

set a user defined attribute for the time_series object. Users may associate any type of observation with time_series objects using a unique key for the object. For instance, users may want to store a description of a time_series, which may later be retrieved with the get_attribute method, e.g., time_series::set_attribute( "description", "my favorite time-series" );

◆ set_attribute() [2/3]

void tom::tsdb::time_series::set_attribute ( const tom::observation att_name,
const tom::observation att_value 
)
inline

set a user defined attribute for the time_series object. Users may associate any type of observation with time_series objects using a unique key for the object. For instance, users may want to store a description of a time_series, which may later be retrieved with the get_attribute method, e.g., time_series::set_attribute( "description", "my favorite time-series" );

◆ set_attribute() [3/3]

void tom::tsdb::time_series::set_attribute ( const tom::String att_name,
const tom::String att_value 
)

set a user defined attribute for the time_series object. Users may associate any type of observation with time_series objects using a unique key for the object. For instance, users may want to store a description of a time_series, which may later be retrieved with the get_attribute method, e.g., time_series::set_attribute( "description", "my favorite time-series" );


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