GraphLab: Distributed Graph-Parallel API
2.1
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
op_plus_eq_concept.hpp
1
/**
2
* Copyright (c) 2009 Carnegie Mellon University.
3
* All rights reserved.
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing,
12
* software distributed under the License is distributed on an "AS
13
* IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
14
* express or implied. See the License for the specific language
15
* governing permissions and limitations under the License.
16
*
17
* For more about this software visit:
18
*
19
* http://www.graphlab.ml.cmu.edu
20
*
21
*/
22
23
24
#ifndef GRAPHLAB_OP_PLUS_EQ_CONCEPT
25
#define GRAPHLAB_OP_PLUS_EQ_CONCEPT
26
27
#include <boost/concept/assert.hpp>
28
#include <boost/concept/requires.hpp>
29
#include <boost/concept_check.hpp>
30
#include <sstream>
31
#include <graphlab/serialization/serialize.hpp>
32
33
34
namespace
graphlab {
35
36
/**
37
* \brief Concept checks if a type T supports operator+=
38
*
39
* This is a concept checking class for boost::concept and can be
40
* used to enforce that a type T is "additive." In particular many
41
* types in GraphLab (e.g., messages, gather_type, as well as
42
* aggregation types) must support operator+=. To achieve this the
43
* class should implement:
44
*
45
* \code
46
* class gather_type {
47
* int member1;
48
* public:
49
* gather_type& operator+=(const gather_type& other) {
50
* member1 += other.member1;
51
* return *this;
52
* } // end of operator+=
53
* };
54
* \endcode
55
*
56
* \tparam T The type to test for additivity
57
*/
58
template
<
typename
T>
59
class
OpPlusEq
: boost::Assignable<T>,
public
boost::DefaultConstructible<T> {
60
public
:
61
BOOST_CONCEPT_USAGE(
OpPlusEq
) {
62
T t1 = T();
63
const
T t2 = T();
64
// A compiler error on these lines implies that your type does
65
// not support operator+= when this is required (e.g.,
66
// gather_type or aggregator types)
67
t1 += t2;
68
}
69
};
70
}
// namespace graphlab
71
#endif
72
graphlab
vertex_program
op_plus_eq_concept.hpp
Generated on Mon Jun 3 2013 05:00:05 for GraphLab: Distributed Graph-Parallel API by
1.8.1.1