GraphLab: Distributed Graph-Parallel API  2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
distributed_identity_ingress.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_DISTRIBUTED_IDENTITY_INGRESS_HPP
24 #define GRAPHLAB_DISTRIBUTED_IDENTITY_INGRESS_HPP
25 
26 #include <boost/functional/hash.hpp>
27 
28 #include <graphlab/rpc/buffered_exchange.hpp>
29 #include <graphlab/graph/graph_basic_types.hpp>
30 #include <graphlab/graph/ingress/idistributed_ingress.hpp>
31 #include <graphlab/graph/ingress/distributed_ingress_base.hpp>
32 #include <graphlab/graph/distributed_graph.hpp>
33 
34 
35 #include <graphlab/macros_def.hpp>
36 namespace graphlab {
37  template<typename VertexData, typename EdgeData>
38  class distributed_graph;
39 
40  /**
41  * \brief Ingress object assigning edges to the loading machine itself.
42  */
43  template<typename VertexData, typename EdgeData>
45  public distributed_ingress_base<VertexData, EdgeData> {
46  public:
48  /// The type of the vertex data stored in the graph
49  typedef VertexData vertex_data_type;
50  /// The type of the edge data stored in the graph
51  typedef EdgeData edge_data_type;
52 
53  typedef distributed_ingress_base<VertexData, EdgeData> base_type;
54 
55  public:
57  base_type(dc, graph) {
58  } // end of constructor
59 
61 
62  /** Add an edge to the ingress object and assign the edge to itself. */
63  void add_edge(vertex_id_type source, vertex_id_type target,
64  const EdgeData& edata) {
66  const procid_t owning_proc = base_type::rpc.procid();
67  const edge_buffer_record record(source, target, edata);
68  base_type::edge_exchange.send(owning_proc, record);
69  } // end of add edge
70  }; // end of distributed_identity_ingress
71 }; // end of namespace graphlab
72 #include <graphlab/macros_undef.hpp>
73 
74 
75 #endif