Dear Team,

I have a schema which handles repeated fields as shown below, i am facing
problems for Initialising the repeated fields.

In my schema, i have one Rack inside that i have multiple Shelf and inside
one shelf i have multiple Cards and Slots.

how to handle this kind of scenario in C++ APIs?

I generated the C++ code and for handling repeated fields it makes use of
google::protobuf::RepeatedPtrField  which i am not able to Initialise in
code.

can you help me with some sample C++ code to understand the usage? whether
i am using correct approach?? please let me know.

is there a way i can generate JSON data structure instead of Templates i
guess it will be easier can you please help me in this??


message RackRequest {
required ReqType req_type = 1;
required float rheight = 2;
required float rwidth = 3;
repeated Shelf shelf_in = 4;
enum ReqType {
SEARCH = 0;
ADD = 1;
MODIFY = 2;
DELETE = 3;
}
}

message RackResponse {
required RespType resp_type = 1;
required float rheight = 2;
required float rwidth = 3;
repeated Shelf shelf_in = 4;
enum RespType {
SEARCH = 0;
ADD = 1;
MODIFY = 2;
DELETE = 3;
}
required int32 result_code = 7;

}
message Shelf {
    required float sxaxis = 1;
    required float syaxis = 2;
    required float sheight = 3;
    required float swidth = 4;
    required bool sconfigurable = 5;
repeated Card card_in = 6;
repeated Slot slot_in = 7;
}
message Card {
    required float cxaxis = 1;
    required float cyaxis = 2;
    required float cheight = 3;
    required float cwidth = 4;
    required bool cconfigurable = 5;
    repeated int32 port = 6;
    }
message Slot {
    required float cxaxis = 1;
    required float cyaxis = 2;
    required float cheight = 3;
    required float cwidth = 4;
    required bool cconfigurable = 5;
    repeated int32 port = 6;
    }

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to