Hi Yogesh,

Please do not attach code files to your mail!
How is this problem related to one of the zeromq projects? Did you mean to post this to the protobuf mailing list instead?

//Kevin


On Do, Jun 9, 2016 at 6:07 , yogesh fulsunge <[email protected]> wrote:
Dear Team,

Please find my detailed problem:

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??

I have attached the proto file and C++ generated files.


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;
    }

Regards,
Yogesh
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to