00001
00002 #ifndef restcgi_endpoint_h
00003 #define restcgi_endpoint_h
00004 #include "apidefs.h"
00005 #include "env.h"
00006 #include <iostream>
00007 #include <boost/shared_ptr.hpp>
00008 #include <boost/weak_ptr.hpp>
00009 namespace restcgi {
00010 class method;
00023 class RESTCGI_API endpoint {
00024 public:
00025 typedef boost::shared_ptr<endpoint> pointer;
00026 typedef boost::shared_ptr<const endpoint> const_pointer;
00027 typedef restcgi::env env_type;
00028 typedef boost::shared_ptr<method> method_pointer;
00029 ~endpoint();
00036 method_pointer receive();
00037 const env_type& env() const {return env_;}
00038 void env_override(const std::string& name, const std::string& value);
00039 static pointer create();
00040 static pointer create(std::istream& is, std::ostream& os);
00041 static pointer create(const env_type& e, std::istream& is, std::ostream& os);
00042 private:
00043 endpoint(const endpoint&);
00044 endpoint& operator =(const endpoint&);
00045 endpoint(const env_type& e, std::istream& is, std::ostream& os);
00046 boost::weak_ptr<endpoint> this_;
00047 env_type env_;
00048 friend class method;
00049 friend class icontent;
00050 friend class ocontent;
00051 std::istream& is_;
00052 std::ostream& os_;
00053 };
00054 }
00055 #endif