View unanswered posts | View active topics It is currently 22 Aug 2017, 08:44



Reply to topic  [ 2 posts ] 
Generic Output Pins 
Author Message

Joined: 07 Jul 2008, 16:16
Posts: 3
Reply with quote
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


07 Jul 2008, 16:57
Profile

Joined: 21 Mar 2008, 22:35
Posts: 131
Reply with quote
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


24 Sep 2008, 23:00
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.