Commit f765dfa9 authored by Marco De Marco's avatar Marco De Marco
Browse files

PrepareResponse method stub added

parent 0c351488
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -3,6 +3,8 @@

#include <boost/lexical_cast.hpp>

#include <google/protobuf/stubs/common.h>

namespace MetadataExporter_ns
{

@@ -15,6 +17,8 @@ Server::Server(Tango::DeviceImpl* deviceImpl_p, Configuration::SP configuration_
{
    DEBUG_STREAM << "Server::Server()" << endl;

    GOOGLE_PROTOBUF_VERIFY_VERSION;

    m_ioService_sp.reset(new boost::asio::io_service);

    m_work_sp.reset(new boost::asio::io_service::work(*m_ioService_sp));
@@ -41,6 +45,8 @@ Server::~Server()

        m_threadGroup_sp->join_all();
    }

    google::protobuf::ShutdownProtobufLibrary();
}

//==============================================================================
+25 −0
Original line number Diff line number Diff line
@@ -21,4 +21,29 @@ Session::~Session()
    DEBUG_STREAM << "Session::~Session()" << endl;
}

//==============================================================================
//      Session::prepareResponse()
//==============================================================================
Session::ResponseSP Session::prepareResponse(Session::RequestSP request)
{
    DEBUG_STREAM << "Client::prepareResponse()" << endl;

    ResponseSP response_sp(new Response());

    switch(request->type())
    {
        case Request::AUTHORIZATION:
            break;

        case Request::METADATA:
            break;

        default:
            ERROR_STREAM << "BAD REQUEST " << endl; //TODO: bad request case
            break;
    }

    return response_sp;
}

}   //namespace
+14 −4
Original line number Diff line number Diff line
@@ -7,19 +7,27 @@
#include <boost/array.hpp>
#include <boost/shared_ptr.hpp>

#include <Response.pb.h>
#include <Request.pb.h>

namespace MetadataExporter_ns
{

class Session : public Tango::LogAdapter
{
public:
public:     //TODO: buffer
//------------------------------------------------------------------------------
//  [Public] Shared pointer typedef
//  [Public] Buffer shared pointer typedef
//------------------------------------------------------------------------------
    typedef boost::array< char, 256 > Buffer;

    typedef boost::shared_ptr< Buffer > BufferSP;

//------------------------------------------------------------------------------
//  [Public] Request Response shared pointer typedef
//------------------------------------------------------------------------------
    typedef boost::shared_ptr<Request> RequestSP;
    typedef boost::shared_ptr<Response> ResponseSP;

//------------------------------------------------------------------------------
//  [Public] Shared pointer typedef
//------------------------------------------------------------------------------
@@ -50,6 +58,8 @@ protected:

    virtual void handleResponse(const boost::system::error_code&, std::size_t) = 0;

    virtual ResponseSP prepareResponse(RequestSP);

//------------------------------------------------------------------------------
//	[Protected] Class variables
//------------------------------------------------------------------------------