Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
a27529a3
Commit
a27529a3
authored
Mar 22, 2004
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Subscription of arrays
parent
2d8ffd26
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
755 additions
and
447 deletions
+755
-447
java/exe/jpwr_rt_gdh/src/jpwr_rt_gdh.c
java/exe/jpwr_rt_gdh/src/jpwr_rt_gdh.c
+121
-7
java/exe/jpwr_rt_gdh/src/jpwr_rt_gdh.h
java/exe/jpwr_rt_gdh/src/jpwr_rt_gdh.h
+32
-0
java/jpwr/jop/src/GeDynTable.java
java/jpwr/jop/src/GeDynTable.java
+28
-20
java/jpwr/rt/src/Gdh.java
java/jpwr/rt/src/Gdh.java
+8
-1
java/jpwr/rt/src/GdhServer.java
java/jpwr/rt/src/GdhServer.java
+132
-80
java/jpwr/rt/src/GdhrRefObjectInfo.java
java/jpwr/rt/src/GdhrRefObjectInfo.java
+17
-0
java/jpwr/rt/src/Sub.java
java/jpwr/rt/src/Sub.java
+13
-24
java/jpwr/rt/src/SubElement.java
java/jpwr/rt/src/SubElement.java
+4
-1
java/jpwr/rt_client/src/Gdh.java
java/jpwr/rt_client/src/Gdh.java
+99
-94
src/jpwr/jop/src/GeDynTable.java
src/jpwr/jop/src/GeDynTable.java
+28
-20
src/jpwr/rt/src/Gdh.java
src/jpwr/rt/src/Gdh.java
+8
-1
src/jpwr/rt/src/GdhServer.java
src/jpwr/rt/src/GdhServer.java
+132
-80
src/jpwr/rt/src/GdhrRefObjectInfo.java
src/jpwr/rt/src/GdhrRefObjectInfo.java
+17
-0
src/jpwr/rt/src/Sub.java
src/jpwr/rt/src/Sub.java
+13
-24
src/jpwr/rt/src/SubElement.java
src/jpwr/rt/src/SubElement.java
+4
-1
src/jpwr/rt_client/src/Gdh.java
src/jpwr/rt_client/src/Gdh.java
+99
-94
No files found.
java/exe/jpwr_rt_gdh/src/jpwr_rt_gdh.c
View file @
a27529a3
...
...
@@ -250,6 +250,120 @@ JNIEXPORT jstring JNICALL Java_jpwr_rt_Gdh_getObjectRefInfoString
}
}
JNIEXPORT
jfloatArray
JNICALL
Java_jpwr_rt_Gdh_getObjectRefInfoFloatArray
(
JNIEnv
*
env
,
jclass
obj
,
jint
id
,
jint
size
)
{
jfloatArray
jfloatArr
=
(
*
env
)
->
NewFloatArray
(
env
,
size
);
if
(
jfloatArr
==
NULL
||
((
float
*
)
id
==
NULL
)
)
{
//something very weird has happen
return
(
jfloatArray
)
NULL
;
}
(
*
env
)
->
SetFloatArrayRegion
(
env
,
jfloatArr
,
0
,
size
,
(
jfloat
*
)
id
);
return
jfloatArr
;
}
JNIEXPORT
jbooleanArray
JNICALL
Java_jpwr_rt_Gdh_getObjectRefInfoBooleanArray
(
JNIEnv
*
env
,
jclass
obj
,
jint
id
,
jint
size
)
{
jbooleanArray
jbooleanArr
=
(
*
env
)
->
NewBooleanArray
(
env
,
size
);
if
(
jbooleanArr
==
NULL
||
((
pwr_tBoolean
*
)
id
==
NULL
)
)
{
//something very weird has happen
return
(
jbooleanArray
)
NULL
;
}
(
*
env
)
->
SetBooleanArrayRegion
(
env
,
jbooleanArr
,
0
,
size
,
(
jboolean
*
)
id
);
return
jbooleanArr
;
}
JNIEXPORT
jintArray
JNICALL
Java_jpwr_rt_Gdh_getObjectRefInfoIntArray
(
JNIEnv
*
env
,
jclass
obj
,
jint
id
,
jint
size
)
{
jintArray
jintArr
=
(
*
env
)
->
NewIntArray
(
env
,
size
);
if
(
jintArr
==
NULL
||
((
pwr_tInt32
*
)
id
==
NULL
)
)
{
//something very weird has happen
return
(
jintArray
)
NULL
;
}
(
*
env
)
->
SetIntArrayRegion
(
env
,
jintArr
,
0
,
size
,
(
jint
*
)
id
);
return
jintArr
;
}
JNIEXPORT
jobjectArray
JNICALL
Java_jpwr_rt_Gdh_getObjectRefInfoStringArray
(
JNIEnv
*
env
,
jclass
obj
,
jint
id
,
jint
jtypeid
,
jint
size
,
jint
elements
)
{
pwr_tTypeId
typeid
;
jobjectArray
jobjectArr
;
int
i
=
0
;
//find the class for String[]
jclass
strArrCls
=
(
*
env
)
->
FindClass
(
env
,
"java/lang/String"
);
if
(
strArrCls
==
NULL
)
{
return
(
jobjectArray
)
NULL
;
}
//create a new String[]
jobjectArr
=
(
*
env
)
->
NewObjectArray
(
env
,
elements
,
strArrCls
,
NULL
);
printf
(
"size=%d
\n
"
,
size
);
typeid
=
(
pwr_tTypeId
)
jtypeid
;
if
(
typeid
==
0
||
typeid
==
pwr_eType_String
)
{
// String is default
//put the result in an objectarray of Strings
for
(
i
=
0
;
i
<
elements
;
i
++
)
{
(
*
env
)
->
SetObjectArrayElement
(
env
,
jobjectArr
,
i
,
(
*
env
)
->
NewStringUTF
(
env
,
(
char
*
)
id
));
id
+=
size
;
}
}
else
{
char
buffer
[
256
];
int
len
;
/*
switch( typeid) {
case pwr_eType_Objid:
size = sizeof(pwr_tObjid);
break;
case pwr_eType_AttrRef:
size = sizeof(pwr_tAttrRef);
break;
case pwr_eType_Time:
size = sizeof(pwr_tTime);
break;
case pwr_eType_DeltaTime:
size = sizeof(pwr_tDeltaTime);
break;
default:
size = 4;
}
*/
//put the result in an objectarray of Strings
for
(
i
=
0
;
i
<
elements
;
i
++
)
{
gdh_AttrToString
(
typeid
,
(
void
*
)
id
,
buffer
,
sizeof
(
buffer
),
&
len
,
NULL
);
(
*
env
)
->
SetObjectArrayElement
(
env
,
jobjectArr
,
i
,
(
*
env
)
->
NewStringUTF
(
env
,
(
char
*
)
buffer
));
id
+=
size
;
}
}
return
jobjectArr
;
}
JNIEXPORT
jobject
JNICALL
Java_jpwr_rt_Gdh_refObjectInfo
(
JNIEnv
*
env
,
jclass
obj
,
jstring
name
)
...
...
@@ -282,8 +396,8 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_refObjectInfo
if
(
gdhrRefObjectInfo_cid
==
NULL
)
{
gdhrRefObjectInfo_cid
=
(
*
env
)
->
GetMethodID
(
env
,
gdhrRefObjectInfo_id
,
"<init>"
,
"(Ljpwr/rt/PwrtRefId;III)V"
);
//printf("gdhrRefObjectInfo_cid initierad\n");
"<init>"
,
"(Ljpwr/rt/PwrtRefId;III
II
)V"
);
if
(
gdhrRefObjectInfo_cid
==
NULL
)
{
printf
(
"fel vid init av gdhrRefObjectInfo_cid
\n
"
);
...
...
@@ -315,6 +429,7 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_refObjectInfo
{
typeid
=
pwr_eType_Boolean
;
size
=
sizeof
(
pwr_tBoolean
);
elements
=
1
;
}
sts
=
gdh_RefObjectInfo
(
cstr
,
&
attr_p
,
&
subid
,
size
);
...
...
@@ -332,8 +447,11 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_refObjectInfo
id
=
0
;
jsts
=
(
jint
)
sts
;
//we want the size of each element not the hole object
if
(
elements
>
0
)
size
=
size
/
elements
;
return_obj
=
(
*
env
)
->
NewObject
(
env
,
gdhrRefObjectInfo_id
,
gdhrRefObjectInfo_cid
,
refid_obj
,
id
,
jsts
,
(
jint
)
typeid
);
gdhrRefObjectInfo_cid
,
refid_obj
,
id
,
jsts
,
(
jint
)
typeid
,
(
jint
)
elements
,
(
jint
)
size
);
return
return_obj
;
}
...
...
@@ -472,7 +590,6 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_objidToName
{
cdhrString_cid
=
(
*
env
)
->
GetMethodID
(
env
,
cdhrString_id
,
"<init>"
,
"(Ljava/lang/String;I)V"
);
//printf("cdhrString_cid initierad\n");
}
PwrtObjid_id
=
(
*
env
)
->
FindClass
(
env
,
"jpwr/rt/PwrtObjid"
);
...
...
@@ -480,7 +597,6 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_objidToName
{
PwrtObjid_getOix
=
(
*
env
)
->
GetMethodID
(
env
,
PwrtObjid_id
,
"getOix"
,
"()I"
);
PwrtObjid_getVid
=
(
*
env
)
->
GetMethodID
(
env
,
PwrtObjid_id
,
"getVid"
,
"()I"
);
//printf("PwrtObjid_xxx initierad\n");
}
objid
.
oix
=
(
*
env
)
->
CallIntMethod
(
env
,
objid_obj
,
PwrtObjid_getOix
);
...
...
@@ -556,7 +672,6 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getChild
{
cdhrObjid_cid
=
(
*
env
)
->
GetMethodID
(
env
,
cdhrObjid_id
,
"<init>"
,
"(Ljpwr/rt/PwrtObjid;I)V"
);
//printf("cdhrObjid initierad\n");
}
PwrtObjid_id
=
(
*
env
)
->
FindClass
(
env
,
"jpwr/rt/PwrtObjid"
);
...
...
@@ -567,7 +682,6 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_getChild
"<init>"
,
"(II)V"
);
PwrtObjid_getOix
=
(
*
env
)
->
GetMethodID
(
env
,
PwrtObjid_id
,
"getOix"
,
"()I"
);
PwrtObjid_getVid
=
(
*
env
)
->
GetMethodID
(
env
,
PwrtObjid_id
,
"getVid"
,
"()I"
);
//printf("PwrtObjid_xxx initierade\n");
}
objid
.
oix
=
(
*
env
)
->
CallIntMethod
(
env
,
objid_obj
,
PwrtObjid_getOix
);
...
...
java/exe/jpwr_rt_gdh/src/jpwr_rt_gdh.h
View file @
a27529a3
...
...
@@ -140,6 +140,38 @@ JNIEXPORT jint JNICALL Java_jpwr_rt_Gdh_getObjectRefInfoInt
JNIEXPORT
jstring
JNICALL
Java_jpwr_rt_Gdh_getObjectRefInfoString
(
JNIEnv
*
,
jobject
,
jint
,
jint
);
/*
* Class: jpwr_rt_Gdh
* Method: getObjectRefInfoFloatArray
* Signature: (II)[F
*/
JNIEXPORT
jfloatArray
JNICALL
Java_jpwr_rt_Gdh_getObjectRefInfoFloatArray
(
JNIEnv
*
,
jobject
,
jint
,
jint
);
/*
* Class: jpwr_rt_Gdh
* Method: getObjectRefInfoBooleanArray
* Signature: (II)[Z
*/
JNIEXPORT
jbooleanArray
JNICALL
Java_jpwr_rt_Gdh_getObjectRefInfoBooleanArray
(
JNIEnv
*
,
jobject
,
jint
,
jint
);
/*
* Class: jpwr_rt_Gdh
* Method: getObjectRefInfoIntArray
* Signature: (II)[I
*/
JNIEXPORT
jintArray
JNICALL
Java_jpwr_rt_Gdh_getObjectRefInfoIntArray
(
JNIEnv
*
,
jobject
,
jint
,
jint
);
/*
* Class: jpwr_rt_Gdh
* Method: getObjectRefInfoStringArray
* Signature: (IIII)[Ljava/lang/String;
*/
JNIEXPORT
jobjectArray
JNICALL
Java_jpwr_rt_Gdh_getObjectRefInfoStringArray
(
JNIEnv
*
,
jobject
,
jint
,
jint
,
jint
,
jint
);
/*
* Class: jpwr_rt_Gdh
* Method: unrefObjectInfo
...
...
java/jpwr/jop/src/GeDynTable.java
View file @
a27529a3
...
...
@@ -14,6 +14,8 @@ public class GeDynTable extends GeDynElem {
public
boolean
[]
selAttrFound
;
PwrtRefId
[]
subid
;
int
[]
p
;
public
int
[]
elements
;
public
int
[]
size
;
public
int
[]
typeId
;
public
boolean
[][]
oldValueB
;
public
float
[][]
oldValueF
;
...
...
@@ -35,6 +37,8 @@ public class GeDynTable extends GeDynElem {
p
=
new
int
[
columns
];
subid
=
new
PwrtRefId
[
columns
];
typeId
=
new
int
[
columns
];
elements
=
new
int
[
columns
];
size
=
new
int
[
columns
];
attrFound
=
new
boolean
[
columns
];
selAttrFound
=
new
boolean
[
columns
];
oldValueB
=
new
boolean
[
columns
][];
...
...
@@ -57,6 +61,10 @@ public class GeDynTable extends GeDynElem {
p
[
i
]
=
ret
.
id
;
subid
[
i
]
=
ret
.
refid
;
typeId
[
i
]
=
ret
.
typeId
;
elements
[
i
]
=
ret
.
getElements
();
size
[
i
]
=
ret
.
getSize
();
if
(
elements
[
i
]
>
rows
)
elements
[
i
]
=
rows
;
if
(
typeId
[
i
]
==
Pwr
.
eType_Float32
)
{
oldValueF
[
i
]
=
new
float
[
rows
];
}
...
...
@@ -92,26 +100,26 @@ public class GeDynTable extends GeDynElem {
continue
;
if
(
typeId
[
i
]
==
Pwr
.
eType_Float32
)
{
float
value0
=
dyn
.
en
.
gdh
.
getObjectRefInfoFloat
(
p
[
i
]);
for
(
int
j
=
0
;
j
<
1
;
j
++)
{
// Just the first row...
if
(
value0
!=
oldValueF
[
i
][
j
]
||
firstScan
)
{
sb
=
cFormat
[
i
].
format
(
value0
,
sb
);
float
[]
value0
=
dyn
.
en
.
gdh
.
getObjectRefInfoFloatArray
(
p
[
i
],
elements
[
i
]);
for
(
int
j
=
0
;
j
<
value0
.
length
;
j
++)
{
if
(
value0
[
j
]
!=
oldValueF
[
i
][
j
]
||
firstScan
)
{
sb
=
cFormat
[
i
].
format
(
value0
[
j
]
,
sb
);
((
GeTable
)
dyn
.
comp
).
setValueAt
(
new
String
(
sb
),
j
,
i
);
// dyn.repaintNow = true;
oldValueF
[
i
][
j
]
=
value0
;
oldValueF
[
i
][
j
]
=
value0
[
j
]
;
}
}
}
else
if
(
typeId
[
i
]
==
Pwr
.
eType_Boolean
)
{
boolean
value0
=
dyn
.
en
.
gdh
.
getObjectRefInfoBoolean
(
p
[
i
]);
for
(
int
j
=
0
;
j
<
1
;
j
++)
{
// Just the first row...
if
(
value0
!=
oldValueB
[
i
][
j
]
||
firstScan
)
{
if
(
value0
)
boolean
[]
value0
=
dyn
.
en
.
gdh
.
getObjectRefInfoBooleanArray
(
p
[
i
],
elements
[
i
]);
for
(
int
j
=
0
;
j
<
value0
.
length
;
j
++)
{
if
(
value0
[
j
]
!=
oldValueB
[
i
][
j
]
||
firstScan
)
{
if
(
value0
[
j
]
)
((
GeTable
)
dyn
.
comp
).
setValueAt
(
"1"
,
j
,
i
);
else
((
GeTable
)
dyn
.
comp
).
setValueAt
(
"0"
,
j
,
i
);
// dyn.repaintNow = true;
oldValueB
[
i
][
j
]
=
value0
;
oldValueB
[
i
][
j
]
=
value0
[
j
]
;
}
}
}
...
...
@@ -121,26 +129,26 @@ public class GeDynTable extends GeDynElem {
typeId
[
i
]
==
Pwr
.
eType_UInt16
||
typeId
[
i
]
==
Pwr
.
eType_Int8
||
typeId
[
i
]
==
Pwr
.
eType_UInt8
)
{
int
value0
=
dyn
.
en
.
gdh
.
getObjectRefInfoInt
(
p
[
i
]);
for
(
int
j
=
0
;
j
<
1
;
j
++)
{
// Just the first row...
if
(
value0
!=
oldValueI
[
i
][
j
]
||
firstScan
)
{
sb
=
cFormat
[
i
].
format
(
value0
,
sb
);
int
value0
[]
=
dyn
.
en
.
gdh
.
getObjectRefInfoIntArray
(
p
[
i
],
elements
[
i
]);
for
(
int
j
=
0
;
j
<
value0
.
length
;
j
++)
{
if
(
value0
[
j
]
!=
oldValueI
[
i
][
j
]
||
firstScan
)
{
sb
=
cFormat
[
i
].
format
(
value0
[
j
]
,
sb
);
((
GeTable
)
dyn
.
comp
).
setValueAt
(
new
String
(
sb
),
j
,
i
);
// dyn.repaintNow = true;
oldValueI
[
i
][
j
]
=
value0
;
oldValueI
[
i
][
j
]
=
value0
[
j
]
;
}
}
}
else
if
(
typeId
[
i
]
==
Pwr
.
eType_String
||
typeId
[
i
]
==
Pwr
.
eType_Objid
)
{
String
value0
=
dyn
.
en
.
gdh
.
getObjectRefInfoString
(
p
[
i
],
typeId
[
i
]);
for
(
int
j
=
0
;
j
<
1
;
j
++)
{
// Just the first row...
if
(
firstScan
||
value0
.
compareTo
(
oldValueS
[
i
][
j
])
!=
0
)
{
sb
=
cFormat
[
i
].
format
(
value0
,
sb
);
String
[]
value0
=
dyn
.
en
.
gdh
.
getObjectRefInfoStringArray
(
p
[
i
],
typeId
[
i
],
size
[
i
],
elements
[
i
]);
for
(
int
j
=
0
;
j
<
value0
.
length
;
j
++)
{
if
(
firstScan
||
value0
[
j
]
.
compareTo
(
oldValueS
[
i
][
j
])
!=
0
)
{
sb
=
cFormat
[
i
].
format
(
value0
[
j
]
,
sb
);
((
GeTable
)
dyn
.
comp
).
setValueAt
(
new
String
(
sb
),
j
,
i
);
// dyn.repaintNow = true;
oldValueS
[
i
][
j
]
=
value0
;
oldValueS
[
i
][
j
]
=
value0
[
j
]
;
}
}
}
...
...
java/jpwr/rt/src/Gdh.java
View file @
a27529a3
...
...
@@ -252,7 +252,7 @@ public class Gdh {
return
retVec
;
}
public
Vector
unrefObjectInfo_Vector
(
Vector
vec
)
{
{
Vector
retVec
=
new
Vector
();
// for(int i = 0;i < vec.size();i++)
// {
...
...
@@ -274,10 +274,17 @@ public class Gdh {
public
native
CdhrObjid
getObjectInfoObjid
(
String
attributeName
);
public
native
PwrtStatus
toggleObjectInfo
(
String
attributeName
);
public
native
GdhrRefObjectInfo
refObjectInfo
(
String
attributeName
);
public
native
float
getObjectRefInfoFloat
(
int
id
);
public
native
boolean
getObjectRefInfoBoolean
(
int
id
);
public
native
int
getObjectRefInfoInt
(
int
id
);
public
native
String
getObjectRefInfoString
(
int
id
,
int
typeid
);
public
native
float
[]
getObjectRefInfoFloatArray
(
int
id
,
int
elements
);
public
native
boolean
[]
getObjectRefInfoBooleanArray
(
int
id
,
int
elements
);
public
native
int
[]
getObjectRefInfoIntArray
(
int
id
,
int
elements
);
public
native
String
[]
getObjectRefInfoStringArray
(
int
id
,
int
typeid
,
int
size
,
int
elements
);
public
native
PwrtStatus
unrefObjectInfo
(
PwrtRefId
refid
);
public
native
CdhrObjid
nameToObjid
(
String
objectName
);
public
native
CdhrString
objidToName
(
PwrtObjid
objid
,
int
nameType
);
...
...
java/jpwr/rt/src/GdhServer.java
View file @
a27529a3
This diff is collapsed.
Click to expand it.
java/jpwr/rt/src/GdhrRefObjectInfo.java
View file @
a27529a3
...
...
@@ -16,14 +16,31 @@ public class GdhrRefObjectInfo implements Serializable
public
int
sts
;
public
int
typeId
;
public
int
subId
;
public
int
elements
;
public
int
size
;
public
GdhrRefObjectInfo
(
PwrtRefId
refid
,
int
id
,
int
sts
,
int
typeId
)
{
this
.
refid
=
refid
;
this
.
id
=
id
;
this
.
sts
=
sts
;
this
.
typeId
=
typeId
;
//default values in case we have forgotten to use the new constructor
this
.
elements
=
1
;
this
.
size
=
4
;
}
public
GdhrRefObjectInfo
(
PwrtRefId
refid
,
int
id
,
int
sts
,
int
typeId
,
int
elements
,
int
size
)
{
this
.
refid
=
refid
;
this
.
id
=
id
;
this
.
sts
=
sts
;
this
.
typeId
=
typeId
;
this
.
elements
=
elements
;
this
.
size
=
size
;
}
public
boolean
evenSts
()
{
return
(
sts
%
2
==
0
);}
public
boolean
oddSts
()
{
return
(
sts
%
2
==
1
);}
public
int
getSts
()
{
return
sts
;}
public
int
getElements
(){
return
elements
;}
public
int
getSize
(){
return
size
;}
}
java/jpwr/rt/src/Sub.java
View file @
a27529a3
...
...
@@ -14,22 +14,16 @@
public
float
valueFloat
;
public
boolean
valueBoolean
;
public
String
valueString
;
/*
public PwrtRefId refid;
public int id;
public int sts;
public int typeId;
public int subId;
*/
public
int
[]
valueIntArray
;
public
float
[]
valueFloatArray
;
public
boolean
[]
valueBooleanArray
;
public
String
[]
valueStringArray
;
public
Sub
(
String
attrName
,
PwrtRefId
refid
,
int
id
,
int
typeId
,
int
subscriptionsIndex
,
int
valueInt
,
float
valueFloat
,
boolean
valueBoolean
,
String
valueString
)
{
/*
this.refid = refid;
this.id = id;
this.sts = 0;
this.typeId = typeId;
*/
super
(
refid
,
id
,
0
,
typeId
);
this
.
subscriptionsIndex
=
subscriptionsIndex
;
this
.
valueInt
=
valueInt
;
...
...
@@ -69,25 +63,20 @@
public
Sub
(
String
attrName
,
PwrtRefId
refid
,
int
id
,
int
typeId
,
int
subscriptionsIndex
)
public
Sub
(
String
attrName
,
PwrtRefId
refid
,
int
id
,
int
typeId
,
int
subscriptionsIndex
,
int
elements
,
int
size
)
{
/*
this.refid = refid;
this.id = id;
this.sts = sts;
this.typeId = typeId;
*/
super
(
refid
,
id
,
0
,
typeId
);
super
(
refid
,
id
,
0
,
typeId
,
elements
,
size
);
this
.
attrName
=
attrName
;
this
.
subscriptionsIndex
=
subscriptionsIndex
;
}
//public boolean evenSts() { return (sts % 2 == 0);}
//public boolean oddSts() { return (sts % 2 == 1);}
//public int getSts() { return sts;}
int
getIndex
()
{
return
subscriptionsIndex
;
}
}
java/jpwr/rt/src/SubElement.java
View file @
a27529a3
...
...
@@ -11,7 +11,7 @@
{
public
int
[]
reffedByThread
;
public
BitSet
reffedByThreadBitSet
;
Sub
sub
=
new
Sub
(
" "
,
new
PwrtRefId
(
0
,
0
),
0
,
0
,
0
);
Sub
sub
=
new
Sub
(
" "
,
new
PwrtRefId
(
0
,
0
),
0
,
0
,
0
,
0
,
0
);
public
SubElement
(
int
maxConnections
,
int
threadNumber
)
...
...
@@ -40,6 +40,8 @@
this
.
sub
.
id
=
obj
.
id
;
this
.
sub
.
sts
=
obj
.
sts
;
this
.
sub
.
typeId
=
obj
.
typeId
;
this
.
sub
.
size
=
obj
.
size
;
this
.
sub
.
elements
=
obj
.
elements
;
this
.
sub
.
subscriptionsIndex
=
subscriptionsIndex
;
}
...
...
@@ -48,3 +50,4 @@
return
(
this
.
sub
.
attrName
.
equalsIgnoreCase
(((
SubElement
)
o
).
sub
.
attrName
)
&&
(((
SubElement
)
o
).
sub
.
sts
!=
0
));
}
}
java/jpwr/rt_client/src/Gdh.java
View file @
a27529a3
...
...
@@ -52,6 +52,13 @@ public class Gdh
public
final
static
int
GET_PARENT
=
44
;
public
final
static
int
GET_OBJECT_INFO_OBJID
=
45
;
public
final
static
int
GET_OBJECT_REF_INFO_BOOLEAN_ARRAY
=
46
;
public
final
static
int
GET_OBJECT_REF_INFO_FLOAT_ARRAY
=
47
;
public
final
static
int
GET_OBJECT_REF_INFO_INT_ARRAY
=
48
;
public
final
static
int
GET_OBJECT_REF_INFO_STRING_ARRAY
=
49
;
public
final
static
int
__IO_EXCEPTION
=
2000
;
public
final
static
int
__BUSY
=
2002
;
public
final
static
int
__UNREFED
=
0
;
...
...
@@ -367,7 +374,7 @@ public class Gdh
return
new
GdhrRefObjectInfo
(
null
,
0
,
0
,
0
);
}
//qqq
Sub
sub
=
new
Sub
(
attributeName
,
null
,
0
,
typeId
,
subscriptionCount
);
Sub
sub
=
new
Sub
(
attributeName
,
null
,
0
,
typeId
,
subscriptionCount
,
0
,
0
);
subscriptions
.
insertElementAt
(
sub
,
subscriptionCount
);
subscriptionCount
++;
return
new
GdhrRefObjectInfo
(
refid
,
id
,
1
,
typeId
);
...
...
@@ -395,13 +402,15 @@ public class Gdh
PwrtRefId
refid
=
new
PwrtRefId
(
rix
,
nid
);
int
id
=
in
.
readInt
();
int
typeId
=
in
.
readInt
();
Sub
sub
=
new
Sub
(
attributeName
,
refid
,
id
,
typeId
,
subscriptionCount
);
int
size
=
in
.
readInt
();
int
elements
=
in
.
readInt
();
Sub
sub
=
new
Sub
(
attributeName
,
refid
,
id
,
typeId
,
subscriptionCount
,
size
,
elements
);
sub
.
sts
=
1
;
subscriptions
.
insertElementAt
(
sub
,
id
);
subscriptionCount
++;
refid
=
new
PwrtRefId
(
id
,
0
);
subLate
++;
return
new
GdhrRefObjectInfo
(
refid
,
id
,
sts
,
typeId
);
return
new
GdhrRefObjectInfo
(
refid
,
id
,
sts
,
typeId
,
size
,
elements
);
}
catch
(
IOException
e
)
{
...
...
@@ -420,6 +429,7 @@ public class Gdh
int
nid
;
int
id
;
int
typeId
;
PwrtRefId
refid
;
if
(
listSent
)
...
...
@@ -472,6 +482,8 @@ public class Gdh
sub
.
refid
=
new
PwrtRefId
(
rix
,
nid
);
id
=
in
.
readInt
();
typeId
=
in
.
readInt
();
sub
.
size
=
in
.
readInt
();
sub
.
elements
=
in
.
readInt
();
}
locked
=
false
;
notify
();
...
...
@@ -540,8 +552,7 @@ public class Gdh
}
ret
.
id
=
ret
.
refid
.
rix
;
subscriptions
.
add
(
ret
);
//((Sub)retVec.get(i)).refid.rix = ((Sub)retVec.get(i)).id;
//System.out.println("Status " + ((Sub)retVec.get(i)).getSts());
}
subscriptionCount
+=
retVec
.
size
();
...
...
@@ -591,17 +602,24 @@ public class Gdh
//System.out.println("ArrayIndexOutOfBounds getObjectRefInfoFloat");
return
0
F
;
}
/*
try {
out.writeInt( GET_OBJECT_REF_INFO_FLOAT);
out.writeInt( id);
return in.readFloat();
} catch (IOException e) {
return 0F;
}
*/
}
public
float
[]
getObjectRefInfoFloatArray
(
int
id
,
int
elements
)
{
try
{
Sub
sub
=
(
Sub
)
subscriptions
.
elementAt
(
id
);
if
(
sub
.
oddSts
())
{
return
sub
.
valueFloatArray
;
}
return
null
;
}
catch
(
ArrayIndexOutOfBoundsException
e
)
{
//System.out.println("ArrayIndexOutOfBounds getObjectRefInfoFloat");
return
null
;
}
}
public
boolean
getObjectRefInfoBoolean
(
int
id
)
{
...
...
@@ -619,45 +637,61 @@ public class Gdh
//System.out.println("ArrayIndexOutOfBounds getObjectRefInfoBoolean");
return
false
;
}
/*
try {
out.writeInt( GET_OBJECT_REF_INFO_BOOLEAN);
out.writeInt( id);
return in.readBoolean();
} catch (IOException e) {
return false;
}
*/
}
public
int
getObjectRefInfoInt
(
int
id
)
public
boolean
[]
getObjectRefInfoBooleanArray
(
int
id
,
int
elements
)
{
try
{
Sub
sub
=
(
Sub
)
subscriptions
.
elementAt
(
id
);
if
(
sub
.
oddSts
())
Sub
sub
=
(
Sub
)
subscriptions
.
elementAt
(
id
);
if
(
sub
.
oddSts
())
{
return
sub
.
valueBooleanArray
;
}
return
null
;
}
catch
(
ArrayIndexOutOfBoundsException
e
)
{
return
sub
.
valueInt
;
//System.out.println("ArrayIndexOutOfBounds getObjectRefInfoBoolean");
return
null
;
}
return
0
;
}
public
int
getObjectRefInfoInt
(
int
id
)
{
try
{
Sub
sub
=
(
Sub
)
subscriptions
.
elementAt
(
id
);
if
(
sub
.
oddSts
())
{
return
sub
.
valueInt
;
}
return
0
;
}
catch
(
ArrayIndexOutOfBoundsException
e
)
catch
(
ArrayIndexOutOfBoundsException
e
)
{
//System.out.println("ArrayIndexOutOfBounds getObjectRefInfoInt");
return
0
;
}
/*
try {
out.writeInt( GET_OBJECT_REF_INFO_INT);
out.writeInt( id);
return in.readInt();
} catch (IOException e) {
return 0;
}
*/
}
public
int
[]
getObjectRefInfoIntArray
(
int
id
,
int
elements
)
{
try
{
Sub
sub
=
(
Sub
)
subscriptions
.
elementAt
(
id
);
if
(
sub
.
oddSts
())
{
return
sub
.
valueIntArray
;
}
return
null
;
}
catch
(
ArrayIndexOutOfBoundsException
e
)
{
//System.out.println("ArrayIndexOutOfBounds getObjectRefInfoInt");
return
null
;
}
}
public
String
getObjectRefInfoString
(
int
id
,
int
typeid
)
{
...
...
@@ -677,19 +711,31 @@ public class Gdh
//System.out.println("ArrayIndexOutOfBounds getObjectRefInfoString index " + id);
return
" "
;
}
/*
try {
out.writeInt( GET_OBJECT_REF_INFO_STRING);
out.writeInt( id);
out.writeInt( typeid);
return in.readUTF();
} catch (IOException e) {
return "";
}
public
String
[]
getObjectRefInfoStringArray
(
int
id
,
int
typeid
,
int
size
,
int
elements
)
{
try
{
Sub
sub
=
(
Sub
)
subscriptions
.
elementAt
(
id
);
if
(
sub
.
evenSts
()
||
sub
.
valueStringArray
==
null
)
{
if
(
sub
.
evenSts
())
System
.
out
.
println
(
"getObjectRefInfoString substs "
+
sub
.
getSts
()
+
" id "
+
id
);
return
null
;
}
return
sub
.
valueStringArray
;
}
catch
(
ArrayIndexOutOfBoundsException
e
)
{
//System.out.println("ArrayIndexOutOfBounds getObjectRefInfoString index " + id);
return
null
;
}
*/
}
public
synchronized
PwrtStatus
unrefObjectInfo
(
PwrtRefId
refid
)
{
try
...
...
@@ -1231,36 +1277,8 @@ public class Gdh
out
.
writeInt
(
GET_OBJECT_REF_INFO_ALL
);
out
.
flush
();
//Object retArray[] = (Object[])in.readObject();
//Object retArray[] = (Object[])inbuff.readObject();
//Object ret[] = (Object[])retArray[0];
//String sVec[] = (String[])retArray[0];
//boolean bVec[] = (boolean[])retArray[1];
//int iVec[] = (int[])retArray[2];
//float fVec[] = (float[])retArray[3];
/*
int thSubSize = in.readInt();
Object ret[] = (Object[])in.readObject();
*/
//subscriptions.clear();
//subscriptions.setSize(ret.length);
/*
String sVec[] = (String[])in.readObject();
boolean bVec[] = (boolean[])in.readObject();
int iVec[] = (int[])in.readObject();
float fVec[] = (float[])in.readObject();
*/
for
(
int
i
=
0
;
i
<
subscriptions
.
size
();
i
++)
{
//subscriptions.set(i, (jpwr.rt.Sub)ret[i]);
/*
((jpwr.rt.Sub)(subscriptions.get(i))).valueString = sVec[i];
((jpwr.rt.Sub)(subscriptions.get(i))).valueBoolean = bVec[i];
((jpwr.rt.Sub)(subscriptions.get(i))).valueInt = iVec[i];
((jpwr.rt.Sub)(subscriptions.get(i))).valueFloat = fVec[i];
*/
try
{
...
...
@@ -1645,24 +1663,11 @@ public class Gdh
return
0
;
}
/*
private class Sub extends GdhrRefObjectInfo implements Serializable
{
String attrName;
int subscriptionsIndex;
int valueInt;
float valueFloat;
boolean valueBoolean;
String valueString;
}
public Sub(String attrName, PwrtRefId refid, int id, int typeId, int subscriptionsIndex)
{
super(refid, id, 0, typeId);
this.attrName = attrName;
this.subscriptionsIndex = subscriptionsIndex;
}
}
*/
}
src/jpwr/jop/src/GeDynTable.java
View file @
a27529a3
...
...
@@ -14,6 +14,8 @@ public class GeDynTable extends GeDynElem {
public
boolean
[]
selAttrFound
;
PwrtRefId
[]
subid
;
int
[]
p
;
public
int
[]
elements
;
public
int
[]
size
;
public
int
[]
typeId
;
public
boolean
[][]
oldValueB
;
public
float
[][]
oldValueF
;
...
...
@@ -35,6 +37,8 @@ public class GeDynTable extends GeDynElem {
p
=
new
int
[
columns
];
subid
=
new
PwrtRefId
[
columns
];
typeId
=
new
int
[
columns
];
elements
=
new
int
[
columns
];
size
=
new
int
[
columns
];
attrFound
=
new
boolean
[
columns
];
selAttrFound
=
new
boolean
[
columns
];
oldValueB
=
new
boolean
[
columns
][];
...
...
@@ -57,6 +61,10 @@ public class GeDynTable extends GeDynElem {
p
[
i
]
=
ret
.
id
;
subid
[
i
]
=
ret
.
refid
;
typeId
[
i
]
=
ret
.
typeId
;
elements
[
i
]
=
ret
.
getElements
();
size
[
i
]
=
ret
.
getSize
();
if
(
elements
[
i
]
>
rows
)
elements
[
i
]
=
rows
;
if
(
typeId
[
i
]
==
Pwr
.
eType_Float32
)
{
oldValueF
[
i
]
=
new
float
[
rows
];
}
...
...
@@ -92,26 +100,26 @@ public class GeDynTable extends GeDynElem {
continue
;
if
(
typeId
[
i
]
==
Pwr
.
eType_Float32
)
{
float
value0
=
dyn
.
en
.
gdh
.
getObjectRefInfoFloat
(
p
[
i
]);
for
(
int
j
=
0
;
j
<
1
;
j
++)
{
// Just the first row...
if
(
value0
!=
oldValueF
[
i
][
j
]
||
firstScan
)
{
sb
=
cFormat
[
i
].
format
(
value0
,
sb
);
float
[]
value0
=
dyn
.
en
.
gdh
.
getObjectRefInfoFloatArray
(
p
[
i
],
elements
[
i
]);
for
(
int
j
=
0
;
j
<
value0
.
length
;
j
++)
{
if
(
value0
[
j
]
!=
oldValueF
[
i
][
j
]
||
firstScan
)
{
sb
=
cFormat
[
i
].
format
(
value0
[
j
]
,
sb
);
((
GeTable
)
dyn
.
comp
).
setValueAt
(
new
String
(
sb
),
j
,
i
);
// dyn.repaintNow = true;
oldValueF
[
i
][
j
]
=
value0
;
oldValueF
[
i
][
j
]
=
value0
[
j
]
;
}
}
}
else
if
(
typeId
[
i
]
==
Pwr
.
eType_Boolean
)
{
boolean
value0
=
dyn
.
en
.
gdh
.
getObjectRefInfoBoolean
(
p
[
i
]);
for
(
int
j
=
0
;
j
<
1
;
j
++)
{
// Just the first row...
if
(
value0
!=
oldValueB
[
i
][
j
]
||
firstScan
)
{
if
(
value0
)
boolean
[]
value0
=
dyn
.
en
.
gdh
.
getObjectRefInfoBooleanArray
(
p
[
i
],
elements
[
i
]);
for
(
int
j
=
0
;
j
<
value0
.
length
;
j
++)
{
if
(
value0
[
j
]
!=
oldValueB
[
i
][
j
]
||
firstScan
)
{
if
(
value0
[
j
]
)
((
GeTable
)
dyn
.
comp
).
setValueAt
(
"1"
,
j
,
i
);
else
((
GeTable
)
dyn
.
comp
).
setValueAt
(
"0"
,
j
,
i
);
// dyn.repaintNow = true;
oldValueB
[
i
][
j
]
=
value0
;
oldValueB
[
i
][
j
]
=
value0
[
j
]
;
}
}
}
...
...
@@ -121,26 +129,26 @@ public class GeDynTable extends GeDynElem {
typeId
[
i
]
==
Pwr
.
eType_UInt16
||
typeId
[
i
]
==
Pwr
.
eType_Int8
||
typeId
[
i
]
==
Pwr
.
eType_UInt8
)
{
int
value0
=
dyn
.
en
.
gdh
.
getObjectRefInfoInt
(
p
[
i
]);
for
(
int
j
=
0
;
j
<
1
;
j
++)
{
// Just the first row...
if
(
value0
!=
oldValueI
[
i
][
j
]
||
firstScan
)
{
sb
=
cFormat
[
i
].
format
(
value0
,
sb
);
int
value0
[]
=
dyn
.
en
.
gdh
.
getObjectRefInfoIntArray
(
p
[
i
],
elements
[
i
]);
for
(
int
j
=
0
;
j
<
value0
.
length
;
j
++)
{
if
(
value0
[
j
]
!=
oldValueI
[
i
][
j
]
||
firstScan
)
{
sb
=
cFormat
[
i
].
format
(
value0
[
j
]
,
sb
);
((
GeTable
)
dyn
.
comp
).
setValueAt
(
new
String
(
sb
),
j
,
i
);
// dyn.repaintNow = true;
oldValueI
[
i
][
j
]
=
value0
;
oldValueI
[
i
][
j
]
=
value0
[
j
]
;
}
}
}
else
if
(
typeId
[
i
]
==
Pwr
.
eType_String
||
typeId
[
i
]
==
Pwr
.
eType_Objid
)
{
String
value0
=
dyn
.
en
.
gdh
.
getObjectRefInfoString
(
p
[
i
],
typeId
[
i
]);
for
(
int
j
=
0
;
j
<
1
;
j
++)
{
// Just the first row...
if
(
firstScan
||
value0
.
compareTo
(
oldValueS
[
i
][
j
])
!=
0
)
{
sb
=
cFormat
[
i
].
format
(
value0
,
sb
);
String
[]
value0
=
dyn
.
en
.
gdh
.
getObjectRefInfoStringArray
(
p
[
i
],
typeId
[
i
],
size
[
i
],
elements
[
i
]);
for
(
int
j
=
0
;
j
<
value0
.
length
;
j
++)
{
if
(
firstScan
||
value0
[
j
]
.
compareTo
(
oldValueS
[
i
][
j
])
!=
0
)
{
sb
=
cFormat
[
i
].
format
(
value0
[
j
]
,
sb
);
((
GeTable
)
dyn
.
comp
).
setValueAt
(
new
String
(
sb
),
j
,
i
);
// dyn.repaintNow = true;
oldValueS
[
i
][
j
]
=
value0
;
oldValueS
[
i
][
j
]
=
value0
[
j
]
;
}
}
}
...
...
src/jpwr/rt/src/Gdh.java
View file @
a27529a3
...
...
@@ -252,7 +252,7 @@ public class Gdh {
return
retVec
;
}
public
Vector
unrefObjectInfo_Vector
(
Vector
vec
)
{
{
Vector
retVec
=
new
Vector
();
// for(int i = 0;i < vec.size();i++)
// {
...
...
@@ -274,10 +274,17 @@ public class Gdh {
public
native
CdhrObjid
getObjectInfoObjid
(
String
attributeName
);
public
native
PwrtStatus
toggleObjectInfo
(
String
attributeName
);
public
native
GdhrRefObjectInfo
refObjectInfo
(
String
attributeName
);
public
native
float
getObjectRefInfoFloat
(
int
id
);
public
native
boolean
getObjectRefInfoBoolean
(
int
id
);
public
native
int
getObjectRefInfoInt
(
int
id
);
public
native
String
getObjectRefInfoString
(
int
id
,
int
typeid
);
public
native
float
[]
getObjectRefInfoFloatArray
(
int
id
,
int
elements
);
public
native
boolean
[]
getObjectRefInfoBooleanArray
(
int
id
,
int
elements
);
public
native
int
[]
getObjectRefInfoIntArray
(
int
id
,
int
elements
);
public
native
String
[]
getObjectRefInfoStringArray
(
int
id
,
int
typeid
,
int
size
,
int
elements
);
public
native
PwrtStatus
unrefObjectInfo
(
PwrtRefId
refid
);
public
native
CdhrObjid
nameToObjid
(
String
objectName
);
public
native
CdhrString
objidToName
(
PwrtObjid
objid
,
int
nameType
);
...
...
src/jpwr/rt/src/GdhServer.java
View file @
a27529a3
This diff is collapsed.
Click to expand it.
src/jpwr/rt/src/GdhrRefObjectInfo.java
View file @
a27529a3
...
...
@@ -16,14 +16,31 @@ public class GdhrRefObjectInfo implements Serializable
public
int
sts
;
public
int
typeId
;
public
int
subId
;
public
int
elements
;
public
int
size
;
public
GdhrRefObjectInfo
(
PwrtRefId
refid
,
int
id
,
int
sts
,
int
typeId
)
{
this
.
refid
=
refid
;
this
.
id
=
id
;
this
.
sts
=
sts
;
this
.
typeId
=
typeId
;
//default values in case we have forgotten to use the new constructor
this
.
elements
=
1
;
this
.
size
=
4
;
}
public
GdhrRefObjectInfo
(
PwrtRefId
refid
,
int
id
,
int
sts
,
int
typeId
,
int
elements
,
int
size
)
{
this
.
refid
=
refid
;
this
.
id
=
id
;
this
.
sts
=
sts
;
this
.
typeId
=
typeId
;
this
.
elements
=
elements
;
this
.
size
=
size
;
}
public
boolean
evenSts
()
{
return
(
sts
%
2
==
0
);}
public
boolean
oddSts
()
{
return
(
sts
%
2
==
1
);}
public
int
getSts
()
{
return
sts
;}
public
int
getElements
(){
return
elements
;}
public
int
getSize
(){
return
size
;}
}
src/jpwr/rt/src/Sub.java
View file @
a27529a3
...
...
@@ -14,22 +14,16 @@
public
float
valueFloat
;
public
boolean
valueBoolean
;
public
String
valueString
;
/*
public PwrtRefId refid;
public int id;
public int sts;
public int typeId;
public int subId;
*/
public
int
[]
valueIntArray
;
public
float
[]
valueFloatArray
;
public
boolean
[]
valueBooleanArray
;
public
String
[]
valueStringArray
;
public
Sub
(
String
attrName
,
PwrtRefId
refid
,
int
id
,
int
typeId
,
int
subscriptionsIndex
,
int
valueInt
,
float
valueFloat
,
boolean
valueBoolean
,
String
valueString
)
{
/*
this.refid = refid;
this.id = id;
this.sts = 0;
this.typeId = typeId;
*/
super
(
refid
,
id
,
0
,
typeId
);
this
.
subscriptionsIndex
=
subscriptionsIndex
;
this
.
valueInt
=
valueInt
;
...
...
@@ -69,25 +63,20 @@
public
Sub
(
String
attrName
,
PwrtRefId
refid
,
int
id
,
int
typeId
,
int
subscriptionsIndex
)
public
Sub
(
String
attrName
,
PwrtRefId
refid
,
int
id
,
int
typeId
,
int
subscriptionsIndex
,
int
elements
,
int
size
)
{
/*
this.refid = refid;
this.id = id;
this.sts = sts;
this.typeId = typeId;
*/
super
(
refid
,
id
,
0
,
typeId
);
super
(
refid
,
id
,
0
,
typeId
,
elements
,
size
);
this
.
attrName
=
attrName
;
this
.
subscriptionsIndex
=
subscriptionsIndex
;
}
//public boolean evenSts() { return (sts % 2 == 0);}
//public boolean oddSts() { return (sts % 2 == 1);}
//public int getSts() { return sts;}
int
getIndex
()
{
return
subscriptionsIndex
;
}
}
src/jpwr/rt/src/SubElement.java
View file @
a27529a3
...
...
@@ -11,7 +11,7 @@
{
public
int
[]
reffedByThread
;
public
BitSet
reffedByThreadBitSet
;
Sub
sub
=
new
Sub
(
" "
,
new
PwrtRefId
(
0
,
0
),
0
,
0
,
0
);
Sub
sub
=
new
Sub
(
" "
,
new
PwrtRefId
(
0
,
0
),
0
,
0
,
0
,
0
,
0
);
public
SubElement
(
int
maxConnections
,
int
threadNumber
)
...
...
@@ -40,6 +40,8 @@
this
.
sub
.
id
=
obj
.
id
;
this
.
sub
.
sts
=
obj
.
sts
;
this
.
sub
.
typeId
=
obj
.
typeId
;
this
.
sub
.
size
=
obj
.
size
;
this
.
sub
.
elements
=
obj
.
elements
;
this
.
sub
.
subscriptionsIndex
=
subscriptionsIndex
;
}
...
...
@@ -48,3 +50,4 @@
return
(
this
.
sub
.
attrName
.
equalsIgnoreCase
(((
SubElement
)
o
).
sub
.
attrName
)
&&
(((
SubElement
)
o
).
sub
.
sts
!=
0
));
}
}
src/jpwr/rt_client/src/Gdh.java
View file @
a27529a3
...
...
@@ -52,6 +52,13 @@ public class Gdh
public
final
static
int
GET_PARENT
=
44
;
public
final
static
int
GET_OBJECT_INFO_OBJID
=
45
;
public
final
static
int
GET_OBJECT_REF_INFO_BOOLEAN_ARRAY
=
46
;
public
final
static
int
GET_OBJECT_REF_INFO_FLOAT_ARRAY
=
47
;
public
final
static
int
GET_OBJECT_REF_INFO_INT_ARRAY
=
48
;
public
final
static
int
GET_OBJECT_REF_INFO_STRING_ARRAY
=
49
;
public
final
static
int
__IO_EXCEPTION
=
2000
;
public
final
static
int
__BUSY
=
2002
;
public
final
static
int
__UNREFED
=
0
;
...
...
@@ -367,7 +374,7 @@ public class Gdh
return
new
GdhrRefObjectInfo
(
null
,
0
,
0
,
0
);
}
//qqq
Sub
sub
=
new
Sub
(
attributeName
,
null
,
0
,
typeId
,
subscriptionCount
);
Sub
sub
=
new
Sub
(
attributeName
,
null
,
0
,
typeId
,
subscriptionCount
,
0
,
0
);
subscriptions
.
insertElementAt
(
sub
,
subscriptionCount
);
subscriptionCount
++;
return
new
GdhrRefObjectInfo
(
refid
,
id
,
1
,
typeId
);
...
...
@@ -395,13 +402,15 @@ public class Gdh
PwrtRefId
refid
=
new
PwrtRefId
(
rix
,
nid
);
int
id
=
in
.
readInt
();
int
typeId
=
in
.
readInt
();
Sub
sub
=
new
Sub
(
attributeName
,
refid
,
id
,
typeId
,
subscriptionCount
);
int
size
=
in
.
readInt
();
int
elements
=
in
.
readInt
();
Sub
sub
=
new
Sub
(
attributeName
,
refid
,
id
,
typeId
,
subscriptionCount
,
size
,
elements
);
sub
.
sts
=
1
;
subscriptions
.
insertElementAt
(
sub
,
id
);
subscriptionCount
++;
refid
=
new
PwrtRefId
(
id
,
0
);
subLate
++;
return
new
GdhrRefObjectInfo
(
refid
,
id
,
sts
,
typeId
);
return
new
GdhrRefObjectInfo
(
refid
,
id
,
sts
,
typeId
,
size
,
elements
);
}
catch
(
IOException
e
)
{
...
...
@@ -420,6 +429,7 @@ public class Gdh
int
nid
;
int
id
;
int
typeId
;
PwrtRefId
refid
;
if
(
listSent
)
...
...
@@ -472,6 +482,8 @@ public class Gdh
sub
.
refid
=
new
PwrtRefId
(
rix
,
nid
);
id
=
in
.
readInt
();
typeId
=
in
.
readInt
();
sub
.
size
=
in
.
readInt
();
sub
.
elements
=
in
.
readInt
();
}
locked
=
false
;
notify
();
...
...
@@ -540,8 +552,7 @@ public class Gdh
}
ret
.
id
=
ret
.
refid
.
rix
;
subscriptions
.
add
(
ret
);
//((Sub)retVec.get(i)).refid.rix = ((Sub)retVec.get(i)).id;
//System.out.println("Status " + ((Sub)retVec.get(i)).getSts());
}
subscriptionCount
+=
retVec
.
size
();
...
...
@@ -591,17 +602,24 @@ public class Gdh
//System.out.println("ArrayIndexOutOfBounds getObjectRefInfoFloat");
return
0
F
;
}
/*
try {
out.writeInt( GET_OBJECT_REF_INFO_FLOAT);
out.writeInt( id);
return in.readFloat();
} catch (IOException e) {
return 0F;
}
*/
}
public
float
[]
getObjectRefInfoFloatArray
(
int
id
,
int
elements
)
{
try
{
Sub
sub
=
(
Sub
)
subscriptions
.
elementAt
(
id
);
if
(
sub
.
oddSts
())
{
return
sub
.
valueFloatArray
;
}
return
null
;
}
catch
(
ArrayIndexOutOfBoundsException
e
)
{
//System.out.println("ArrayIndexOutOfBounds getObjectRefInfoFloat");
return
null
;
}
}
public
boolean
getObjectRefInfoBoolean
(
int
id
)
{
...
...
@@ -619,45 +637,61 @@ public class Gdh
//System.out.println("ArrayIndexOutOfBounds getObjectRefInfoBoolean");
return
false
;
}
/*
try {
out.writeInt( GET_OBJECT_REF_INFO_BOOLEAN);
out.writeInt( id);
return in.readBoolean();
} catch (IOException e) {
return false;
}
*/
}
public
int
getObjectRefInfoInt
(
int
id
)
public
boolean
[]
getObjectRefInfoBooleanArray
(
int
id
,
int
elements
)
{
try
{
Sub
sub
=
(
Sub
)
subscriptions
.
elementAt
(
id
);
if
(
sub
.
oddSts
())
Sub
sub
=
(
Sub
)
subscriptions
.
elementAt
(
id
);
if
(
sub
.
oddSts
())
{
return
sub
.
valueBooleanArray
;
}
return
null
;
}
catch
(
ArrayIndexOutOfBoundsException
e
)
{
return
sub
.
valueInt
;
//System.out.println("ArrayIndexOutOfBounds getObjectRefInfoBoolean");
return
null
;
}
return
0
;
}
public
int
getObjectRefInfoInt
(
int
id
)
{
try
{
Sub
sub
=
(
Sub
)
subscriptions
.
elementAt
(
id
);
if
(
sub
.
oddSts
())
{
return
sub
.
valueInt
;
}
return
0
;
}
catch
(
ArrayIndexOutOfBoundsException
e
)
catch
(
ArrayIndexOutOfBoundsException
e
)
{
//System.out.println("ArrayIndexOutOfBounds getObjectRefInfoInt");
return
0
;
}
/*
try {
out.writeInt( GET_OBJECT_REF_INFO_INT);
out.writeInt( id);
return in.readInt();
} catch (IOException e) {
return 0;
}
*/
}
public
int
[]
getObjectRefInfoIntArray
(
int
id
,
int
elements
)
{
try
{
Sub
sub
=
(
Sub
)
subscriptions
.
elementAt
(
id
);
if
(
sub
.
oddSts
())
{
return
sub
.
valueIntArray
;
}
return
null
;
}
catch
(
ArrayIndexOutOfBoundsException
e
)
{
//System.out.println("ArrayIndexOutOfBounds getObjectRefInfoInt");
return
null
;
}
}
public
String
getObjectRefInfoString
(
int
id
,
int
typeid
)
{
...
...
@@ -677,19 +711,31 @@ public class Gdh
//System.out.println("ArrayIndexOutOfBounds getObjectRefInfoString index " + id);
return
" "
;
}
/*
try {
out.writeInt( GET_OBJECT_REF_INFO_STRING);
out.writeInt( id);
out.writeInt( typeid);
return in.readUTF();
} catch (IOException e) {
return "";
}
public
String
[]
getObjectRefInfoStringArray
(
int
id
,
int
typeid
,
int
size
,
int
elements
)
{
try
{
Sub
sub
=
(
Sub
)
subscriptions
.
elementAt
(
id
);
if
(
sub
.
evenSts
()
||
sub
.
valueStringArray
==
null
)
{
if
(
sub
.
evenSts
())
System
.
out
.
println
(
"getObjectRefInfoString substs "
+
sub
.
getSts
()
+
" id "
+
id
);
return
null
;
}
return
sub
.
valueStringArray
;
}
catch
(
ArrayIndexOutOfBoundsException
e
)
{
//System.out.println("ArrayIndexOutOfBounds getObjectRefInfoString index " + id);
return
null
;
}
*/
}
public
synchronized
PwrtStatus
unrefObjectInfo
(
PwrtRefId
refid
)
{
try
...
...
@@ -1231,36 +1277,8 @@ public class Gdh
out
.
writeInt
(
GET_OBJECT_REF_INFO_ALL
);
out
.
flush
();
//Object retArray[] = (Object[])in.readObject();
//Object retArray[] = (Object[])inbuff.readObject();
//Object ret[] = (Object[])retArray[0];
//String sVec[] = (String[])retArray[0];
//boolean bVec[] = (boolean[])retArray[1];
//int iVec[] = (int[])retArray[2];
//float fVec[] = (float[])retArray[3];
/*
int thSubSize = in.readInt();
Object ret[] = (Object[])in.readObject();
*/
//subscriptions.clear();
//subscriptions.setSize(ret.length);
/*
String sVec[] = (String[])in.readObject();
boolean bVec[] = (boolean[])in.readObject();
int iVec[] = (int[])in.readObject();
float fVec[] = (float[])in.readObject();
*/
for
(
int
i
=
0
;
i
<
subscriptions
.
size
();
i
++)
{
//subscriptions.set(i, (jpwr.rt.Sub)ret[i]);
/*
((jpwr.rt.Sub)(subscriptions.get(i))).valueString = sVec[i];
((jpwr.rt.Sub)(subscriptions.get(i))).valueBoolean = bVec[i];
((jpwr.rt.Sub)(subscriptions.get(i))).valueInt = iVec[i];
((jpwr.rt.Sub)(subscriptions.get(i))).valueFloat = fVec[i];
*/
try
{
...
...
@@ -1645,24 +1663,11 @@ public class Gdh
return
0
;
}
/*
private class Sub extends GdhrRefObjectInfo implements Serializable
{
String attrName;
int subscriptionsIndex;
int valueInt;
float valueFloat;
boolean valueBoolean;
String valueString;
}
public Sub(String attrName, PwrtRefId refid, int id, int typeId, int subscriptionsIndex)
{
super(refid, id, 0, typeId);
this.attrName = attrName;
this.subscriptionsIndex = subscriptionsIndex;
}
}
*/
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment