EyesWeb XMI Forum http://forum.eyesweb.infomus.org/ |
|
Generic Output Pins http://forum.eyesweb.infomus.org/viewtopic.php?f=25&t=26 |
Page 1 of 1 |
Author: | Nick Gillian [ 07 Jul 2008, 16:57 ] |
Post subject: | Generic Output Pins |
Hi all, I am currently developing a block with multiple dynamic input and output pins (i.e. the user can click on the block at design time and set the number of I/O pins to 10 or 11 for example). I also want the input and output pins to be generic so that any data type can be connected during design time and the block will automatically change its configuration due to the type of data input. I have all ready managed to get dynamic generic input pins to work by setting the input signature to: Code: SetInput( pin::id( Id ) .name( "Int or Double Input" ) .description( "Input can either be an Int or Double" ) .catalog_id( EYW_KERNEL_CATALOG_ID ) .class_id( EYW_KERNEL_CATALOG_GENERIC_DATATYPE_ID ) ); and then using the std::nothrow option in the get_input_datatype< whateverDataType >( INPUT_ID, std::nothrow) which returns NULL if that data type is not connected to check what type of data type the user connects to the pin. I have a problem however with getting the output pins to be generic. I can successfully get a dynamic number of output pins to work, however (whether the pins are created dynamically or not), I cannot connect the generic output pin to any other type of block. I therefore cannot use any function such as get_output_datatype… as the pin is not connected to anything. Could someone please describe how to correctly create a generic output pin, like can be found in the Arithmetic block in EyesWeb version 5.0.1.4. Many thanks, Nick |
Author: | paolo [ 24 Sep 2008, 23:00 ] |
Post subject: | Re: Generic Output Pins |
This is the how you declare an output pin: SetOutput( pin::id( "your_output_id" ) .name( "The name of this pin" ) .description( "The description of this pin" ) .catalog_id( EYW_KERNEL_CATALOG_ID ) .class_id( EYW_KERNEL_CATALOG_GENERIC_DATATYPE_ID ) // .inherited_id( "an_input_id" ) ); the (optional) inherited_id field tells Eyw that the output type is the same as the specified input. Alternatively, you can use the inplace_id field (i.e., .inplace_id( "an_input_id" ) ); this tells EyesWeb that the specified output datatype is the same as the input (i.e., used both for reading and writing), thus, the type too is inherited from the input. Finally, if the type cannot be deduced from an input, you can use the SetOutputClass method from within the Init method, to tell Eyw which type you are actually using for that output (e.g, for an integer datatype use SetOutputClass( "your_output_id", EYW_KERNEL_CATALOG_ID, EYW_KERNEL_CATALOG_INT_ID ) ); Paolo |
Page 1 of 1 | All times are UTC + 1 hour [ DST ] |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |