SpatialWorldClient.h
Go to the documentation of this file.
00001 
00011 #ifndef SPATIAL_TEMPORAL_LEARNING_WORLDLIB_REMOTE_SPATIAL_WORLD_CLIENT_H_
00012 #define SPATIAL_TEMPORAL_LEARNING_WORLDLIB_REMOTE_SPATIAL_WORLD_CLIENT_H_
00013 
00014 // worldlib
00015 #include "SpatialWorldObservation.h"
00016 #include "SqlClient.h"
00017 #include "../model/PersistenceModel.h"
00018 #include "../world/Observation.h"
00019 
00020 // Boost
00021 #include <boost/random.hpp>
00022 
00023 // C++ Standard Library
00024 #include <vector>
00025 
00026 namespace rail
00027 {
00028 namespace spatial_temporal_learning
00029 {
00030 namespace worldlib
00031 {
00032 namespace remote
00033 {
00034 
00041 class SpatialWorldClient : public SqlClient
00042 {
00043 public:
00052   SpatialWorldClient(const SpatialWorldClient &client);
00053 
00065   SpatialWorldClient(const std::string &host, const uint16_t port, const std::string &user, const std::string &password,
00066       const std::string &database);
00067 
00076   virtual bool connect();
00077 
00083   void clearAllEntities() const;
00084 
00094   void addObservations(const std::vector<world::Observation> &observations) const;
00095 
00106   void addObservation(const world::Item &item, const world::Surface &surface, const geometry::Pose &pose) const;
00107 
00115   void addObservation(const world::Observation &observation) const;
00116 
00126   void getObservationsByItemName(const std::string &item_name,
00127       std::vector<SpatialWorldObservation> &observations) const;
00128 
00138   void getObservationsBySurfaceName(const std::string &surface_name,
00139       std::vector<SpatialWorldObservation> &observations) const;
00140 
00151   void getObservationsByItemAndSurfaceName(const std::string &item_name, const std::string &surface_name,
00152       std::vector<SpatialWorldObservation> &observations) const;
00153 
00163   void getObservationsBySurfaceFrameID(const std::string &surface_frame_id,
00164       std::vector<SpatialWorldObservation> &observations) const;
00165 
00174   std::string getMostFrequentSurfaceName(const std::string &item_name) const;
00175 
00184   std::string getMostFrequentSurfaceName(const world::Item &item) const;
00185 
00193   void updateObservation(const SpatialWorldObservation &observation) const;
00194 
00205   bool itemExistsOnSurface(const std::string &item_name, const std::string &surface_name) const;
00206 
00216   bool itemObservedOnSurface(const world::Item &item, const world::Surface &surface) const;
00217 
00227   bool itemObservedOnSurface(const std::string &item_name, const std::string &surface_name) const;
00228 
00240   void markObservationsAsRemoved(const world::Item &item, const world::Surface &surface,
00241       const ros::Time &removed_observed = ros::Time::now());
00242 
00254   void markObservationsAsRemoved(const std::string &item_name, const std::string &surface_name,
00255       const ros::Time &removed_observed = ros::Time::now());
00256 
00264   void getUniqueSurfaceNames(std::vector<std::string> &names) const;
00265 
00276   model::PersistenceModel getPersistenceModel(const std::string &item_name, const std::string &surface_name) const;
00277 
00288   model::PersistenceModel getPersistenceModel(const world::Item &item, const world::Surface &surface) const;
00289 
00290 private:
00292   boost::mt19937 random_;
00293 
00299   void createTable();
00300 
00312   void getObservationsHelper(std::vector<SpatialWorldObservation> &observations, const std::string &where_clause,
00313       const uint32_t limit = 0, const std::string &order_by = "`time` ASC") const;
00314 };
00315 
00316 }
00317 }
00318 }
00319 }
00320 
00321 #endif


worldlib
Author(s): Russell Toris
autogenerated on Fri Feb 12 2016 00:24:19