Line Code
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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82
#ifndef GENERS_IOISEXTERNAL_HH_
#define GENERS_IOISEXTERNAL_HH_

namespace gs {
  template <class T>
  struct IOIsExternal {
    enum { value = 0 };
  };
}  // namespace gs

// Use the following macro (outside of any namespace)
// to declare some type as external for I/O purposes
//
#define gs_declare_type_external(T) /**/    \
  namespace gs {                            \
    template <>                             \
    struct IOIsExternal<T> {                \
      enum { value = 1 };                   \
    };                                      \
    template <>                             \
    struct IOIsExternal<T const> {          \
      enum { value = 1 };                   \
    };                                      \
    template <>                             \
    struct IOIsExternal<T volatile> {       \
      enum { value = 1 };                   \
    };                                      \
    template <>                             \
    struct IOIsExternal<T const volatile> { \
      enum { value = 1 };                   \
    };                                      \
  }

// Use the following macro (outside of any namespace)
// to declare some template parameterized by one argument
// as external for I/O purposes
//
#define gs_declare_template_external_T(name) /**/ \
  namespace gs {                                  \
    template <class T>                            \
    struct IOIsExternal<name<T>> {                \
      enum { value = 1 };                         \
    };                                            \
    template <class T>                            \
    struct IOIsExternal<const name<T>> {          \
      enum { value = 1 };                         \
    };                                            \
    template <class T>                            \
    struct IOIsExternal<volatile name<T>> {       \
      enum { value = 1 };                         \
    };                                            \
    template <class T>                            \
    struct IOIsExternal<const volatile name<T>> { \
      enum { value = 1 };                         \
    };                                            \
  }

// Use the following macro (outside of any namespace)
// to declare some template parameterized by two arguments
// as external for I/O purposes
//
#define gs_declare_template_external_TT(name) /**/   \
  namespace gs {                                     \
    template <class T, class U>                      \
    struct IOIsExternal<name<T, U>> {                \
      enum { value = 1 };                            \
    };                                               \
    template <class T, class U>                      \
    struct IOIsExternal<const name<T, U>> {          \
      enum { value = 1 };                            \
    };                                               \
    template <class T, class U>                      \
    struct IOIsExternal<volatile name<T, U>> {       \
      enum { value = 1 };                            \
    };                                               \
    template <class T, class U>                      \
    struct IOIsExternal<const volatile name<T, U>> { \
      enum { value = 1 };                            \
    };                                               \
  }

#endif  // GENERS_IOISEXTERNAL_HH_