Skip to content

Commit af3a6bd

Browse files
author
Yucheng Low
committed
Made explicit destructors for a bunch of interface / proxy objects.
1 parent 4b0fb0a commit af3a6bd

12 files changed

+56
-9
lines changed

oss_src/cppipc/common/object_factory.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@
55
* This software may be modified and distributed under the terms
66
* of the BSD license. See the LICENSE file for details.
77
*/
8+
#include <cppipc/ipc_object_base.hpp>
9+
namespace cppipc {
10+
ipc_object_base::~ipc_object_base() { }
11+
}

oss_src/cppipc/ipc_object_base.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
*/
1616
namespace cppipc {
1717

18-
class EXPORT ipc_object_base: public std::enable_shared_from_this<ipc_object_base> { };
18+
class EXPORT ipc_object_base: public std::enable_shared_from_this<ipc_object_base> {
19+
public:
20+
virtual ~ipc_object_base();
21+
};
1922

2023
} // cppipc
2124

oss_src/cppipc/magic_macros.hpp

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,19 @@
107107
* };
108108
* \endcode
109109
*/
110+
#define GENERATE_INTERFACE_NO_INLINE_DESTRUCTOR(base_name, proxy_name, functions) \
111+
class base_name : public cppipc::ipc_object_base { \
112+
public: \
113+
typedef proxy_name proxy_object_type; \
114+
virtual ~base_name(); \
115+
inline virtual void save(graphlab::oarchive& oarc) const {} \
116+
inline virtual void load(graphlab::iarchive& iarc) {} \
117+
BOOST_PP_SEQ_FOR_EACH(__GENERATE_BASE__, _, __ADD_PARENS__(functions)) \
118+
REGISTRATION_BEGIN(base_name) \
119+
BOOST_PP_SEQ_FOR_EACH(__GENERATE_REGISTRATION__, base_name, __ADD_PARENS__(functions)) \
120+
REGISTRATION_END \
121+
};
122+
110123
#define GENERATE_INTERFACE(base_name, proxy_name, functions) \
111124
class base_name : public cppipc::ipc_object_base { \
112125
public: \
@@ -120,6 +133,8 @@
120133
REGISTRATION_END \
121134
};
122135

136+
#define GENERATE_BASE_DESTRUCTOR(base_name) \
137+
base_name::~base_name() { }
123138

124139

125140

@@ -292,13 +307,20 @@
292307
class proxy_name; \
293308
GENERATE_INTERFACE(base_name, proxy_name, functions)
294309

310+
#define GENERATE_INTERFACE_AND_PROXY_NO_INLINE_DESTRUCTOR(base_name, proxy_name, functions) \
311+
class proxy_name; \
312+
GENERATE_INTERFACE_NO_INLINE_DESTRUCTOR(base_name, proxy_name, functions)
295313
#else
296314

297315
#define GENERATE_INTERFACE_AND_PROXY(base_name, proxy_name, functions) \
298316
class proxy_name; \
299317
GENERATE_INTERFACE(base_name, proxy_name, functions) \
300-
GENERATE_PROXY(base_name, proxy_name, functions)
318+
GENERATE_PROXY(base_name, proxy_name, functions)
301319

320+
#define GENERATE_INTERFACE_AND_PROXY_NO_INLINE_DESTRUCTOR(base_name, proxy_name, functions) \
321+
class proxy_name; \
322+
GENERATE_INTERFACE_NO_INLINE_DESTRUCTOR(base_name, proxy_name, functions) \
323+
GENERATE_PROXY(base_name, proxy_name, functions)
302324
#endif
303325

304326
#endif

oss_src/unity/lib/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ project(unity)
33
make_library(unity_core
44
SOURCES
55
api/function_closure_info.cpp
6+
api/destructor_impl.cpp
67
variant_converter.cpp
78
variant.cpp
89
unity_global.cpp
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#include "unity_global_interface.hpp"
2+
#include "unity_graph_interface.hpp"
3+
#include "unity_sarray_builder_interface.hpp"
4+
#include "unity_sarray_interface.hpp"
5+
#include "unity_sframe_builder_interface.hpp"
6+
#include "unity_sframe_interface.hpp"
7+
#include "unity_sketch_interface.hpp"
8+
9+
namespace graphlab {
10+
GENERATE_BASE_DESTRUCTOR(unity_global_base)
11+
GENERATE_BASE_DESTRUCTOR(unity_sgraph_base)
12+
GENERATE_BASE_DESTRUCTOR(unity_sarray_builder_base)
13+
GENERATE_BASE_DESTRUCTOR(unity_sarray_base)
14+
GENERATE_BASE_DESTRUCTOR(unity_sframe_builder_base)
15+
GENERATE_BASE_DESTRUCTOR(unity_sframe_base)
16+
GENERATE_BASE_DESTRUCTOR(unity_sketch_base)
17+
}

oss_src/unity/lib/api/unity_global_interface.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class unity_global_base {
4848

4949
typedef std::map<std::string, flexible_type> global_configuration_type;
5050

51-
GENERATE_INTERFACE_AND_PROXY(unity_global_base, unity_global_proxy,
51+
GENERATE_INTERFACE_AND_PROXY_NO_INLINE_DESTRUCTOR(unity_global_base, unity_global_proxy,
5252
(std::vector<std::string>, list_toolkit_functions, )
5353
(std::vector<std::string>, list_toolkit_classes, )
5454
(global_configuration_type, describe_toolkit_function, (std::string))

oss_src/unity/lib/api/unity_graph_interface.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class unity_sgraph_base {
5252

5353
#endif
5454

55-
GENERATE_INTERFACE_AND_PROXY(unity_sgraph_base, unity_graph_proxy,
55+
GENERATE_INTERFACE_AND_PROXY_NO_INLINE_DESTRUCTOR(unity_sgraph_base, unity_graph_proxy,
5656
(options_map_t, summary, )
5757
(std::vector<std::string>, get_vertex_fields, (size_t))
5858
(std::vector<std::string>, get_edge_fields, (size_t)(size_t))

oss_src/unity/lib/api/unity_sarray_builder_interface.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace graphlab {
1515

1616
class unity_sarray_base;
1717

18-
GENERATE_INTERFACE_AND_PROXY(unity_sarray_builder_base, unity_sarray_builder_proxy,
18+
GENERATE_INTERFACE_AND_PROXY_NO_INLINE_DESTRUCTOR(unity_sarray_builder_base, unity_sarray_builder_proxy,
1919
(void, init, (size_t)(size_t)(flex_type_enum))
2020
(void, append, (const flexible_type&)(size_t))
2121
(void, append_multiple, (const std::vector<flexible_type>&)(size_t))

oss_src/unity/lib/api/unity_sarray_interface.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace graphlab {
1919
class unity_sframe_base;
2020
typedef std::map<std::string, flexible_type> func_options_map;
2121

22-
GENERATE_INTERFACE_AND_PROXY(unity_sarray_base, unity_sarray_proxy,
22+
GENERATE_INTERFACE_AND_PROXY_NO_INLINE_DESTRUCTOR(unity_sarray_base, unity_sarray_proxy,
2323
(void, construct_from_vector, (const std::vector<flexible_type>&)(flex_type_enum))
2424
(void, construct_from_const, (const flexible_type&)(size_t)(flex_type_enum))
2525
(void, construct_from_sarray_index, (std::string))

oss_src/unity/lib/api/unity_sframe_builder_interface.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace graphlab {
99

1010
class unity_sframe_base;
1111

12-
GENERATE_INTERFACE_AND_PROXY(unity_sframe_builder_base, unity_sframe_builder_proxy,
12+
GENERATE_INTERFACE_AND_PROXY_NO_INLINE_DESTRUCTOR(unity_sframe_builder_base, unity_sframe_builder_proxy,
1313
(void, init, (size_t)(size_t)(std::vector<std::string>)(std::vector<flex_type_enum>)(std::string))
1414
(void, append, (const std::vector<flexible_type>&)(size_t))
1515
(void, append_multiple, (const std::vector<std::vector<flexible_type>>&)(size_t))

0 commit comments

Comments
 (0)