GraphLab: Distributed Graph-Parallel API  2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
org_graphlab_Aggregator.hpp
Go to the documentation of this file.
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  * @file org_graphlab_Aggregator.hpp
25  * @author Jiunn Haur Lim <[email protected]>
26  */
27 
28 #ifndef ORG_GRAPHLAB_AGGREGATOR_HPP
29 #define ORG_GRAPHLAB_AGGREGATOR_HPP
30 
31 #include <graphlab.hpp>
32 #include "java_any.hpp"
33 #include "org_graphlab_Core.hpp"
34 #include "org_graphlab_Updater.hpp"
35 
36 #include "org_graphlab_Aggregator.h"
37 
38 namespace graphlab {
39 
40  /**
41  * Proxy aggregator.
42  * Mirrors and forwards calls to the corresponding Java aggregator.
43  * The constructor creates a new reference to the Java object (so that it
44  * doesn't get garbage collected.) The destructor will delete the reference
45  * to allow the corresponding Java object to be garbaged collected. The copy
46  * constructor clones the Java object.
47  */
49  public iaggregator<proxy_graph, proxy_updater, proxy_aggregator>,
50  public java_any {
51 
52  private:
53 
54  typedef proxy_updater::core core;
55 
56  public:
57 
58  /**
59  * Method ID of org.graphlab.Aggregator#exec.
60  */
61  static jmethodID java_exec;
62 
63  /**
64  * Method ID of org.graphlab.Aggregator#add.
65  */
66  static jmethodID java_add;
67 
68  /**
69  * Method ID of org.graphlab.Aggregator#finalize.
70  */
71  static jmethodID java_finalize;
72 
73  /**
74  * Method ID of org.graphlab.Aggregator#clone
75  */
76  static jmethodID java_clone;
77 
78  /**
79  * Constructor for proxy aggregator.
80  * Initializes this object with the associated Java org.graphlab.Updater
81  * object.
82  * @param[in] env JNI environment - used to create a new reference
83  * to javaUpdater.
84  * @param[in] java_aggregator Java org.graphlab.Aggregator object. This constructor
85  * will create a new reference to the object to prevent
86  * garbage collection.
87  */
88  proxy_aggregator(JNIEnv *env, jobject &java_aggregator);
89 
90  /** The default constructor does nothing */
92 
93  /**
94  * Copy constructor for proxy_aggregator.
95  * If \c other has a \c mobj, creates a new reference to it.
96  */
97  proxy_aggregator(const proxy_aggregator& other);
98 
99  /**
100  * Copy assignment operator for proxy_aggregator.
101  * If \c other has a \c mobj, creates a new reference to it.
102  */
104 
105  /**
106  * Deletes the reference to the Java object so that it may be garbage
107  * collected.
108  */
110 
111  void operator()(icontext_type& context);
112 
113  void operator+=(const proxy_aggregator& other);
114 
115  void finalize(iglobal_context& context);
116 
117  };
118 
119 };
120 
121 #endif