Click here to Skip to main content
15,888,984 members
Articles / Programming Languages / C++

RMI for C++

Rate me:
Please Sign up or sign in to vote.
4.87/5 (113 votes)
6 Aug 2009CPOL8 min read 823.2K   4.6K   153  
User-friendly remote method invocation in C++.
//*****************************************************************************
// RCF - Remote Call Framework
// Copyright (c) 2005, Jarl Lindrud.
// Contact: jlindrud@hotmail.com .
//
// Distributed under the so-called MIT license, see accompanying file license.txt.
//*****************************************************************************

#ifndef _RCF_PROTOCOL_SF_HPP
#define _RCF_PROTOCOL_SF_HPP

#include <RCF/Protocol/Protocol.hpp>

#include <SF/ITextStream.hpp>
#include <SF/OTextStream.hpp>
#include <SF/IBinaryStream.hpp>
#include <SF/OBinaryStream.hpp>
#include <SF/string.hpp>

namespace RCF {

    template<> 
    class Protocol<1> : 
        public ProtocolBase<SF::IBinaryStream, SF::OBinaryStream> 
    {
    public:
        static std::string getName()
        {
            return "SF portable binary protocol";
        }
    };

    template<> 
    class Protocol<2> : 
        public ProtocolBase<SF::ITextStream, SF::OTextStream> 
    {
    public:
        static std::string getName()
        {
            return "SF text protocol";
        }
    };



    // these protocols use placement new to allocate the serialization objects, but
    // it seems to make no performance difference at all...
    template<> 
    class Protocol<5> : 
        public ProtocolBaseWithPlacementNew<SF::IBinaryStream, SF::OBinaryStream> 
    {
    public:
        static std::string getName()
        {
            return "SF portable binary protocol, with placement new";
        }
    };

    template<> 
    class Protocol<6> : 
        public ProtocolBaseWithPlacementNew<SF::ITextStream, SF::OTextStream> 
    {
    public:
        static std::string getName()
        {
            return "SF text protocol, with placement new";
        }
    };

} // namespace RCF



#endif //! _RCF_PROTOCOL_SF_HPP

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Australia Australia
Software developer, from Sweden and now living in Canberra, Australia, working on distributed C++ applications. When he is not programming, Jarl enjoys skiing and playing table tennis. He derives immense satisfaction from referring to himself in third person.

Comments and Discussions