Thrill  0.1
max.hpp
Go to the documentation of this file.
1 /*******************************************************************************
2  * thrill/api/max.hpp
3  *
4  * Part of Project Thrill - http://project-thrill.org
5  *
6  * Copyright (C) 2016 Timo Bingmann <[email protected]>
7  *
8  * All rights reserved. Published under the BSD-2 license in the LICENSE file.
9  ******************************************************************************/
10 
11 #pragma once
12 #ifndef THRILL_API_MAX_HEADER
13 #define THRILL_API_MAX_HEADER
14 
17 
18 namespace thrill {
19 namespace api {
20 
21 template <typename ValueType, typename Stack>
23  assert(IsValid());
24 
26  auto node = tlx::make_counting<MaxNode>(*this, "Max");
27  node->RunScope();
28  return node->result();
29 }
30 
31 template <typename ValueType, typename Stack>
32 ValueType DIA<ValueType, Stack>::Max(const ValueType& initial_value) const {
33  assert(IsValid());
34 
36  auto node = tlx::make_counting<MaxNode>(
37  *this, "Max", initial_value, /* with_initial_value */ true);
38  node->RunScope();
39  return node->result();
40 }
41 
42 template <typename ValueType, typename Stack>
44  assert(IsValid());
45 
47  auto node = tlx::make_counting<MaxNode>(*this, "Max");
48  return Future<ValueType>(node);
49 }
50 
51 template <typename ValueType, typename Stack>
53  const ValueType& initial_value) const {
54  assert(IsValid());
55 
57  auto node = tlx::make_counting<MaxNode>(
58  *this, "Max", initial_value, /* with_initial_value */ true);
59  return Future<ValueType>(node);
60 }
61 
62 } // namespace api
63 } // namespace thrill
64 
65 #endif // !THRILL_API_MAX_HEADER
66 
67 /******************************************************************************/
ValueType Max() const
Max is an Action, which computes the maximum of all elements globally.
Definition: max.hpp:22
Future< ValueType > MaxFuture() const
Max is an ActionFuture, which computes the maximum of all elements globally.
Definition: max.hpp:43
The return type class for all ActionFutures.
Definition: action_node.hpp:83