00001 /* -*- C++ -*- */ 00002 /************************************************************************** 00003 Copyright (c) 2000-2001, Tony Garnock-Jones 00004 All rights reserved. 00005 00006 Redistribution and use in source and binary forms, with or without 00007 modification, are permitted provided that the following conditions are 00008 met: 00009 00010 * Redistributions of source code must retain the above copyright 00011 notice, this list of conditions and the following disclaimer. 00012 00013 * Redistributions in binary form must reproduce the above 00014 copyright notice, this list of conditions and the following 00015 disclaimer in the documentation and/or other materials provided 00016 with the distribution. 00017 00018 * Neither the names of the copyright holders nor the names of this 00019 software's contributors may be used to endorse or promote 00020 products derived from this software without specific prior 00021 written permission. 00022 00023 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00024 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00025 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00026 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR 00027 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00028 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00029 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00030 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00031 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00032 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00033 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 **************************************************************************/ 00035 00036 /* -*- c++ -*- */ 00037 #ifndef MPS_Proxy_H 00038 #define MPS_Proxy_H 00039 00040 namespace MPS { 00041 00042 /** 00043 * Implements a client-side handle on a MPS server object, using a 00044 * Connection. */ 00045 class Proxy { 00046 private: 00047 string address; ///< Resolved object address. 00048 00049 protected: 00050 ref<Connection> _connection; ///< Connection we are using to communicate with the server. 00051 00052 public: 00053 /// Create a Proxy connecting to the given address. 00054 Proxy(string const &_address); 00055 00056 /** 00057 * Set up so that the passed-in Connection::Callback's Method will be 00058 * called by the appropriate Transport's "main loop" when it's next 00059 * safe to call a _receive_... method on this Proxy. Once the 00060 * callback fires, it is deregistered, leaving no registered 00061 * callbacks. Only one callback can be registered at once - if 00062 * another is registered, it replaces the first. */ 00063 void _setCallback(ref<Connection::Callback> callback, Connection::Callback::Method method); 00064 }; 00065 00066 } 00067 00068 #endif