00001 /* 00002 * Reference.hpp 00003 * 00004 * Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved. 00005 * 00006 * Oracle is a registered trademarks of Oracle Corporation and/or its 00007 * affiliates. 00008 * 00009 * This software is the confidential and proprietary information of Oracle 00010 * Corporation. You shall not disclose such confidential and proprietary 00011 * information and shall use it only in accordance with the terms of the 00012 * license agreement you entered into with Oracle. 00013 * 00014 * This notice may not be removed or altered. 00015 */ 00016 #ifndef COH_REFERENCE_HPP 00017 #define COH_REFERENCE_HPP 00018 00019 #include "coherence/lang/compatibility.hpp" 00020 00021 #include "coherence/lang/interface_spec.hpp" 00022 #include "coherence/lang/Object.hpp" 00023 #include "coherence/lang/TypedHandle.hpp" 00024 00025 COH_OPEN_NAMESPACE2(coherence,lang) 00026 00027 00028 /** 00029 * Reference provides an additional level of indirection to object instances. 00030 * 00031 * It is not a general use class, but rather it is a building block for such 00032 * things as WeakReference. 00033 * 00034 * @author mf 2008.04.10 00035 */ 00036 class COH_EXPORT Reference 00037 : public interface_spec<Reference> 00038 { 00039 // ----- Reference interface -------------------------------------------- 00040 00041 public: 00042 /** 00043 * Set the referenced Object. 00044 * 00045 * @param oh the Object to reference 00046 */ 00047 virtual void set(Object::Holder oh) = 0; 00048 00049 /** 00050 * Return a Holder to the referenced Object. 00051 * 00052 * @return a Holder to the referenced Object 00053 */ 00054 virtual Object::Holder get() const = 0; 00055 00056 /** 00057 * Return a Holder to the referenced Object. 00058 * 00059 * @return a Holder to the referenced Object 00060 */ 00061 virtual Object::Holder get() = 0; 00062 }; 00063 00064 COH_CLOSE_NAMESPACE2 00065 00066 #endif // COH_REFERENCE_HPP