TypeTraits.h File Reference

Galois type traits -*- C++ -*-. More...

#include "Galois/Runtime/ll/CompilerSpecific.h"
#include <boost/mpl/has_xxx.hpp>

Go to the source code of this file.

Classes

struct  Galois::has_deterministic_parallel_break< T >
 Indicates the operator has a member function that allows a Galois::for_each loop to be exited deterministically. More...
struct  Galois::has_deterministic_id< T >
 Indicates the operator has a member function that optimizes the generation of unique ids for active elements. More...
struct  Galois::has_deterministic_local_state< T >
 Indicates the operator has a member type that encapsulates state that is passed between the suspension and resumpsion of an operator during deterministic scheduling. More...
struct  Galois::needs_parallel_break< T >
 Indicates the operator may request the parallel loop to be suspended and a given function run in serial. More...
struct  Galois::does_not_need_push< T >
 Indicates the operator does not generate new work and push it on the worklist. More...
struct  Galois::needs_per_iter_alloc< T >
 Indicates the operator may request the access to a per-iteration allocator. More...
struct  Galois::does_not_need_stats< T >
 Indicates the operator doesn't need its execution stats recorded. More...
struct  Galois::does_not_need_aborts< T >
 Indicates the operator doesn't need abort support. More...
struct  Galois::has_fixed_neighborhood< T >
 Indicates that the neighborhood set does not change through out i.e. More...
struct  Galois::has_known_trivial_constructor< T >
 Temporary type trait for pre-C++11 compilers, which don't support exact std::is_trivially_constructible. More...

Namespaces

namespace  Galois
 

Main Galois namespace.


Defines

#define GALOIS_HAS_MEM_FUNC(func, name)
#define GALOIS_HAS_MEM_FUNC_ANY(func, name)
#define GALOIS_HAS_MEM_TYPE(func, name)

Functions

 Galois::GALOIS_HAS_MEM_FUNC (galoisDeterministicParallelBreak, tf_deterministic_parallel_break)
 Galois::GALOIS_HAS_MEM_FUNC_ANY (galoisDeterministicId, tf_deterministic_id)
 Galois::GALOIS_HAS_MEM_TYPE (GaloisDeterministicLocalState, tf_deterministic_local_state)

Detailed Description

Galois type traits -*- C++ -*-.

License

Galois, a framework to exploit amorphous data-parallelism in irregular programs.

Copyright (C) 2013, The University of Texas at Austin. All rights reserved. UNIVERSITY EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES CONCERNING THIS SOFTWARE AND DOCUMENTATION, INCLUDING ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR ANY PARTICULAR PURPOSE, NON-INFRINGEMENT AND WARRANTIES OF PERFORMANCE, AND ANY WARRANTY THAT MIGHT OTHERWISE ARISE FROM COURSE OF DEALING OR USAGE OF TRADE. NO WARRANTY IS EITHER EXPRESS OR IMPLIED WITH RESPECT TO THE USE OF THE SOFTWARE OR DOCUMENTATION. Under no circumstances shall University be liable for incidental, special, indirect, direct or consequential damages or loss of profits, interruption of business, or related expenses which may arise from use of Software or Documentation, including but not limited to those resulting from defects in Software and/or Documentation, or loss or inaccuracy of data of any kind.

Description

There are two ways to declare a typetrait. First, with a typedef or other valid name declaration:

 struct MyClass {
   typedef int tt_needs_parallel_break;
   ....
 };

The second way is by specializing a function:

 namespace Galois {
   template<>
   struct needs_parallel_break<MyClass> : public boost::true_type {};
 }

Since the compiler doesn't check the names of these traits, a good programming practice is to add a static_assert to check if everything is ok:

 struct MyClass {
   typedef int tt_needs_parallel_break;
   static_assert(Galois::needs_parallel_break<MyClass>::value, "Oops!");
   ...
 };
Author:
Andrew Lenharth <andrewl@lenharth.org>

Define Documentation

#define GALOIS_HAS_MEM_FUNC ( func,
name   ) 
Value:
template<typename T, typename Sig> \
  struct has_##name { \
    typedef char yes[1]; \
    typedef char no[2]; \
    template<typename U, U> struct type_check; \
    template<typename W> static yes& test(type_check<Sig, &W::func>*); \
    template<typename  > static no&  test(...); \
    static const bool value = sizeof(test<T>(0)) == sizeof(yes); \
  }
#define GALOIS_HAS_MEM_FUNC_ANY ( func,
name   ) 
Value:
template<typename T> \
  struct has_##name { \
    typedef char yes[1]; \
    typedef char no[2]; \
    template<typename U, U> struct type_check; \
    template<typename W> static yes& test(type_check<decltype(&W::func), &W::func>*); \
    template<typename  > static no&  test(...); \
    static const bool value = sizeof(test<T>(0)) == sizeof(yes); \
  }
#define GALOIS_HAS_MEM_TYPE ( func,
name   ) 
Value:
template<typename T> \
  struct has_##name { \
    typedef char yes[1]; \
    typedef char no[2]; \
    template<typename W> static yes& test(typename W::func*); \
    template<typename  > static no&  test(...); \
    static const bool value = sizeof(test<T>(0)) == sizeof(yes); \
  }

Generated on 2 Nov 2013 for Galois by  doxygen 1.6.1