Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sven Gestegård Robertz
LabComm
Commits
bed11fbc
Commit
bed11fbc
authored
Nov 22, 2013
by
Sven Gestegård Robertz
Browse files
removed generated file
parent
3ab53496
Changes
1
Hide whitespace changes
Inline
Side-by-side
examples/tcp/labcommTCPtest/FooSample.java
deleted
100644 → 0
View file @
3ab53496
/*
sample struct {
int x;
int y;
long t;
double d;
} FooSample;
*/
package
labcommTCPtest
;
import
java.io.IOException
;
import
se.lth.control.labcomm.LabCommDecoder
;
import
se.lth.control.labcomm.LabCommDispatcher
;
import
se.lth.control.labcomm.LabCommEncoder
;
import
se.lth.control.labcomm.LabCommHandler
;
import
se.lth.control.labcomm.LabCommSample
;
public
class
FooSample
implements
LabCommSample
{
public
int
x
;
public
int
y
;
public
long
t
;
public
double
d
;
public
interface
Handler
extends
LabCommHandler
{
public
void
handle_FooSample
(
FooSample
value
)
throws
Exception
;
}
public
static
void
register
(
LabCommDecoder
d
,
Handler
h
)
throws
IOException
{
d
.
register
(
new
Dispatcher
(),
h
);
}
public
static
void
register
(
LabCommEncoder
e
)
throws
IOException
{
e
.
register
(
new
Dispatcher
());
}
private
static
class
Dispatcher
implements
LabCommDispatcher
{
public
Class
getSampleClass
()
{
return
FooSample
.
class
;
}
public
String
getName
()
{
return
"FooSample"
;
}
public
byte
[]
getSignature
()
{
return
signature
;
}
public
void
decodeAndHandle
(
LabCommDecoder
d
,
LabCommHandler
h
)
throws
Exception
{
((
Handler
)
h
).
handle_FooSample
(
FooSample
.
decode
(
d
));
}
}
public
static
void
encode
(
LabCommEncoder
e
,
FooSample
value
)
throws
IOException
{
e
.
begin
(
FooSample
.
class
);
e
.
encodeInt
(
value
.
x
);
e
.
encodeInt
(
value
.
y
);
e
.
encodeLong
(
value
.
t
);
e
.
encodeDouble
(
value
.
d
);
e
.
end
(
FooSample
.
class
);
}
public
static
FooSample
decode
(
LabCommDecoder
d
)
throws
IOException
{
FooSample
result
;
result
=
new
FooSample
();
result
.
x
=
d
.
decodeInt
();
result
.
y
=
d
.
decodeInt
();
result
.
t
=
d
.
decodeLong
();
result
.
d
=
d
.
decodeDouble
();
return
result
;
}
private
static
byte
[]
signature
=
new
byte
[]
{
// struct { 4 fields
17
,
4
,
// int 'x'
1
,
120
,
35
,
// int 'y'
1
,
121
,
35
,
// long 't'
1
,
116
,
36
,
// double 'd'
1
,
100
,
38
,
// }
};
}
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