Merge 1.0 in.
[dcpomatic.git] / src / lib / server.h
index 398401a555dd1eff784ad1d2289677e5258660f2..77b51d0798ff11da731783b63f9c624301540be1 100644 (file)
@@ -17,6 +17,9 @@
 
 */
 
+#ifndef DCPOMATIC_SERVER_H
+#define DCPOMATIC_SERVER_H
+
 /** @file src/server.h
  *  @brief Class to describe a server to which we can send
  *  encoding work, and a class to implement such a server.
@@ -26,6 +29,7 @@
 #include <boost/thread.hpp>
 #include <boost/asio.hpp>
 #include <boost/thread/condition.hpp>
+#include <boost/optional.hpp>
 #include <libxml++/libxml++.h>
 #include "log.h"
 
@@ -41,6 +45,11 @@ namespace cxml {
 class ServerDescription
 {
 public:
+       ServerDescription ()
+               : _host_name ("")
+               , _threads (1)
+       {}
+       
        /** @param h Server host name or IP address in string form.
         *  @param t Number of threads to use on the server.
         */
@@ -50,6 +59,8 @@ public:
        {}
 
        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 {
@@ -71,7 +82,7 @@ public:
 
        void as_xml (xmlpp::Node *) const;
        
-       static ServerDescription * create_from_metadata (std::string v);
+       static boost::optional<ServerDescription> create_from_metadata (std::string);
 
 private:
        /** server's host name */
@@ -80,7 +91,7 @@ private:
        int _threads;
 };
 
-class Server
+class Server : public boost::noncopyable
 {
 public:
        Server (boost::shared_ptr<Log> log);
@@ -97,3 +108,5 @@ private:
        boost::condition _worker_condition;
        boost::shared_ptr<Log> _log;
 };
+
+#endif