/// <summary> /// Initializes a new instance of the <see cref="rclcs.RCLTopicNamesAndTypes"/> class. /// Takes the native_struct and marshalls the char** for topic_names and type_names /// </summary> /// <param name="native_struct">Native struct.</param> internal RCLTopicNamesAndTypes(rcl_topic_names_and_types_t native_struct) { string[] topics = MarshallingHelpers.PtrToStringArray(native_struct.topic_names); string[] types = MarshallingHelpers.PtrToStringArray(native_struct.type_names); TopicNames = new List <string> (topics); TypeNames = new List <string> (types); }
/// <summary> /// Gets the topic names and their types in the system /// </summary> /// <returns>The topic names and types.</returns> /// <param name="RosNode">Ros node.</param> public override RCLTopicNamesAndTypes GetTopicNamesAndTypes(Node RosNode) { rcl_node_t native_handle = RosNode.NativeNode; rcl_topic_names_and_types_t data_handle = new rcl_topic_names_and_types_t(); int ret = rcl_get_topic_names_and_types(ref native_handle, ref data_handle); //TODO Evaluate return value RCLTopicNamesAndTypes names_and_types = new RCLTopicNamesAndTypes(data_handle); ret = rcl_destroy_topic_names_and_types(ref data_handle); return(names_and_types); }
static extern int rcl_destroy_topic_names_and_types(ref rcl_topic_names_and_types_t topic_names_and_types);
static extern int rcl_get_topic_names_and_types(ref rcl_node_t node, ref rcl_topic_names_and_types_t topic_names_and_types);