Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
2ddbad1d
Commit
2ddbad1d
authored
18 years ago
by
Arthur Coolen
Browse files
Options
Downloads
Patches
Plain Diff
BugID: 703
Added Common that holds common methods for ParmFacade
parent
c5302681
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
JAVA/CEP/jParmFacade/src/nl_astron_lofar_java_cep_jparmfacade_jParmFacade.cc
+35
-21
35 additions, 21 deletions
...e/src/nl_astron_lofar_java_cep_jparmfacade_jParmFacade.cc
with
35 additions
and
21 deletions
JAVA/CEP/jParmFacade/src/nl_astron_lofar_java_cep_jparmfacade_jParmFacade.cc
+
35
−
21
View file @
2ddbad1d
...
...
@@ -25,6 +25,7 @@
#include
<jni.h>
#include
<jParmFacade/nl_astron_lofar_java_cep_jparmfacade_jParmFacade.h>
#include
<jParmFacade/nl_astron_lofar_java_cep_jparmfacade_jCommon.h>
#include
<ParmFacade/ParmFacade.h>
#include
<iostream>
#include
<string>
...
...
@@ -34,35 +35,20 @@ using namespace std;
ParmFacade
*
theirPF
;
/*
* Class: nl_astron_lofar_java_cep_jparmfacade_jParmFacade
* Method: initParmFacade
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT
void
JNICALL
Java_nl_astron_lofar_java_cep_jparmfacade_jParmFacade_initParmFacade
(
JNIEnv
*
env
,
jobject
,
jstring
tableName
)
{
const
char
*
tablename
=
env
->
GetStringUTFChars
(
tableName
,
0
);
const
string
t
(
tablename
);
try
{
theirPF
=
new
ParmFacade
(
t
);
}
catch
(
exception
&
ex
)
{
cout
<<
"Exception during new ParmFacade("
<<
t
<<
") : "
<<
ex
.
what
()
<<
endl
;
env
->
ThrowNew
(
env
->
FindClass
(
"java/lang/Exception"
),
ex
.
what
());
}
env
->
ReleaseStringUTFChars
(
tableName
,
tablename
);
}
/*
* Class: nl_astron_lofar_java_cep_jparmfacade_jParmFacade
* Method: getRange
* Signature: (Ljava/lang/String;)Ljava/util/Vector;
*/
JNIEXPORT
jobject
JNICALL
Java_nl_astron_lofar_java_cep_jparmfacade_jParmFacade_getRange
(
JNIEnv
*
env
,
jobject
,
jstring
parmNamePattern
)
{
JNIEXPORT
jobject
JNICALL
Java_nl_astron_lofar_java_cep_jparmfacade_jParmFacade_getRange
(
JNIEnv
*
env
,
jobject
obj
,
jstring
parmNamePattern
)
{
jboolean
isCopy
;
jobject
rangeVector
;
// create the connection with the ParmDB
setParmDBConnection
(
env
,
obj
);
const
char
*
pattern
=
env
->
GetStringUTFChars
(
parmNamePattern
,
&
isCopy
);
vector
<
double
>
rangeList
;
try
{
...
...
@@ -104,11 +90,14 @@ JNIEXPORT jobject JNICALL Java_nl_astron_lofar_java_cep_jparmfacade_jParmFacade_
* Method: getNames
* Signature: (Ljava/lang/String;)Ljava/util/Vector;
*/
JNIEXPORT
jobject
JNICALL
Java_nl_astron_lofar_java_cep_jparmfacade_jParmFacade_getNames
(
JNIEnv
*
env
,
jobject
,
jstring
parmNamePattern
)
{
JNIEXPORT
jobject
JNICALL
Java_nl_astron_lofar_java_cep_jparmfacade_jParmFacade_getNames
(
JNIEnv
*
env
,
jobject
obj
,
jstring
parmNamePattern
)
{
jboolean
isCopy
;
jobject
nameVector
;
// create the connection with the ParmDB
setParmDBConnection
(
env
,
obj
);
const
char
*
pattern
=
env
->
GetStringUTFChars
(
parmNamePattern
,
&
isCopy
);
vector
<
string
>
nameList
;
try
{
...
...
@@ -145,11 +134,15 @@ JNIEXPORT jobject JNICALL Java_nl_astron_lofar_java_cep_jparmfacade_jParmFacade_
* Method: getValues
* Signature: (Ljava/lang/String;DDIDDI)Ljava/util/HashMap;
*/
JNIEXPORT
jobject
JNICALL
Java_nl_astron_lofar_java_cep_jparmfacade_jParmFacade_getValues
(
JNIEnv
*
env
,
jobject
,
jstring
parmNamePattern
,
jdouble
startx
,
jdouble
endx
,
jint
nx
,
jdouble
starty
,
jdouble
endy
,
jint
ny
)
{
JNIEXPORT
jobject
JNICALL
Java_nl_astron_lofar_java_cep_jparmfacade_jParmFacade_getValues
(
JNIEnv
*
env
,
jobject
obj
,
jstring
parmNamePattern
,
jdouble
startx
,
jdouble
endx
,
jint
nx
,
jdouble
starty
,
jdouble
endy
,
jint
ny
)
{
jboolean
isCopy
;
jobject
result
;
// create the connection with the ParmDB
setParmDBConnection
(
env
,
obj
);
const
char
*
pattern
=
env
->
GetStringUTFChars
(
parmNamePattern
,
&
isCopy
);
map
<
string
,
vector
<
double
>
>
valMap
;
try
{
...
...
@@ -209,9 +202,30 @@ JNIEXPORT jobject JNICALL Java_nl_astron_lofar_java_cep_jparmfacade_jParmFacade_
// env->ReleaseStringUTFChars (parmNamePattern, pattern);
return
result
;
}
env
->
ThrowNew
(
newExcCls
,
aStr
.
c_str
());
}
return
result
;
}
void
setParmDBConnection
(
JNIEnv
*
env
,
jobject
callerObject
)
{
// get the callerclass
jclass
jPF
=
env
->
GetObjectClass
(
callerObject
);
// get the methodID
jfieldID
id_PFID
=
env
->
GetFieldID
(
jPF
,
"itsParmFacadeDB"
,
"Ljava/lang/String;"
);
// get the value
jstring
nstr
=
(
jstring
)
env
->
GetObjectField
(
callerObject
,
id_PFID
);
const
char
*
n
=
env
->
GetStringUTFChars
(
nstr
,
0
);
const
string
name
(
n
);
// create the connection with the c++ ParmFacade
cout
<<
"Connect to :"
<<
name
<<
endl
;
theirPF
=
new
ParmFacade
(
name
);
env
->
ReleaseStringUTFChars
(
nstr
,
n
);
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment