Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NetworkedGraphicsMV3500
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Savage
NetworkedGraphicsMV3500
Commits
c7f3d9c6
Commit
c7f3d9c6
authored
3 years ago
by
Brutzman, Don
Browse files
Options
Downloads
Patches
Plain Diff
continue efforts on espdu.copyByteBuffer()
parent
0b63fc7e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/src/OpenDis7Examples/PduTrack.java
+27
-26
27 additions, 26 deletions
examples/src/OpenDis7Examples/PduTrack.java
examples/src/OpenDis7Examples/PduTrackLog.txt
+30
-30
30 additions, 30 deletions
examples/src/OpenDis7Examples/PduTrackLog.txt
with
57 additions
and
56 deletions
examples/src/OpenDis7Examples/PduTrack.java
+
27
−
26
View file @
c7f3d9c6
...
...
@@ -186,20 +186,21 @@ public class PduTrack
{
if
(
newPdu
.
getPduType
()
==
DisPduType
.
ENTITY_STATE
)
{
// EntityStatePdu deepCopyEspdu = new EntityStatePdu();
EntityStatePdu
deepCopyEspdu
=
pduFactory
.
makeEntityStatePdu
();
deepCopyEspdu
.
setTimestamp
(((
EntityStatePdu
)
newPdu
).
getTimestamp
());
deepCopyEspdu
.
setMarking
(((
EntityStatePdu
)
newPdu
).
getMarking
());
deepCopyEspdu
.
setEntityID
(((
EntityStatePdu
)
newPdu
).
getEntityID
());
deepCopyEspdu
.
setForceId
(((
EntityStatePdu
)
newPdu
).
getForceId
());
deepCopyEspdu
.
setEntityType
(((
EntityStatePdu
)
newPdu
).
getEntityType
());
deepCopyEspdu
.
setEntityLocation
(((
EntityStatePdu
)
newPdu
).
getEntityLocation
());
deepCopyEspdu
.
setEntityOrientation
(((
EntityStatePdu
)
newPdu
).
getEntityOrientation
());
// TODO apparently not working
// EntityStatePdu deepCopyEspdu = ((EntityStatePdu)newPdu).copy();
//// EntityStatePdu deepCopyEspdu = new EntityStatePdu();
// EntityStatePdu deepCopyEspdu = pduFactory.makeEntityStatePdu();
// deepCopyEspdu.setTimestamp (((EntityStatePdu)newPdu).getTimestamp());
// deepCopyEspdu.setMarking (((EntityStatePdu)newPdu).getMarking());
// deepCopyEspdu.setEntityID (((EntityStatePdu)newPdu).getEntityID());
// deepCopyEspdu.setForceId (((EntityStatePdu)newPdu).getForceId());
// deepCopyEspdu.setEntityType (((EntityStatePdu)newPdu).getEntityType());
// deepCopyEspdu.setEntityLocation (((EntityStatePdu)newPdu).getEntityLocation());
// deepCopyEspdu.setEntityOrientation(((EntityStatePdu)newPdu).getEntityOrientation());
EntityStatePdu
deepCopyEspdu
=
((
EntityStatePdu
)
newPdu
).
copy
();
pduList
.
add
(
deepCopyEspdu
);
// alternative trials:
// pduList.add(((EntityStatePdu)newPdu).copyDataOutputStream());
// pduList.add(((EntityStatePdu)newPdu).copy());
if
(
initialLocation
==
null
)
{
...
...
@@ -858,7 +859,7 @@ public class PduTrack
espdu
.
setEntityID
(
entityID_123
);
espdu
.
setForceId
(
ForceID
.
FRIENDLY
);
espdu
.
setEntityType
(
new
_001Poseidon
());
// note import statement above
pduTrack
.
addPdu
(
espdu
);
pduTrack
.
addPdu
(
espdu
);
// create copy
reportPdu
(
espdu
);
}
// System.out.println(TRACE_PREFIX + "reversePdus() then sortPdus() to test track operations");
...
...
@@ -885,17 +886,17 @@ public class PduTrack
System
.
out
.
println
(
"espdu from pduTrack pduList"
);
reportPdu
(
espdu
);
byte
[]
byteArray
=
espdu
.
marshal
();
System
.
out
.
println
(
"espdu.marshal() byteArray: "
+
bytesToHex
(
byteArray
));
System
.
out
.
println
(
"espdu.marshal() byteArray:
"
+
bytesToHex
(
byteArray
));
flushBuffers
();
ByteBuffer
byteBuffer
=
ByteBuffer
.
allocate
(
byteArray
.
length
);
espdu
.
marshal
(
byteBuffer
);
System
.
out
.
println
(
"espdu.marshal(byteBuffer): "
+
bytesToHex
(
byteBuffer
.
array
()));
System
.
out
.
println
(
"espdu.marshal(byteBuffer):
"
+
bytesToHex
(
byteBuffer
.
array
()));
flushBuffers
();
espdu
.
marshal
(
dataOutputStream
);
byte
[]
byteArrayDOS
=
byteArrayOutputStream
.
toByteArray
();
System
.
out
.
println
(
"espdu.marshal(dataOutputStream): "
+
bytesToHex
(
byteArrayDOS
));
System
.
out
.
println
(
"espdu.marshal(dataOutputStream):
"
+
bytesToHex
(
byteArrayDOS
));
flushBuffers
();
System
.
out
.
println
();
// - - - - - - - - - - - - - - - - -
...
...
@@ -903,35 +904,35 @@ public class PduTrack
System
.
out
.
println
(
"espdu.copyByteBuffer()"
);
reportPdu
(
espdu
.
copyByteBuffer
());
byte
[]
byteArrayCopy
=
espdu
.
copyByteBuffer
().
marshal
();
System
.
out
.
println
(
"espdu.copyByteBuffer().marshal() byteArray: "
+
bytesToHex
(
byteArrayCopy
));
System
.
out
.
println
(
"espdu.copyByteBuffer().marshal() byteArray:
"
+
bytesToHex
(
byteArrayCopy
));
flushBuffers
();
ByteBuffer
byteBufferCopy
=
ByteBuffer
.
allocate
(
byteArray
.
length
);
// TODO is there a better way to reset?
espdu
.
copyByteBuffer
().
marshal
(
byteBufferCopy
);
System
.
out
.
println
(
"espdu.copyByteBuffer().marshal(byteBufferCopy): "
+
bytesToHex
(
byteBufferCopy
.
array
()));
System
.
out
.
println
(
"espdu.copyByteBuffer().marshal(byteBufferCopy):
"
+
bytesToHex
(
byteBufferCopy
.
array
()));
flushBuffers
();
espdu
.
copyByteBuffer
().
marshal
(
dataOutputStream
);
byte
[]
byteArrayDosCopy
=
byteArrayOutputStream
.
toByteArray
();
System
.
out
.
println
(
"espdu.copyByteBuffer().marshal(dataOutputStream): "
+
bytesToHex
(
byteArrayDosCopy
));
System
.
out
.
println
(
"espdu.copyByteBuffer().marshal(dataOutputStream):
"
+
bytesToHex
(
byteArrayDosCopy
));
flushBuffers
();
System
.
out
.
println
();
// - - - - - - - - - - - - - - - - -
System
.
out
.
println
(
"espdu.copyDataOutputStream()"
);
reportPdu
(
espdu
.
copyDataOutputStream
());
byteArrayCopy
=
espdu
.
copyDataOutputStream
().
marshal
();
System
.
out
.
println
(
"espdu.copyDataOutputStream().marshal() byteArray: "
+
bytesToHex
(
byteArrayCopy
));
byte
[]
byteArrayCopy
DOS
=
espdu
.
copyDataOutputStream
().
marshal
();
System
.
out
.
println
(
"espdu.copyDataOutputStream().marshal() byteArray: "
+
bytesToHex
(
byteArrayCopy
DOS
));
flushBuffers
();
byteBufferCopy
=
ByteBuffer
.
allocate
(
byteArray
.
length
);
// TODO is there a better way to reset?
espdu
.
copyDataOutputStream
().
marshal
(
byteBufferCopy
);
System
.
out
.
println
(
"espdu.copyDataOutputStream().marshal(byteBufferCopy): "
+
bytesToHex
(
byteBufferCopy
.
array
()));
ByteBuffer
byteBufferCopy
DOS
=
ByteBuffer
.
allocate
(
byteArray
.
length
);
// TODO is there a better way to reset?
espdu
.
copyDataOutputStream
().
marshal
(
byteBufferCopy
DOS
);
System
.
out
.
println
(
"espdu.copyDataOutputStream().marshal(byteBufferCopy): "
+
bytesToHex
(
byteBufferCopy
DOS
.
array
()));
flushBuffers
();
espdu
.
copyDataOutputStream
().
marshal
(
dataOutputStream
);
byteArrayDosCopy
=
byteArrayOutputStream
.
toByteArray
();
System
.
out
.
println
(
"espdu.copyDataOutputStream().marshal(dataOutputStream): "
+
bytesToHex
(
byteArrayDosCopy
));
byte
[]
byteArrayDosCopy
2
=
byteArrayOutputStream
.
toByteArray
();
System
.
out
.
println
(
"espdu.copyDataOutputStream().marshal(dataOutputStream): "
+
bytesToHex
(
byteArrayDosCopy
2
));
flushBuffers
();
System
.
out
.
println
();
...
...
This diff is collapsed.
Click to expand it.
examples/src/OpenDis7Examples/PduTrackLog.txt
+
30
−
30
View file @
c7f3d9c6
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