1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
/**
* @copyright
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
* @endcopyright
*
* @file SVNBase.h
* @brief Interface of the class SVNBase
*/
#ifndef SVNBASE_H
#define SVNBASE_H
#include <jni.h>
#include "Pool.h"
class SVNBase
{
public:
SVNBase();
virtual ~SVNBase();
/**
* Return @c this as a @c jlong.
*
* @since 1.4.0
*/
jlong getCppAddr() const;
/**
* Deletes this C++ peer object, and clears the memory address of
* the corresponding Java object @a jthis which points to it.
*
* @since 1.4.0
*/
virtual void dispose(jobject jthis) = 0;
/**
* This method should never be called, as @c dispose() should be
* called explicitly. When @c dispose() fails to be called, this
* method assures that this C++ peer object has been enqueued for
* deletion.
*
* @since 1.4.0
*/
void finalize();
protected:
/**
* Return the value of the @c cppAddr instance field from the @a
* jthis Java object, or @c 0 if an error occurs, or the address
* otherwise can't be determined. @a fid is expected to point to
* 0 if not already known, in which case it's looked up using @a
* className.
*
* @since 1.4.0
*/
static jlong findCppAddrForJObject(jobject jthis, jfieldID *fid,
const char *className);
/**
* Deletes @c this, then attempts to null out the @c jthis.cppAddr
* instance field on the corresponding Java object.
*
* @since 1.4.0
*/
void dispose(jobject jthis, jfieldID *fid, const char *className);
/**
* Instantiates java object attached to this base object
*/
jobject createCppBoundObject(const char *clazzName);
private:
/**
* If the value pointed to by @a fid is zero, find the @c jfieldID
* for the @c cppAddr instance field of @c className.
*
* @since 1.4.0
*/
static void findCppAddrFieldID(jfieldID *fid, const char *className,
JNIEnv *env);
protected:
SVN::Pool pool;
};
#endif // SVNBASE_H
|