2 Copyright (C) 2012 Intel Corporation
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #ifndef DATABASESINK_H
21 #define DATABASESINK_H
23 #include "abstractsink.h"
34 mutex = g_mutex_new();
40 int ret = mQueue.count();
41 g_mutex_unlock(mutex);
52 g_cond_wait(&cond, mutex);
55 auto itr = mQueue.begin();
61 g_mutex_unlock(mutex);
74 g_mutex_unlock(mutex);
80 std::vector<T> mQueue;
85 DBObject(): time(0),quit(false) {}
103 Queue<DBObject*> queue;
106 class DatabaseSink : public AbstractSink
110 DatabaseSink(AbstractRoutingEngine* engine, map<string, string> config);
112 virtual PropertyList subscriptions();
113 virtual void supportedChanged(PropertyList supportedProperties);
114 virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid, double timestamp, uint32_t sequence);
115 virtual std::string uuid();
118 PropertyList mSubscriptions;
124 class DatabaseSinkManager: public AbstractSinkManager
127 DatabaseSinkManager(AbstractRoutingEngine* engine, map<string, string> config)
128 :AbstractSinkManager(engine, config)
130 new DatabaseSink(routingEngine, config);
134 #endif // DATABASESINK_H