Tidy up content mutexes slightly.
[dcpomatic.git] / src / lib / server.h
index 4cb6f25631dacad1b94af089cbe4c6f6812f87c9..e6d3743691e09cc2b3054300e8683031b5534ea1 100644 (file)
 #include <boost/thread.hpp>
 #include <boost/asio.hpp>
 #include <boost/thread/condition.hpp>
+#include <libxml++/libxml++.h>
 #include "log.h"
 
-class DeadlineWrapper;
+class Socket;
+
+namespace cxml {
+       class Node;
+}
 
 /** @class ServerDescription
  *  @brief Class to describe a server to which we can send encoding work.
@@ -44,6 +49,10 @@ public:
                , _threads (t)
        {}
 
+       ServerDescription (boost::shared_ptr<const cxml::Node>);
+
+       /* Default copy constructor is fine */
+       
        /** @return server's host name or IP address in string form */
        std::string host_name () const {
                return _host_name;
@@ -62,7 +71,7 @@ public:
                _threads = t;
        }
 
-       std::string as_metadata () const;
+       void as_xml (xmlpp::Node *) const;
        
        static ServerDescription * create_from_metadata (std::string v);
 
@@ -73,20 +82,20 @@ private:
        int _threads;
 };
 
-class Server
+class Server : public boost::noncopyable
 {
 public:
-       Server (Log* log);
+       Server (boost::shared_ptr<Log> log);
 
        void run (int num_threads);
 
 private:
        void worker_thread ();
-       int process (boost::shared_ptr<DeadlineWrapper> wrapper);
+       int process (boost::shared_ptr<Socket> socket);
 
        std::vector<boost::thread *> _worker_threads;
-       std::list<boost::shared_ptr<DeadlineWrapper> > _queue;
+       std::list<boost::shared_ptr<Socket> > _queue;
        boost::mutex _worker_mutex;
        boost::condition _worker_condition;
-       Log* _log;
+       boost::shared_ptr<Log> _log;
 };