Commit bc52d70a authored by Sven Gestegård Robertz's avatar Sven Gestegård Robertz
Browse files

added example python encoder

parent ec845d8b
#!/usr/bin/python
import labcomm
import sys
import simple
if __name__ == '__main__':
encoder = labcomm.Encoder(labcomm.StreamWriter(open(sys.argv[1], 'w')))
encoder.add_decl(simple.theTwoInts.signature)
encoder.add_decl(simple.IntString.signature)
foo = simple.theTwoInts()
foo.a = 13
foo.b = 37
encoder.encode(foo, simple.theTwoInts.signature)
bar = simple.IntString()
bar.x = 1742
bar.s = "A string from Python"
encoder.encode(bar, simple.IntString.signature)
......@@ -2,6 +2,10 @@ export LD_LIBRARY_PATH=../../lib/c/
java -cp .:../../lib/java:gen Encoder encoded_data
./example_decoder encoded_data
PYTHONPATH=../../lib/python:gen ./example_encoder.py encoded_data
java -cp .:../../lib/java:gen Decoder encoded_data
./example_encoder encoded_data
java -cp .:../../lib/java:gen Decoder encoded_data
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment