Skip to content
Snippets Groups Projects
Select Git revision
  • 6902131012d54f5fb0f68dbd489a79f6f6bfba06
  • main default protected
  • Kelvinrr-patch-5
  • Kelvinrr-patch-4
  • Kelvinrr-patch-3
  • update_release_doc
  • Kelvinrr-patch-2
  • Kelvinrr-patch-1
  • spice_docs
  • ale_testing
  • changelog_docs
  • 1.0.1
  • 1.0.0
13 results

spice-kernel-updates-in-isis.md

Blame
  • DBManager.h 3.18 KiB
    #ifndef DBMANAGER_H
    #define	DBMANAGER_H
    
    #include <Configuration.h>
    
    #include <tango.h>
    
    #include <ctime>
    
    #include <boost/tuple/tuple.hpp>
    #include <boost/optional/optional.hpp>
    #include <boost/scoped_ptr.hpp>
    #include <boost/thread/mutex.hpp>
    
    #include <soci/soci.h>
    #include <soci/error.h>
    #include <soci/row.h>
    #include <soci/rowset.h>
    #include <soci/boost-tuple.h>
    #include <soci/boost-optional.h>
    #include <soci/session.h>
    #include <soci/connection-pool.h>
    
    namespace MetadataExporter_ns
    {
    
    class DBManager : public Tango::LogAdapter
    {
    public:
    //------------------------------------------------------------------------------
    //  [Public] Shared pointer typedef
    //------------------------------------------------------------------------------
        typedef boost::shared_ptr<DBManager> SP;
    
    protected:
    //------------------------------------------------------------------------------
    //  [Protected] Constructor destructor deleter
    //------------------------------------------------------------------------------
        DBManager(Tango::DeviceImpl*, Configuration::SP);
    
        virtual ~DBManager();
    
        class Deleter;
        friend class Deleter;
        class Deleter
        {
            public:
                void operator()(DBManager* d) { delete d; }
        };
    
    public:
    //------------------------------------------------------------------------------
    //	[Public] Class creation method
    //------------------------------------------------------------------------------
        static DBManager::SP create(Tango::DeviceImpl*, Configuration::SP);
    
    //------------------------------------------------------------------------------
    //  [Public] Connection management methods
    //------------------------------------------------------------------------------
        virtual void connect() throw(soci::soci_error);
    
        virtual void disconnect();
    
    //------------------------------------------------------------------------------
    //  [Public] Retrieve from information schema method
    //------------------------------------------------------------------------------
        typedef boost::tuple< boost::optional<std::string>, boost::optional<std::string>,
            boost::optional<std::string> > InformationTuple;
    
        typedef std::vector< InformationTuple > InformationList;
    
        virtual InformationList retrieveInformation(std::string,
            std::string) throw(soci::soci_error);
    
    //------------------------------------------------------------------------------
    //  [Public] Retrieve new tuple method
    //------------------------------------------------------------------------------
        typedef boost::shared_ptr< soci::rowset<soci::row> > RowsetSP;
    
        virtual RowsetSP retrieveNewTuples(std::string, std::string, std::tm)
            throw(soci::soci_error, std::out_of_range);
    
    protected:
    //------------------------------------------------------------------------------
    //  [Protected] Class variables
    //------------------------------------------------------------------------------
        //Configuration shared pointer
        Configuration::SP m_configuration_sp;
    
        //Connection pool mutex
        boost::mutex m_connectionPoolMutex;
    
        //Database connection pool scoped pointer
        boost::scoped_ptr<soci::connection_pool> m_connectionPool_sp;
    };
    
    }   //End of namespace
    
    #endif	/* DBMANAGER_H */