Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ADAS
HyperLoom
Commits
c510093c
Commit
c510093c
authored
Jul 01, 2016
by
Stanislav Bohm
Browse files
ENH: ClientMessage
parent
818fc0f6
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/client/client.py
View file @
c510093c
from
loomcomm_pb2
import
Register
,
Data
,
DataPrologu
e
from
loomcomm_pb2
import
Register
,
Data
,
ClientMessag
e
import
socket
from
connection
import
Connection
...
...
@@ -40,8 +40,10 @@ class Client(object):
data
=
{}
while
expected
!=
len
(
data
):
msg
=
self
.
connection
.
receive_message
()
prologue
=
DataPrologue
()
prologue
.
ParseFromString
(
msg
)
cmsg
=
ClientMessage
()
cmsg
.
ParseFromString
(
msg
)
assert
cmsg
.
type
==
ClientMessage
.
DATA
prologue
=
cmsg
.
data
data
[
prologue
.
id
]
=
self
.
_receive_data
()
if
single_result
:
return
data
[
results
.
id
]
...
...
src/client/loomcomm_pb2.py
View file @
c510093c
...
...
@@ -18,7 +18,7 @@ _sym_db = _symbol_database.Default()
DESCRIPTOR
=
_descriptor
.
FileDescriptor
(
name
=
'loomcomm.proto'
,
package
=
'loomcomm'
,
serialized_pb
=
_b
(
'
\n\x0e
loomcomm.proto
\x12\x08
loomcomm
\"\x9f\x01\n\x08
Register
\x12\x18\n\x10
protocol_version
\x18\x01
\x02
(
\x05\x12
%
\n\x04
type
\x18\x02
\x02
(
\x0e\x32\x17
.loomcomm.Register.Type
\x12\x0c\n\x04
port
\x18\x03
\x01
(
\x05\x12\x12\n\n
task_types
\x18\x04
\x03
(
\t\"
0
\n\x04
Type
\x12\x13\n\x0f
REGISTER_WORKER
\x10\x01\x12\x13\n\x0f
REGISTER_CLIENT
\x10\x02\"
&
\n\r
ServerMessage
\"\x15\n\x04
Type
\x12\r\n\t
START_JOB
\x10\x01\"\xc4\x01\n\r
WorkerCommand
\x12
*
\n\x04
type
\x18\x01
\x02
(
\x0e\x32\x1c
.loomcomm.WorkerCommand.Type
\x12\n\n\x02
id
\x18\x02
\x01
(
\x05\x12\x11\n\t
task_type
\x18\x03
\x01
(
\x05\x12\x13\n\x0b
task_config
\x18\x04
\x01
(
\t\x12\x13\n\x0b
task_inputs
\x18\x05
\x03
(
\x05\x12\x0f\n\x07\x61\x64\x64
ress
\x18\n
\x01
(
\t\x12\x11\n\t
with_size
\x18\x0b
\x01
(
\x08\"\x1a\n\x04
Type
\x12\x08\n\x04
TASK
\x10\x01\x12\x08\n\x04
SEND
\x10\x02\"\x1c\n\x0e
WorkerResponse
\x12\n\n\x02
id
\x18\x02
\x01
(
\x05\"\x18\n\x08\x41
nnounce
\x12\x0c\n\x04
port
\x18\x01
\x02
(
\x05\"
-
\n\x0c\x44\x61
taPrologue
\x12\n\n\x02
id
\x18\x01
\x02
(
\x05\x12\x11\n\t
data_size
\x18\x03
\x01
(
\x04\"
%
\n\x04\x44\x61
ta
\x12\x0f\n\x07
type_id
\x18\x01
\x02
(
\x05\x12\x0c\n\x04
size
\x18\x02
\x01
(
\x04\x42\x02
H
\x03
'
)
serialized_pb
=
_b
(
'
\n\x0e
loomcomm.proto
\x12\x08
loomcomm
\"\x9f\x01\n\x08
Register
\x12\x18\n\x10
protocol_version
\x18\x01
\x02
(
\x05\x12
%
\n\x04
type
\x18\x02
\x02
(
\x0e\x32\x17
.loomcomm.Register.Type
\x12\x0c\n\x04
port
\x18\x03
\x01
(
\x05\x12\x12\n\n
task_types
\x18\x04
\x03
(
\t\"
0
\n\x04
Type
\x12\x13\n\x0f
REGISTER_WORKER
\x10\x01\x12\x13\n\x0f
REGISTER_CLIENT
\x10\x02\"
&
\n\r
ServerMessage
\"\x15\n\x04
Type
\x12\r\n\t
START_JOB
\x10\x01\"\xc4\x01\n\r
WorkerCommand
\x12
*
\n\x04
type
\x18\x01
\x02
(
\x0e\x32\x1c
.loomcomm.WorkerCommand.Type
\x12\n\n\x02
id
\x18\x02
\x01
(
\x05\x12\x11\n\t
task_type
\x18\x03
\x01
(
\x05\x12\x13\n\x0b
task_config
\x18\x04
\x01
(
\t\x12\x13\n\x0b
task_inputs
\x18\x05
\x03
(
\x05\x12\x0f\n\x07\x61\x64\x64
ress
\x18\n
\x01
(
\t\x12\x11\n\t
with_size
\x18\x0b
\x01
(
\x08\"\x1a\n\x04
Type
\x12\x08\n\x04
TASK
\x10\x01\x12\x08\n\x04
SEND
\x10\x02\"\x1c\n\x0e
WorkerResponse
\x12\n\n\x02
id
\x18\x02
\x01
(
\x05\"\x18\n\x08\x41
nnounce
\x12\x0c\n\x04
port
\x18\x01
\x02
(
\x05\"
-
\n\x0c\x44\x61
taPrologue
\x12\n\n\x02
id
\x18\x01
\x02
(
\x05\x12\x11\n\t
data_size
\x18\x03
\x01
(
\x04\"
%
\n\x04\x44\x61
ta
\x12\x0f\n\x07
type_id
\x18\x01
\x02
(
\x05\x12\x0c\n\x04
size
\x18\x02
\x01
(
\x04\
"
&
\n\x08\x46\x65\x65\x64\x62\x61\x63
k
\x12\n\n\x02
id
\x18\x01
\x02
(
\x05\x12\x0e\n\x06
worker
\x18\x02
\x02
(
\t\"\xa7\x01\n\r
ClientMessage
\x12
*
\n\x04
type
\x18\x01
\x02
(
\x0e\x32\x1c
.loomcomm.ClientMessage.Type
\x12
$
\n\x04\x64\x61
ta
\x18\x02
\x01
(
\x0b\x32\x16
.loomcomm.DataPrologue
\x12
$
\n\x08\x66\x65\x65\x64\x62\x61\x63
k
\x18\x03
\x01
(
\x0b\x32\x12
.loomcomm.Feedback
\"\x1e\n\x04
Type
\x12\x08\n\x04\x44\x41
TA
\x10\x01\x12\x0c\n\x08\x46\x45\x45\x44\x42\x41\x43
K
\x10\x02\
x42\x02
H
\x03
'
)
)
_sym_db
.
RegisterFileDescriptor
(
DESCRIPTOR
)
...
...
@@ -86,6 +86,28 @@ _WORKERCOMMAND_TYPE = _descriptor.EnumDescriptor(
)
_sym_db
.
RegisterEnumDescriptor
(
_WORKERCOMMAND_TYPE
)
_CLIENTMESSAGE_TYPE
=
_descriptor
.
EnumDescriptor
(
name
=
'Type'
,
full_name
=
'loomcomm.ClientMessage.Type'
,
filename
=
None
,
file
=
DESCRIPTOR
,
values
=
[
_descriptor
.
EnumValueDescriptor
(
name
=
'DATA'
,
index
=
0
,
number
=
1
,
options
=
None
,
type
=
None
),
_descriptor
.
EnumValueDescriptor
(
name
=
'FEEDBACK'
,
index
=
1
,
number
=
2
,
options
=
None
,
type
=
None
),
],
containing_type
=
None
,
options
=
None
,
serialized_start
=
749
,
serialized_end
=
779
,
)
_sym_db
.
RegisterEnumDescriptor
(
_CLIENTMESSAGE_TYPE
)
_REGISTER
=
_descriptor
.
Descriptor
(
name
=
'Register'
,
...
...
@@ -369,11 +391,97 @@ _DATA = _descriptor.Descriptor(
serialized_end
=
569
,
)
_FEEDBACK
=
_descriptor
.
Descriptor
(
name
=
'Feedback'
,
full_name
=
'loomcomm.Feedback'
,
filename
=
None
,
file
=
DESCRIPTOR
,
containing_type
=
None
,
fields
=
[
_descriptor
.
FieldDescriptor
(
name
=
'id'
,
full_name
=
'loomcomm.Feedback.id'
,
index
=
0
,
number
=
1
,
type
=
5
,
cpp_type
=
1
,
label
=
2
,
has_default_value
=
False
,
default_value
=
0
,
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'worker'
,
full_name
=
'loomcomm.Feedback.worker'
,
index
=
1
,
number
=
2
,
type
=
9
,
cpp_type
=
9
,
label
=
2
,
has_default_value
=
False
,
default_value
=
_b
(
""
).
decode
(
'utf-8'
),
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
options
=
None
),
],
extensions
=
[
],
nested_types
=
[],
enum_types
=
[
],
options
=
None
,
is_extendable
=
False
,
extension_ranges
=
[],
oneofs
=
[
],
serialized_start
=
571
,
serialized_end
=
609
,
)
_CLIENTMESSAGE
=
_descriptor
.
Descriptor
(
name
=
'ClientMessage'
,
full_name
=
'loomcomm.ClientMessage'
,
filename
=
None
,
file
=
DESCRIPTOR
,
containing_type
=
None
,
fields
=
[
_descriptor
.
FieldDescriptor
(
name
=
'type'
,
full_name
=
'loomcomm.ClientMessage.type'
,
index
=
0
,
number
=
1
,
type
=
14
,
cpp_type
=
8
,
label
=
2
,
has_default_value
=
False
,
default_value
=
1
,
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'data'
,
full_name
=
'loomcomm.ClientMessage.data'
,
index
=
1
,
number
=
2
,
type
=
11
,
cpp_type
=
10
,
label
=
1
,
has_default_value
=
False
,
default_value
=
None
,
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
options
=
None
),
_descriptor
.
FieldDescriptor
(
name
=
'feedback'
,
full_name
=
'loomcomm.ClientMessage.feedback'
,
index
=
2
,
number
=
3
,
type
=
11
,
cpp_type
=
10
,
label
=
1
,
has_default_value
=
False
,
default_value
=
None
,
message_type
=
None
,
enum_type
=
None
,
containing_type
=
None
,
is_extension
=
False
,
extension_scope
=
None
,
options
=
None
),
],
extensions
=
[
],
nested_types
=
[],
enum_types
=
[
_CLIENTMESSAGE_TYPE
,
],
options
=
None
,
is_extendable
=
False
,
extension_ranges
=
[],
oneofs
=
[
],
serialized_start
=
612
,
serialized_end
=
779
,
)
_REGISTER
.
fields_by_name
[
'type'
].
enum_type
=
_REGISTER_TYPE
_REGISTER_TYPE
.
containing_type
=
_REGISTER
_SERVERMESSAGE_TYPE
.
containing_type
=
_SERVERMESSAGE
_WORKERCOMMAND
.
fields_by_name
[
'type'
].
enum_type
=
_WORKERCOMMAND_TYPE
_WORKERCOMMAND_TYPE
.
containing_type
=
_WORKERCOMMAND
_CLIENTMESSAGE
.
fields_by_name
[
'type'
].
enum_type
=
_CLIENTMESSAGE_TYPE
_CLIENTMESSAGE
.
fields_by_name
[
'data'
].
message_type
=
_DATAPROLOGUE
_CLIENTMESSAGE
.
fields_by_name
[
'feedback'
].
message_type
=
_FEEDBACK
_CLIENTMESSAGE_TYPE
.
containing_type
=
_CLIENTMESSAGE
DESCRIPTOR
.
message_types_by_name
[
'Register'
]
=
_REGISTER
DESCRIPTOR
.
message_types_by_name
[
'ServerMessage'
]
=
_SERVERMESSAGE
DESCRIPTOR
.
message_types_by_name
[
'WorkerCommand'
]
=
_WORKERCOMMAND
...
...
@@ -381,6 +489,8 @@ DESCRIPTOR.message_types_by_name['WorkerResponse'] = _WORKERRESPONSE
DESCRIPTOR
.
message_types_by_name
[
'Announce'
]
=
_ANNOUNCE
DESCRIPTOR
.
message_types_by_name
[
'DataPrologue'
]
=
_DATAPROLOGUE
DESCRIPTOR
.
message_types_by_name
[
'Data'
]
=
_DATA
DESCRIPTOR
.
message_types_by_name
[
'Feedback'
]
=
_FEEDBACK
DESCRIPTOR
.
message_types_by_name
[
'ClientMessage'
]
=
_CLIENTMESSAGE
Register
=
_reflection
.
GeneratedProtocolMessageType
(
'Register'
,
(
_message
.
Message
,),
dict
(
DESCRIPTOR
=
_REGISTER
,
...
...
@@ -431,6 +541,20 @@ Data = _reflection.GeneratedProtocolMessageType('Data', (_message.Message,), dic
))
_sym_db
.
RegisterMessage
(
Data
)
Feedback
=
_reflection
.
GeneratedProtocolMessageType
(
'Feedback'
,
(
_message
.
Message
,),
dict
(
DESCRIPTOR
=
_FEEDBACK
,
__module__
=
'loomcomm_pb2'
# @@protoc_insertion_point(class_scope:loomcomm.Feedback)
))
_sym_db
.
RegisterMessage
(
Feedback
)
ClientMessage
=
_reflection
.
GeneratedProtocolMessageType
(
'ClientMessage'
,
(
_message
.
Message
,),
dict
(
DESCRIPTOR
=
_CLIENTMESSAGE
,
__module__
=
'loomcomm_pb2'
# @@protoc_insertion_point(class_scope:loomcomm.ClientMessage)
))
_sym_db
.
RegisterMessage
(
ClientMessage
)
DESCRIPTOR
.
has_options
=
True
DESCRIPTOR
.
_options
=
_descriptor
.
_ParseOptions
(
descriptor_pb2
.
FileOptions
(),
_b
(
'H
\003
'
))
...
...
src/libloom/loomcomm.pb.cc
View file @
c510093c
...
...
@@ -23,6 +23,8 @@ void protobuf_ShutdownFile_loomcomm_2eproto() {
delete
Announce
::
default_instance_
;
delete
DataPrologue
::
default_instance_
;
delete
Data
::
default_instance_
;
delete
Feedback
::
default_instance_
;
delete
ClientMessage
::
default_instance_
;
}
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
...
...
@@ -44,6 +46,8 @@ void protobuf_AddDesc_loomcomm_2eproto() {
Announce
::
default_instance_
=
new
Announce
();
DataPrologue
::
default_instance_
=
new
DataPrologue
();
Data
::
default_instance_
=
new
Data
();
Feedback
::
default_instance_
=
new
Feedback
();
ClientMessage
::
default_instance_
=
new
ClientMessage
();
Register
::
default_instance_
->
InitAsDefaultInstance
();
ServerMessage
::
default_instance_
->
InitAsDefaultInstance
();
WorkerCommand
::
default_instance_
->
InitAsDefaultInstance
();
...
...
@@ -51,6 +55,8 @@ void protobuf_AddDesc_loomcomm_2eproto() {
Announce
::
default_instance_
->
InitAsDefaultInstance
();
DataPrologue
::
default_instance_
->
InitAsDefaultInstance
();
Data
::
default_instance_
->
InitAsDefaultInstance
();
Feedback
::
default_instance_
->
InitAsDefaultInstance
();
ClientMessage
::
default_instance_
->
InitAsDefaultInstance
();
::
google
::
protobuf
::
internal
::
OnShutdown
(
&
protobuf_ShutdownFile_loomcomm_2eproto
);
}
...
...
@@ -1860,6 +1866,548 @@ void Data::Swap(Data* other) {
}
// ===================================================================
#ifndef _MSC_VER
const
int
Feedback
::
kIdFieldNumber
;
const
int
Feedback
::
kWorkerFieldNumber
;
#endif // !_MSC_VER
Feedback
::
Feedback
()
:
::
google
::
protobuf
::
MessageLite
()
{
SharedCtor
();
// @@protoc_insertion_point(constructor:loomcomm.Feedback)
}
void
Feedback
::
InitAsDefaultInstance
()
{
}
Feedback
::
Feedback
(
const
Feedback
&
from
)
:
::
google
::
protobuf
::
MessageLite
()
{
SharedCtor
();
MergeFrom
(
from
);
// @@protoc_insertion_point(copy_constructor:loomcomm.Feedback)
}
void
Feedback
::
SharedCtor
()
{
::
google
::
protobuf
::
internal
::
GetEmptyString
();
_cached_size_
=
0
;
id_
=
0
;
worker_
=
const_cast
<
::
std
::
string
*>
(
&::
google
::
protobuf
::
internal
::
GetEmptyStringAlreadyInited
());
::
memset
(
_has_bits_
,
0
,
sizeof
(
_has_bits_
));
}
Feedback
::~
Feedback
()
{
// @@protoc_insertion_point(destructor:loomcomm.Feedback)
SharedDtor
();
}
void
Feedback
::
SharedDtor
()
{
if
(
worker_
!=
&::
google
::
protobuf
::
internal
::
GetEmptyStringAlreadyInited
())
{
delete
worker_
;
}
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
if
(
this
!=
&
default_instance
())
{
#else
if
(
this
!=
default_instance_
)
{
#endif
}
}
void
Feedback
::
SetCachedSize
(
int
size
)
const
{
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN
();
_cached_size_
=
size
;
GOOGLE_SAFE_CONCURRENT_WRITES_END
();
}
const
Feedback
&
Feedback
::
default_instance
()
{
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_AddDesc_loomcomm_2eproto
();
#else
if
(
default_instance_
==
NULL
)
protobuf_AddDesc_loomcomm_2eproto
();
#endif
return
*
default_instance_
;
}
Feedback
*
Feedback
::
default_instance_
=
NULL
;
Feedback
*
Feedback
::
New
()
const
{
return
new
Feedback
;
}
void
Feedback
::
Clear
()
{
if
(
_has_bits_
[
0
/
32
]
&
3
)
{
id_
=
0
;
if
(
has_worker
())
{
if
(
worker_
!=
&::
google
::
protobuf
::
internal
::
GetEmptyStringAlreadyInited
())
{
worker_
->
clear
();
}
}
}
::
memset
(
_has_bits_
,
0
,
sizeof
(
_has_bits_
));
mutable_unknown_fields
()
->
clear
();
}
bool
Feedback
::
MergePartialFromCodedStream
(
::
google
::
protobuf
::
io
::
CodedInputStream
*
input
)
{
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::
google
::
protobuf
::
uint32
tag
;
::
google
::
protobuf
::
io
::
StringOutputStream
unknown_fields_string
(
mutable_unknown_fields
());
::
google
::
protobuf
::
io
::
CodedOutputStream
unknown_fields_stream
(
&
unknown_fields_string
);
// @@protoc_insertion_point(parse_start:loomcomm.Feedback)
for
(;;)
{
::
std
::
pair
<
::
google
::
protobuf
::
uint32
,
bool
>
p
=
input
->
ReadTagWithCutoff
(
127
);
tag
=
p
.
first
;
if
(
!
p
.
second
)
goto
handle_unusual
;
switch
(
::
google
::
protobuf
::
internal
::
WireFormatLite
::
GetTagFieldNumber
(
tag
))
{
// required int32 id = 1;
case
1
:
{
if
(
tag
==
8
)
{
DO_
((
::
google
::
protobuf
::
internal
::
WireFormatLite
::
ReadPrimitive
<
::
google
::
protobuf
::
int32
,
::
google
::
protobuf
::
internal
::
WireFormatLite
::
TYPE_INT32
>
(
input
,
&
id_
)));
set_has_id
();
}
else
{
goto
handle_unusual
;
}
if
(
input
->
ExpectTag
(
18
))
goto
parse_worker
;
break
;
}
// required string worker = 2;
case
2
:
{
if
(
tag
==
18
)
{
parse_worker:
DO_
(
::
google
::
protobuf
::
internal
::
WireFormatLite
::
ReadString
(
input
,
this
->
mutable_worker
()));
}
else
{
goto
handle_unusual
;
}
if
(
input
->
ExpectAtEnd
())
goto
success
;
break
;
}
default:
{
handle_unusual:
if
(
tag
==
0
||
::
google
::
protobuf
::
internal
::
WireFormatLite
::
GetTagWireType
(
tag
)
==
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WIRETYPE_END_GROUP
)
{
goto
success
;
}
DO_
(
::
google
::
protobuf
::
internal
::
WireFormatLite
::
SkipField
(
input
,
tag
,
&
unknown_fields_stream
));
break
;
}
}
}
success:
// @@protoc_insertion_point(parse_success:loomcomm.Feedback)
return
true
;
failure:
// @@protoc_insertion_point(parse_failure:loomcomm.Feedback)
return
false
;
#undef DO_
}
void
Feedback
::
SerializeWithCachedSizes
(
::
google
::
protobuf
::
io
::
CodedOutputStream
*
output
)
const
{
// @@protoc_insertion_point(serialize_start:loomcomm.Feedback)
// required int32 id = 1;
if
(
has_id
())
{
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WriteInt32
(
1
,
this
->
id
(),
output
);
}
// required string worker = 2;
if
(
has_worker
())
{
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WriteStringMaybeAliased
(
2
,
this
->
worker
(),
output
);
}
output
->
WriteRaw
(
unknown_fields
().
data
(),
unknown_fields
().
size
());
// @@protoc_insertion_point(serialize_end:loomcomm.Feedback)
}
int
Feedback
::
ByteSize
()
const
{
int
total_size
=
0
;
if
(
_has_bits_
[
0
/
32
]
&
(
0xffu
<<
(
0
%
32
)))
{
// required int32 id = 1;
if
(
has_id
())
{
total_size
+=
1
+
::
google
::
protobuf
::
internal
::
WireFormatLite
::
Int32Size
(
this
->
id
());
}
// required string worker = 2;
if
(
has_worker
())
{
total_size
+=
1
+
::
google
::
protobuf
::
internal
::
WireFormatLite
::
StringSize
(
this
->
worker
());
}
}
total_size
+=
unknown_fields
().
size
();
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN
();
_cached_size_
=
total_size
;
GOOGLE_SAFE_CONCURRENT_WRITES_END
();
return
total_size
;
}
void
Feedback
::
CheckTypeAndMergeFrom
(
const
::
google
::
protobuf
::
MessageLite
&
from
)
{
MergeFrom
(
*::
google
::
protobuf
::
down_cast
<
const
Feedback
*>
(
&
from
));
}
void
Feedback
::
MergeFrom
(
const
Feedback
&
from
)
{
GOOGLE_CHECK_NE
(
&
from
,
this
);
if
(
from
.
_has_bits_
[
0
/
32
]
&
(
0xffu
<<
(
0
%
32
)))
{
if
(
from
.
has_id
())
{
set_id
(
from
.
id
());
}
if
(
from
.
has_worker
())
{
set_worker
(
from
.
worker
());
}
}
mutable_unknown_fields
()
->
append
(
from
.
unknown_fields
());
}
void
Feedback
::
CopyFrom
(
const
Feedback
&
from
)
{
if
(
&
from
==
this
)
return
;
Clear
();
MergeFrom
(
from
);
}
bool
Feedback
::
IsInitialized
()
const
{
if
((
_has_bits_
[
0
]
&
0x00000003
)
!=
0x00000003
)
return
false
;
return
true
;
}
void
Feedback
::
Swap
(
Feedback
*
other
)
{
if
(
other
!=
this
)
{
std
::
swap
(
id_
,
other
->
id_
);
std
::
swap
(
worker_
,
other
->
worker_
);
std
::
swap
(
_has_bits_
[
0
],
other
->
_has_bits_
[
0
]);
_unknown_fields_
.
swap
(
other
->
_unknown_fields_
);
std
::
swap
(
_cached_size_
,
other
->
_cached_size_
);
}
}
::
std
::
string
Feedback
::
GetTypeName
()
const
{
return
"loomcomm.Feedback"
;
}
// ===================================================================
bool
ClientMessage_Type_IsValid
(
int
value
)
{
switch
(
value
)
{
case
1
:
case
2
:
return
true
;
default:
return
false
;
}
}
#ifndef _MSC_VER
const
ClientMessage_Type
ClientMessage
::
DATA
;
const
ClientMessage_Type
ClientMessage
::
FEEDBACK
;
const
ClientMessage_Type
ClientMessage
::
Type_MIN
;
const
ClientMessage_Type
ClientMessage
::
Type_MAX
;
const
int
ClientMessage
::
Type_ARRAYSIZE
;
#endif // _MSC_VER
#ifndef _MSC_VER
const
int
ClientMessage
::
kTypeFieldNumber
;
const
int
ClientMessage
::
kDataFieldNumber
;
const
int
ClientMessage
::
kFeedbackFieldNumber
;
#endif // !_MSC_VER
ClientMessage
::
ClientMessage
()
:
::
google
::
protobuf
::
MessageLite
()
{
SharedCtor
();
// @@protoc_insertion_point(constructor:loomcomm.ClientMessage)
}
void
ClientMessage
::
InitAsDefaultInstance
()
{
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
data_
=
const_cast
<
::
loomcomm
::
DataPrologue
*>
(
::
loomcomm
::
DataPrologue
::
internal_default_instance
());
#else
data_
=
const_cast
<
::
loomcomm
::
DataPrologue
*>
(
&::
loomcomm
::
DataPrologue
::
default_instance
());
#endif
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
feedback_
=
const_cast
<
::
loomcomm
::
Feedback
*>
(
::
loomcomm
::
Feedback
::
internal_default_instance
());
#else
feedback_
=
const_cast
<
::
loomcomm
::
Feedback
*>
(
&::
loomcomm
::
Feedback
::
default_instance
());
#endif
}
ClientMessage
::
ClientMessage
(
const
ClientMessage
&
from
)
:
::
google
::
protobuf
::
MessageLite
()
{
SharedCtor
();
MergeFrom
(
from
);
// @@protoc_insertion_point(copy_constructor:loomcomm.ClientMessage)
}
void
ClientMessage
::
SharedCtor
()
{
_cached_size_
=
0
;
type_
=
1
;
data_
=
NULL
;
feedback_
=
NULL
;
::
memset
(
_has_bits_
,
0
,
sizeof
(
_has_bits_
));
}
ClientMessage
::~
ClientMessage
()
{
// @@protoc_insertion_point(destructor:loomcomm.ClientMessage)
SharedDtor
();
}
void
ClientMessage
::
SharedDtor
()
{
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
if
(
this
!=
&
default_instance
())
{
#else
if
(
this
!=
default_instance_
)
{
#endif
delete
data_
;
delete
feedback_
;
}
}
void
ClientMessage
::
SetCachedSize
(
int
size
)
const
{
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN
();
_cached_size_
=
size
;
GOOGLE_SAFE_CONCURRENT_WRITES_END
();
}
const
ClientMessage
&
ClientMessage
::
default_instance
()
{
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
protobuf_AddDesc_loomcomm_2eproto
();
#else
if
(
default_instance_
==
NULL
)
protobuf_AddDesc_loomcomm_2eproto
();
#endif
return
*
default_instance_
;
}
ClientMessage
*
ClientMessage
::
default_instance_
=
NULL
;
ClientMessage
*
ClientMessage
::
New
()
const
{
return
new
ClientMessage
;
}
void
ClientMessage
::
Clear
()
{
if
(
_has_bits_
[
0
/
32
]
&
7
)
{
type_
=
1
;
if
(
has_data
())
{
if
(
data_
!=
NULL
)
data_
->::
loomcomm
::
DataPrologue
::
Clear
();
}
if
(
has_feedback
())
{
if
(
feedback_
!=
NULL
)
feedback_
->::
loomcomm
::
Feedback
::
Clear
();
}
}
::
memset
(
_has_bits_
,
0
,
sizeof
(
_has_bits_
));
mutable_unknown_fields
()
->
clear
();
}
bool
ClientMessage
::
MergePartialFromCodedStream
(
::
google
::
protobuf
::
io
::
CodedInputStream
*
input
)
{
#define DO_(EXPRESSION) if (!(EXPRESSION)) goto failure
::
google
::
protobuf
::
uint32
tag
;
::
google
::
protobuf
::
io
::
StringOutputStream
unknown_fields_string
(
mutable_unknown_fields
());
::
google
::
protobuf
::
io
::
CodedOutputStream
unknown_fields_stream
(
&
unknown_fields_string
);
// @@protoc_insertion_point(parse_start:loomcomm.ClientMessage)
for
(;;)
{
::
std
::
pair
<
::
google
::
protobuf
::
uint32
,
bool
>
p
=
input
->
ReadTagWithCutoff
(
127
);
tag
=
p
.
first
;
if
(
!
p
.
second
)
goto
handle_unusual
;
switch
(
::
google
::
protobuf
::
internal
::
WireFormatLite
::
GetTagFieldNumber
(
tag
))
{
// required .loomcomm.ClientMessage.Type type = 1;
case
1
:
{
if
(
tag
==
8
)
{
int
value
;
DO_
((
::
google
::
protobuf
::
internal
::
WireFormatLite
::
ReadPrimitive
<
int
,
::
google
::
protobuf
::
internal
::
WireFormatLite
::
TYPE_ENUM
>
(
input
,
&
value
)));
if
(
::
loomcomm
::
ClientMessage_Type_IsValid
(
value
))
{
set_type
(
static_cast
<
::
loomcomm
::
ClientMessage_Type
>
(
value
));
}
else
{
unknown_fields_stream
.
WriteVarint32
(
tag
);
unknown_fields_stream
.
WriteVarint32
(
value
);
}
}
else
{
goto
handle_unusual
;
}
if
(
input
->
ExpectTag
(
18
))
goto
parse_data
;
break
;
}
// optional .loomcomm.DataPrologue data = 2;
case
2
:
{
if
(
tag
==
18
)
{
parse_data:
DO_
(
::
google
::
protobuf
::
internal
::
WireFormatLite
::
ReadMessageNoVirtual
(
input
,
mutable_data
()));
}
else
{