Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

RMI for C++

, 6 Aug 2009
User-friendly remote method invocation in C++.
rcf.zip
RCF
demo
vs2003
RCF
Client
Server
doc
include
RCF
Connection.inl
Marshal.inl
Multiplexer.inl
RCF.inl
RcfServer.inl
ServerStub.inl
Protocol
util
Platform
Compiler
bcc55
cw80
gcc32
icl70
msvc71
Library
bcc55
cw80
gcc32
msvc60
msvc71
Machine
SPARC
x86
OS
Cygwin
Unix
Windows
System
NonWindows
Windows
Threads
SF
src
RCF
Protocol
util
SF
test
Jamfile
Jamrules
borland
Jamfile
Jamrules
vs2003
RCF
RCF
RCFTest
//*****************************************************************************
// Copyright (c) 2003. All rights reserved.
// Developed by Jarl Lindrud.
// Contact: jlindrud@hotmail.com .
//*****************************************************************************

#ifndef _UTIL_META_HPP_
#define _UTIL_META_HPP_

namespace Meta {

    // Null
    struct Null {};
    
    struct True { enum { Val=true }; char a[1]; };
    struct False { enum { Val=false }; char a[2]; };

    // Boolean operations
    template<bool Cond>
    struct Bool;

    template<>
    struct Bool<true> { typedef True Val; };

    template<>
    struct Bool<false> { typedef False Val; };

    template<int Cond>
    struct ToBool { typedef True Val; };

    template<>
    struct ToBool<0> { typedef False Val; };

    template<typename T>
    struct Not;

    template<>
    struct Not<True> { typedef False Val; };

    template<>
    struct Not<False> { typedef True Val; };

    template<typename T, typename U>
    struct Or;

    template<>
    struct Or<False, False> { typedef False Val; };

    template<>
    struct Or<False, True> { typedef True Val; };

    template<>
    struct Or<True, False> { typedef True Val; };

    template<>
    struct Or<True, True> { typedef True Val; };

    template<typename T, typename U>
    struct And;

    template<>
    struct And<False, False> { typedef False Val; };

    template<>
    struct And<False, True> { typedef False Val; };

    template<>
    struct And<True, False> { typedef False Val; };

    template<>
    struct And<True, True> { typedef True Val; };

    template<typename T>
    struct NonNull { typedef True Val; };

    template<>
    struct NonNull<Meta::Null> { typedef False Val; };

    // Integers
    template<int N>
    struct Int { 
        enum { Val = N }; 
    };

    // Assert
    template<typename T>
    struct Assert;

    template<>
    struct Assert<True> { typedef Meta::Null Val; };

    // Select - type selection based on a Bool condition
    template <typename Cond, typename A, typename B>
    struct Select;

    template <typename A, typename B>
    struct Select<True, A, B> { typedef A Val; };

    template <typename A, typename B>
    struct Select<False, A, B> { typedef B Val; };

} // namespace Meta

#endif // ! _UTIL_META_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)

Share

About the Author

Jarl Lindrud

Australia Australia
Software developer, ex-resident of Sweden and now living in Canberra, Australia, working on distributed C++ applications. Jarl enjoys programming, but prefers skiing and playing table tennis. He derives immense satisfaction from referring to himself in third person.

| Advertise | Privacy | Mobile
Web02 | 2.8.140905.1 | Last Updated 6 Aug 2009
Article Copyright 2005 by Jarl Lindrud
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid