GraphLab: Distributed Graph-Parallel API  2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
messages.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 #ifndef GRAPHLAB_MESSAGES_HPP
24 #define GRAPHLAB_MESSAGES_HPP
25 
26 #include <graphlab/serialization/serialization_includes.hpp>
27 
28 namespace graphlab {
29 
30  namespace messages {
31 
32  /**
33  * The priority of two messages is the sum
34  */
36  double value;
37  sum_priority(const double value = 0) : value(value) { }
38  double priority() const { return value; }
39  sum_priority& operator+=(const sum_priority& other) {
40  value += other.value;
41  return *this;
42  }
43  }; // end of sum_priority message
44 
45  /**
46  * The priority of two messages is the max
47  */
49  double value;
50  max_priority(const double value = 0) : value(value) { }
51  double priority() const { return value; }
52  max_priority& operator+=(const max_priority& other) {
53  value = std::max(value, other.value);
54  return *this;
55  }
56  }; // end of max_priority message
57 
58 
59  }; // end of messages namespace
60 
61 
62 }; // end of graphlab namespace
63 #endif