summaryrefslogtreecommitdiff
path: root/cpp/include/Ice/Traits.h
blob: e81cffdeaa11d3c66ea389e33db727b50fdee802 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#ifndef ICE_TRAITS_H
#define ICE_TRAITS_H

#ifdef ICE_CPP11_MAPPING

#include <type_traits>

namespace Ice
{

class ObjectPrx;
class Value;

template<class T> using IsProxy = ::std::is_base_of<::Ice::ObjectPrx, T>;
template<class T> using IsValue = ::std::is_base_of<::Ice::Value, T>;

enum class Kind { Value, Proxy };

template<typename T>
struct TypeTraits
{
    constexpr static bool isKind(Kind kind)
    {
        switch(kind)
        {
            case Kind::Value:
            {
                return std::is_base_of<Value, T>::value;
            }
            case Kind::Proxy:
            {
                return std::is_base_of<ObjectPrx, T>::value;
            }
            default:
            {
                return false;
            }
        }
    }
};

}
#endif

#endif