00001 /* 00002 * Copyright (c) 2000, 2020, Oracle and/or its affiliates. 00003 * 00004 * Licensed under the Universal Permissive License v 1.0 as shown at 00005 * http://oss.oracle.com/licenses/upl. 00006 */ 00007 #ifndef COH_PORTABLE_OBJECT_HPP 00008 #define COH_PORTABLE_OBJECT_HPP 00009 00010 #include "coherence/lang.ns" 00011 00012 #include "coherence/io/pof/PofReader.hpp" 00013 #include "coherence/io/pof/PofWriter.hpp" 00014 #include "coherence/io/pof/SystemPofContext.hpp" 00015 00016 COH_OPEN_NAMESPACE3(coherence,io,pof) 00017 00018 00019 /** 00020 * The PortableObject interface is implemented by classes that can 00021 * self-serialize and deserialize their state to and from a POF data stream. 00022 * 00023 * The {@link #readExternal()} and {@link #writeExternal()} methods of the 00024 * PortableObject interface are implemented by a class to give the class 00025 * complete control its own POF serialization and deserialization. 00026 * 00027 * @author jh 2008.01.14 00028 */ 00029 class COH_EXPORT PortableObject 00030 : public interface_spec<PortableObject> 00031 { 00032 // ----- PortableObject interface --------------------------------------- 00033 00034 public: 00035 /** 00036 * Restore the contents of a user type instance by reading its state 00037 * using the specified PofReader. 00038 * 00039 * @param hIn the PofReader from which to read the object's state 00040 */ 00041 virtual void readExternal(PofReader::Handle hIn) = 0; 00042 00043 /** 00044 * Save the contents of a POF user type instance by writing its state 00045 * using the specified PofWriter. 00046 * 00047 * @param hOut the PofWriter to which to write the object's state 00048 */ 00049 virtual void writeExternal(PofWriter::Handle hOut) const = 0; 00050 }; 00051 00052 COH_CLOSE_NAMESPACE3 00053 00054 #endif // COH_PORTABLE_OBJECT_HPP