00001 /* 00002 * PortableObject.hpp 00003 * 00004 * Copyright (c) 2000, 2019, 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_PORTABLE_OBJECT_HPP 00017 #define COH_PORTABLE_OBJECT_HPP 00018 00019 #include "coherence/lang.ns" 00020 00021 #include "coherence/io/pof/PofReader.hpp" 00022 #include "coherence/io/pof/PofWriter.hpp" 00023 #include "coherence/io/pof/SystemPofContext.hpp" 00024 00025 COH_OPEN_NAMESPACE3(coherence,io,pof) 00026 00027 00028 /** 00029 * The PortableObject interface is implemented by classes that can 00030 * self-serialize and deserialize their state to and from a POF data stream. 00031 * 00032 * The {@link #readExternal()} and {@link #writeExternal()} methods of the 00033 * PortableObject interface are implemented by a class to give the class 00034 * complete control its own POF serialization and deserialization. 00035 * 00036 * @author jh 2008.01.14 00037 */ 00038 class COH_EXPORT PortableObject 00039 : public interface_spec<PortableObject> 00040 { 00041 // ----- PortableObject interface --------------------------------------- 00042 00043 public: 00044 /** 00045 * Restore the contents of a user type instance by reading its state 00046 * using the specified PofReader. 00047 * 00048 * @param hIn the PofReader from which to read the object's state 00049 */ 00050 virtual void readExternal(PofReader::Handle hIn) = 0; 00051 00052 /** 00053 * Save the contents of a POF user type instance by writing its state 00054 * using the specified PofWriter. 00055 * 00056 * @param hOut the PofWriter to which to write the object's state 00057 */ 00058 virtual void writeExternal(PofWriter::Handle hOut) const = 0; 00059 }; 00060 00061 COH_CLOSE_NAMESPACE3 00062 00063 #endif // COH_PORTABLE_OBJECT_HPP