00001 /* 00002 * Serializer.hpp 00003 * 00004 * Copyright (c) 2000, 2014, 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_SERIALIZER_HPP 00017 #define COH_SERIALIZER_HPP 00018 00019 #include "coherence/lang.ns" 00020 00021 #include "coherence/io/ReadBuffer.hpp" 00022 #include "coherence/io/WriteBuffer.hpp" 00023 00024 COH_OPEN_NAMESPACE2(coherence,io) 00025 00026 00027 /** 00028 * The Serializer interface provides the capability of reading and writing an 00029 * object from and to an in-memory buffer. 00030 * 00031 * @author jh 2007.12.20 00032 * 00033 * @see ReadBuffer 00034 * @see WriteBuffer 00035 */ 00036 class COH_EXPORT Serializer 00037 : public interface_spec<Serializer> 00038 { 00039 // ----- Serializer interface ------------------------------------------- 00040 00041 public: 00042 /** 00043 * Serialize an object to a WriteBuffer by writing its state using the 00044 * specified BufferOutput object. 00045 * 00046 * @param hOut the BufferOutput with which to write the object's 00047 * state 00048 * @param v the object to serialize 00049 * 00050 * virtual void IOException if an I/O error occurs 00051 */ 00052 virtual void serialize(WriteBuffer::BufferOutput::Handle hOut, 00053 Object::View v) const = 0; 00054 00055 /** 00056 * Deserialize an object from a ReadBuffer by reading its state using 00057 * the specified BufferInput object. 00058 * 00059 * @param hIn the BufferInput with which to read the object's state 00060 * 00061 * @return the deserialized user type instance 00062 * 00063 * virtual void IOException if an I/O error occurs 00064 */ 00065 virtual Object::Holder deserialize( 00066 ReadBuffer::BufferInput::Handle hIn) const = 0; 00067 }; 00068 00069 COH_CLOSE_NAMESPACE2 00070 00071 #endif // COH_SERIALIZER_HPP