Program Listing for File serializeHelper.h

Return to documentation for file (src/misc/pv/serializeHelper.h)

/*
 * Copyright information and license terms for this software can be
 * found in the file LICENSE that is included with the distribution
 */
/*
 * serializeHelper.h
 *
 *  Created on: Oct 21, 2010
 *      Author: Miha Vitorovic
 */

#ifndef SERIALIZEHELPER_H_
#define SERIALIZEHELPER_H_

#include <pv/serialize.h>
#include <pv/byteBuffer.h>
#include <pv/noDefaultMethods.h>
#include <pv/pvIntrospect.h>

#include <shareLib.h>

namespace epics {
    namespace pvData {

        class epicsShareClass SerializeHelper {
            EPICS_NOT_COPYABLE(SerializeHelper)
        public:

            static void writeSize(std::size_t s, ByteBuffer* buffer,
                    SerializableControl* flusher);

            static std::size_t readSize(ByteBuffer* buffer,
                    DeserializableControl* control);

            static void serializeString(const std::string& value, ByteBuffer* buffer,
                    SerializableControl* flusher);

            static void serializeSubstring(const std::string& value, std::size_t offset,
                    std::size_t count, ByteBuffer* buffer,
                    SerializableControl* flusher);

            static std::string deserializeString(ByteBuffer* buffer,
                    DeserializableControl* control);

        private:
            SerializeHelper() {};
            ~SerializeHelper() {};

            static void writeSize(std::size_t s, ByteBuffer* buffer);

        };

    }
}

#endif /* SERIALIZEHELPER_H_ */