1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the License). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/CDDL.txt 9 * or http://www.opensolaris.org/os/licensing. 10 * See the License for the specific language governing permissions 11 * and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL HEADER in each 14 * file and include the License file at usr/src/CDDL.txt. 15 * If applicable, add the following below this CDDL HEADER, with the 16 * fields enclosed by brackets [] replaced with your own identifying 17 * information: Portions Copyright [yyyy] [name of copyright owner] 18 * 19 * CDDL HEADER END 20 */ 21 22 /* 23 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 24 * Use is subject to license terms. 25 * 26 * Defines classes supporting proxies in the orb. 27 * 28 */ 29 30 #ifndef _PROXY_H 31 #define _PROXY_H 32 33 #pragma ident "@(#)proxy.h 1.9 08/05/20 SMI" 34 35 #include <sys/types.h> 36 #include <sys/os.h> 37 38 class handler; 39 class InterfaceDescriptor; 40 41 // typedef used in _unreferenced() and last_unref() 42 typedef void *unref_t; 43 44 class generic_proxy { 45 public: 46 // 47 // Note that the client handler create function returns 48 // an object reference. 49 // 50 typedef void *(*ProxyCreator)(handler *, InterfaceDescriptor *); 51 52 void increase(); 53 uint_t decrease(); 54 55 protected: 56 generic_proxy(handler *handlerp, InterfaceDescriptor *infp); 57 58 virtual ~generic_proxy(); 59 60 uint_t count_; 61 handler *hand_; 62 InterfaceDescriptor *infdescriptor_; 63 }; 64 65 template<class T> class proxy : public T, public generic_proxy { 66 public: 67 proxy(handler *handlerp, InterfaceDescriptor *infp); 68 69 virtual ~proxy(); 70 71 // Handler is used for CORBA::Object methods. 72 virtual handler *_handler(); 73 74 // Should never call _unreferenced for a proxy. 75 virtual void _unreferenced(unref_t); 76 77 // 78 // Return the dynamic InterfaceDescriptor pointer for this proxy. 79 // Note that different proxies can have different interface 80 // descriptors for the same handler (or server object) and 81 // that this descriptor can be either newer or older than the 82 // one we were compiled with which _interface_descriptor() returns. 83 // 84 virtual InterfaceDescriptor *_deep_type(); 85 86 // Set the deep type. This should be used with extreme caution. 87 void _deep_type(InterfaceDescriptor *infp); 88 89 // Return a pointer to the C++ proxy object. 90 virtual generic_proxy *_this_component_ptr(); 91 }; 92 93 #include <orb/object/proxy_in.h> 94 95 #endif /* _PROXY_H */ 96