Pick Up information in java from SWIGTYPE_p_std_vectorT

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Pick Up information in java from SWIGTYPE_p_std_vectorT

jhonmartinez80
This post was updated on .
Sorry for my English.
I code from c to java code using swig and inside i have an object with method that returns a swigtype_p_std_vectorT...... but I need to read that vector.
How do I do it?


that vector include information from a switch, who have information inside of a ports to they have

switch have ports
All the options about my object
switch.ports() {Returns swigtype_p_std_vectorT_fluid_msg_of10_port_t.}

inside one port i have

struct ofp_phy_port {
    uint16_t port_no;
    uint8_t hw_addr[OFP_ETH_ALEN];
    char name[OFP_MAX_PORT_NAME_LEN]; /* Null-terminated */

    uint32_t config; /* Bitmap of OFPPC_* flags. */
    uint32_t state; /* Bitmap of OFPPS_* flags. */

    /* Bitmaps of OFPPF_* that describe features.  All bits zeroed if
     * unsupported or unavailable. */
    uint32_t curr; /* Current features. */
    uint32_t advertised; /* Features being advertised by the port. */
    uint32_t supported; /* Features supported by the port. */
    uint32_t peer; /* Features advertised by peer. */
};


i need to pick up these information
how i could be do that??
Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Pick Up information in java from SWIGTYPE_p_std_vectorT

Jake
In your SWIG interface files, you should %include "std_vector.i" and then declare a %template for the concrete type
you are using.

Look here: http://www.swig.org/Doc3.0/Library.html#Library_std_vector

I can't quite decode your type name but it would be something like:

%template(PortList) std::vector<fluid_msg::ofp_phy_port>;

-Jake

On Wed, Nov 23, 2016 at 7:06 AM, jhonmartinez80 <[hidden email]> wrote:
Sorry for my English.
I code from c to java code using swig and inside i have an object with
method that returns a swigtype_p_std_vectorT...... but I need to read that
vector.
How do I do it?


that vector include information from a switch, who have information inside
of a ports to they have

switch have ports
<http://swig.10945.n7.nabble.com/file/n15023/java.png>
switch.ports() {Returns swigtype_p_std_vectorT_fluid_msg_of10_port_t.}

inside one port i have

struct ofp_phy_port {
    uint16_t port_no;
    uint8_t hw_addr[OFP_ETH_ALEN];
    char name[OFP_MAX_PORT_NAME_LEN]; /* Null-terminated */

    uint32_t config; /* Bitmap of OFPPC_* flags. */
    uint32_t state; /* Bitmap of OFPPS_* flags. */

    /* Bitmaps of OFPPF_* that describe features.  All bits zeroed if
     * unsupported or unavailable. */
    uint32_t curr; /* Current features. */
    uint32_t advertised; /* Features being advertised by the port. */
    uint32_t supported; /* Features supported by the port. */
    uint32_t peer; /* Features advertised by peer. */
};


i need to pick up these information
how i could be do that??
Thanks




--
View this message in context: http://swig.10945.n7.nabble.com/Pick-Up-information-in-java-from-SWIGTYPE-p-std-vectorT-tp15023.html
Sent from the swig-user mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user


------------------------------------------------------------------------------

_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: Pick Up information in java from SWIGTYPE_p_std_vectorT

jhonmartinez80
In reply to this post by jhonmartinez80
Hi Jake
Thanks for ur help, im comming again because i didn´t understand the way that u say.

the code that i have in c
https://github.com/OpenNetworkingFoundation/libfluid_msg/blob/master/fluid/of10msg.cc   (Line 114)

https://github.com/OpenNetworkingFoundation/libfluid_msg/blob/master/fluid/of10msg.hh (Line 106)

Where i have to put the %template(Ports) std::vector<fluid_msg::of10_ports>??


and my makefile is here
https://github.com/OpenNetworkingFoundation/libfluid/blob/67129401211983144981647451ab70e90340398c/examples/java/Makefile

Again Thanks by your help. I'm new at this




Reply | Threaded
Open this post in threaded view
|

Re: Pick Up information in java from SWIGTYPE_p_std_vectorT

Jake
In the libfluid_msg_of10.i file referenced in your Makefile:


It looks like your actual signature is:

%template(Ports) std::vector<fluid_msg::of10::Port>;

And I believe you need to put it before the %include of the C headers.

-Jake



On Thu, Nov 24, 2016 at 7:23 AM, jhonmartinez80 <[hidden email]> wrote:
Hi Jake
Thanks for ur help, im comming again because i didn´t understand the way
that u say.

the code that i have in c
https://github.com/OpenNetworkingFoundation/libfluid_msg/blob/master/fluid/of10msg.cc
(Line 114)

https://github.com/OpenNetworkingFoundation/libfluid_msg/blob/master/fluid/of10msg.hh
(Line 106)

Where i have to put the %template(Ports)
std::vector<fluid_msg::of10_ports>??


and my makefile is here
https://github.com/OpenNetworkingFoundation/libfluid/blob/67129401211983144981647451ab70e90340398c/examples/java/Makefile

Again Thanks by your help. I'm new at this








--
View this message in context: http://swig.10945.n7.nabble.com/Pick-Up-information-in-java-from-SWIGTYPE-p-std-vectorT-tp15023p15025.html
Sent from the swig-user mailing list archive at Nabble.com.

------------------------------------------------------------------------------
_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user


------------------------------------------------------------------------------

_______________________________________________
Swig-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/swig-user
Reply | Threaded
Open this post in threaded view
|

Re: Pick Up information in java from SWIGTYPE_p_std_vectorT

jhonmartinez80
Many Many thanks

I solved!!