Commit 39b38cea authored by Michael Ott's avatar Michael Ott
Browse files

Add SensorDataStore::insert function to insert SensorDataStoreReading objects...

Add SensorDataStore::insert function to insert SensorDataStoreReading objects instead of (sid, timestamp, value) tuples
parent 6bbc8d9b
......@@ -101,6 +101,13 @@ public:
* @param value The value of the sensor reading.
*/
void insert(SensorId* sid, uint64_t ts, int64_t value);
/**
* @brief This function inserts a single sensor reading into
* the database.
* @param reading A SensorDataStoreReading object.
*/
void insert(SensorDataStoreReading& reading);
/**
* @brief Set the TTL for newly inserted sensor data.
......
......@@ -69,6 +69,13 @@ public:
*/
void insert(SensorId* sid, uint64_t ts, int64_t value);
/**
* @brief This function inserts a single sensor reading into
* the database.
* @param reading A SensorDataStoreReading object.
*/
void insert(SensorDataStoreReading& reading);
/**
* @brief This function sets the TTL of newly inserted readings.
* @param ttl The TTL to be used for new inserts in seconds.
......
......@@ -158,6 +158,10 @@ void SensorDataStoreImpl::insert(SensorId* sid, uint64_t ts, int64_t value)
cass_statement_free(statement);
}
void SensorDataStoreImpl::insert(SensorDataStoreReading& reading) {
insert(&reading.sensorId, reading.timeStamp.getRaw(), reading.value);
}
/**
* @details
* This function updates the prepared statement for inserts
......@@ -509,6 +513,11 @@ void SensorDataStore::insert(SensorId* sid, uint64_t ts, int64_t value)
impl->insert(sid, ts, value);
}
void SensorDataStore::insert(SensorDataStoreReading& reading)
{
impl->insert(reading);
}
/**
* @details
* Instead of doing the actual work, this function simply
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment