Multiple outputs vs blobs

524 views
Skip to first unread message

Mike

unread,
Mar 27, 2012, 10:01:44 AM3/27/12
to IADS
I am writing a function that requires multiple outputs. I have been
reviewing your example program SampleFunctionMultiInMultiOut and also
your blob examples. Is there any advantage to using blobs over the
multiple output technique?

Thanks,
Mike

Mike

unread,
Mar 27, 2012, 10:15:08 AM3/27/12
to IADS
A follow-up question, if I am using blobs as input parameters to an
activex display, are there any special considerations if I am trying
to fetch every data sample? Also, are there any sample rate and/or
number of parameter limitations when fetching all data samples in an
activex display?

Thanks,
Mike

James Bretz

unread,
Mar 27, 2012, 11:07:13 AM3/27/12
to ia...@googlegroups.com
The blob technique is cleaner and easier to implement. Performance wise, it's faster. The non-blob technique requires a rather complex support class to implement. All in all, I recommend the blob technique

Jim

> --
> You received this message because you are subscribed to the Google Groups "IADS" group.
> To post to this group, send email to ia...@googlegroups.com.
> To unsubscribe from this group, send email to iads+uns...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/iads?hl=en.
>

James Bretz

unread,
Mar 27, 2012, 11:18:13 AM3/27/12
to ia...@googlegroups.com
Actually, I don't recommend using the blobs directly in a display, but their cracked equivalent derived parameter via the decom function. I'm pretty sure you are aware of this fact but I'm just making sure. Having said that, there is no hard limit for any of the displays when fetching data. It all depends on the power of your pc vs the data rate. On a modern pc, you'd be hard pressed to tax the system with data processing alone. Most of time, it's related to the density and complexity of your graphics objects. Data processing certainly plays a role, but the equation weighs more toward the graphics end.

If you give me a ballpark rate, I'd probably be able to tell you if you should be concerned,
Jim

Mike

unread,
Mar 27, 2012, 1:32:55 PM3/27/12
to IADS

Thanks.


> The blob technique is cleaner and easier to implement. Performance wise, it's faster. The non-blob technique requires a rather complex support class to implement. All in all, I recommend the blob technique
>

I actually started with the blob technique until I looked over the
multiple output example and began to question my method. So, first
once, I decide to ask the question before changing directions!

James Bretz

unread,
Mar 27, 2012, 1:36:30 PM3/27/12
to ia...@googlegroups.com
lol that would be a first for me too ;)
Jim

--------------------------------------------------
From: "Mike" <michael...@navy.mil>
Sent: Tuesday, March 27, 2012 10:32 AM
To: "IADS" <ia...@googlegroups.com>
Subject: [IADS] Re: Multiple outputs vs blobs

Mike

unread,
Mar 27, 2012, 2:43:58 PM3/27/12
to IADS


> Actually, I don't recommend using the blobs directly in a display, but their cracked equivalent derived parameter via the decom function. I'm pretty sure you are aware of this fact but I'm just making sure. Having said that, there is no hard limit for any of the displays when fetching data. It all depends on the power of your pc vs the data rate. On a modern pc, you'd be hard pressed to tax the system with data processing alone. Most of time, it's related to the density and complexity of your graphics objects. Data processing certainly plays a role, but the equation weighs more toward the graphics end.
>
> If you give me a ballpark rate, I'd probably be able to tell you if you should be concerned,

We are talking in the neighborhood of 500-550 parameters (maybe more
at times) with the parameters having varying sample rates up to a high
of 806 samples/sec. Since I need to ensure I do not miss any samples,
I want to use the fetch every data sample techniques as well which
means over sampling the lower rate parameters. The display is
basically a tabular display with some 'realtime' areas showing some
counts and a table of results. Graphically, nothing intense, but a
lot of data ro process.

So, the tie in with the blob question, is I am considering a derived
algorithm, possibly run as an IAP, to generate the 6+ results for each
parameter as a blob and then just fetching those results in the
activex display for additional processing and display. My concern
is the number of parameters in this option is 3000+ parameters to
fetch after decoming the blobs. I think I can run at a much lower
rate, but still a lot of data to retrieve.

Thanks,
Mike


James Bretz

unread,
Mar 27, 2012, 3:37:51 PM3/27/12
to ia...@googlegroups.com
> We are talking in the neighborhood of 500-550 parameters (maybe more
> at times) with the parameters having varying sample rates up to a high
> of 806 samples/sec. Since I need to ensure I do not miss any samples,
> I want to use the fetch every data sample techniques as well which
> means over sampling the lower rate parameters. The display is
> basically a tabular display with some 'realtime' areas showing some
> counts and a table of results. Graphically, nothing intense, but a
> lot of data ro process.

Wow... that is quite a load. So essentially you're going to have an
algorithm that produces blobs packet with 550ish parameters at a sample rate
of 806. Yes if that's the magnitude then let me retract my other statement.
Maybe you should process these blobs in a custom display. The total sample
rate will probably well exceed 200k samples per second so in that case, stay
blob all the way to the display. Having 550 parameter of that sample rate
going all to one display is going to be a pretty big performance hit... on
the other hand, having a single blob parameter at 806 sps with 2k unit
length is probably doable.


> So, the tie in with the blob question, is I am considering a derived
> algorithm, possibly run as an IAP, to generate the 6+ results for each
> parameter as a blob and then just fetching those results in the
> activex display for additional processing and display. My concern
> is the number of parameters in this option is 3000+ parameters to
> fetch after decoming the blobs. I think I can run at a much lower
> rate, but still a lot of data to retrieve.

Yes, I see what you mean and I would avoid that 3000+ parameter idea to a
single display if at all possible. The reason why I mentioned to crack the
blobs with the decom function is because all the results can be used in
other non-custom displays.... but in this case, for performance sake, I
would say just send the whole 'bulk' down to the custom display and process
it en mass.

Having said that, if you need to use an element from the blob for another
display, you can pinpoint a number of decom derived functions for this
purpose.

Yep, I would go IAP and I would also use the "SetTriggerParam" directive to
force this function to be processed as a trigger based function (compute on
the occurrence of given parameter's value or better known as 'order
arrival'). Using this mechanism, you can ensure you've taken a good clean
snapshot of the entire array of incoming data from the PCM using the oldest
entry in major frame as the trigger (or whatever is appropriate based on the
PCM frame filling technique).

So how do you intend on getting that many input parameters into your
function? If you use the MultiIn technique, that will unfortunately prevent
you from using the Trigger technique above. Also, performance wise, it's a
lot slower than the MultiIn technique using dataGroups (as in the code
example). Notice that the helper function creates an individual parameter
for each data element (expensive).

We haven't actually put the two methods together to create bulk input
arguments from a list while working in the order arrival world (I'll add
that to the list). For something of this magnitude, the function line input
interface gets cumbersome, but in truth, there's no limit to how long your
equation is in the PD table. You could output your equation with the 500
arguments programmatically and then copy the function into the equation.
Honestly, at this point, I think it's your only choice given the magnitude
of the data processing. If you're constrained on time, I would go this
safest route. However, if you have time on your side, you could go the
multiIn/DataGroup route and then assess the performance hit on the Iap
server. If it's overwhelming the server then you can easily convert the
function to an argument based function.

I'm sure I've generated more questions than I've answered, but I'm glad you
asked before you implemented ;)
Jim

Mike

unread,
Mar 28, 2012, 8:17:41 AM3/28/12
to IADS
Thanks Jim!

> Wow... that is quite a load. So essentially you're going to have an
> algorithm that produces blobs packet with 550ish parameters at a sample rate
> of 806. Yes if that's the magnitude then let me retract my other statement.
> Maybe you should process these blobs in a custom display. The total sample
> rate will probably well exceed 200k samples per second so in that case, stay
> blob all the way to the display. Having 550 parameter of that sample rate
> going all to one display is going to be a pretty big performance hit... on

Yep, that's what I was afraid of!


> the other hand, having a single blob parameter at 806 sps with 2k unit
> length is probably doable.
>

I had not thought of a single blob approach! I was going to generate
500ish blobs, so would probably still have the same issue as above.

> So how do you intend on getting that many input parameters into your
> function?

I am provided the required list of parameters (that may change for
each flight) to process in a text file. So I was planning on reading
the parameters file and using the automation techniques to create the
IParameters inside the function.

> I 'm sure I've generated more questions than I've answered, but I'm glad you
> asked before you implemented ;)

You've given me some things to think about. Ideally, I would like to
do this in a custom display, fetching the 500+ parameters 'raw' values
and doing the processing there. I will try this first and see how big
the performance hit and save the blob approach as a backup. I am sure
I'll be asking more questions. I really appreciate the help.

Thanks,
Mike

James Bretz

unread,
Mar 28, 2012, 11:24:48 AM3/28/12
to ia...@googlegroups.com
Good luck and let me know how it turns out.

Jim

Sherman, Paul

unread,
Mar 30, 2012, 12:18:14 PM3/30/12
to ia...@googlegroups.com
I am just getting in to 'blob' data. Back in June of 2010, in a response to Mike,
James Bretz stated :

"There are quite a number of steps to return a blob. One suggestion is to try
going back over the tutorial PDF. There is an advanced section specifically
on Blobs. Make sure to follow each step because it's pretty tricky."

I've been through all of the docs that we have in house and that you have on-line
and I haven't been able to locate the "tutorial PDF" that has an advanced section
on Blobs. Can you tell me where it's located ?

James Bretz

unread,
Mar 30, 2012, 1:28:44 PM3/30/12
to ia...@googlegroups.com
Hi Paul,

It's possible you have an older version of the tutorial.

Go to http://iads.symvionics.com/downloads/ and download "Creating a Custom
Derived Function using VS2005". In the PDF file, look on page 22 "Returning
Multiple Results from your Custom Function". Read that section over.

If you have any questions, let us know,
Jim

--------------------------------------------------
From: "Sherman, Paul" <pshe...@smartronix.com>
Sent: Friday, March 30, 2012 9:18 AM
To: <ia...@googlegroups.com>
Subject: [IADS] IADS - blobs

Sherman, Paul

unread,
Apr 16, 2012, 12:14:25 PM4/16/12
to ia...@googlegroups.com
I've been working on an ActiveX application that display missile seeker data
and, as the final step, I've got to pass blobs of video data into the ActiveX
app via the get_ function that was created by the :

"View -> Class View -> Add -> Add Property

My question is, what is the type of the property that will be the type of the
parameter passed to the get_ function ?

James Bretz

unread,
Apr 16, 2012, 12:58:44 PM4/16/12
to ia...@googlegroups.com
Hi Paul,

Good question.

Unfortunately, at this point in time, Iads won't allow you to create a
"blob" property in order to connect the data (like all the other common data
types). This is probably due to shortsightedness on our side. I suppose we
were thinking that if you were processing blobs, you probably wanted to
process every data sample (in a streaming fashion). That may not be true if
you are willing to let some of the video frames pass by without being
displayed (and might be desirable in some instances).

Consequentially, it's going to make the programming job a bit more involved.
If you want to send blob data to your display, you will have to use the
"IAcceptIadsParameter" and "ISynchronizeOutput" interfaces. I just looked on
the web site and found that the VS2005 C++ example does not include the
"SampleEveryDataPoint" class. Not good.

Let me attach it to this post, but we need to get it up on the web site
asap.

Read through the code and see if it makes sense. If you're not accustomed to
implementing interfaces in C++/Com then it might be a bit of a challenge. If
you can send me your zipped up project (again privately jim at iads-soft dot
com), I can probably add all the necessary code and send it back.

If you can't send me the project, then I can step you through adding the
code. It shouldn't take too long,
Jim


--------------------------------------------------
From: "Sherman, Paul" <pshe...@smartronix.com>

Sent: Monday, April 16, 2012 9:14 AM
To: <ia...@googlegroups.com>
Subject: [IADS] Another blob related question

SampleEveryDataPointClass.zip

bkelly

unread,
Apr 16, 2012, 1:25:51 PM4/16/12
to IADS
Please allow me to jump in.
I work with Paul and our goal is to display video data from the
telemetry stream.

There are about 694 pixel elements in each subframe of data. Each
pixel is 14 bits in length and represents a monochrome brightness
level. The subframe rate is just a bit slower than one per
milliseconds. I have written an application that runs on the G2. It
collects all the video data and sends it out to IADS in a single TCP
packet, one per millisecond. (There are many other packets, but ignore
them for now.) The 14 bit pixels are dropped into the 16 bit elements
of the array, leaving the upper two bits always zeroes. That packet
is defined to IADS as having the standard header and one blob
parameter. The blob consists of an array of 695 sixteen bit
parameters. In the first 16 bits, after the tag number and size in
bytes, I place the current SFID number (it counts from 0 to 15).
Beginning with the second 16 bits, I place each video pixel. Then the
TCP packet is shipped off to IAD.

We need an ActiveX utility to display this data. (or we think we do,
open to suggestions.) I am suspecting, and hoping, that the blob can
be dropped on a properly configurred ActiveX display and it will get,
effectively, an array of 16 bit parameters. The ActiveX should look
at the first 16 bits, get the SFID and know where the following pixels
belong on the screen. Then it should throw the pixels at the memory
array and display the updated memory array.

At least, that is my thought.

About a year ago I carried on a lengthy discussion about this with
Mike or Mike, as I recall. (My computer was reloaded without notice
and my emails were lost). In that discussion, we concluded that
rather than sending 694 separate parameters, a blob would be much
better.

When Paul drops the blob on his ActiveX display, the sixteen bit
parameters all start with non zero bits, such as 0x6001. When the
data is examined with the blob viewer, it is found to be as expected.

So, at this point, what is the best path to get the pixels on the
screen?

Thanks for your time.



James Bretz

unread,
Apr 16, 2012, 1:36:11 PM4/16/12
to IADS
You're definitely taking the right approach (custom Ax display)... and yes
in this case we probably want to process "every data point" to ensure that
we get all the individual scan lines.

Check out the code I sent. If it's confusing then try to send me the zipped
up display project (in private email). I can easily get the code to the
point where you have a pointer to the 16 bit data payload. At that point
you'll have to bitslice the data and draw it to the appropriate scan line on
the screen. We can probably help with that as well if you get stuck.

If it helps, you can just send me the h/cpp file from the ActiveX control. I
don't actually need the entire project. I can build up a test project and
inject in your existing code and then add all the "every data sample" items.
Jim


--------------------------------------------------
From: "bkelly" <goo...@bkelly.ws>
Sent: Monday, April 16, 2012 10:25 AM
To: "IADS" <ia...@googlegroups.com>
Subject: [IADS] Re: Another blob related question

Kelly, Michael Civ USAF ACC 83 FWS/DO4

unread,
Apr 16, 2012, 4:05:07 PM4/16/12
to ia...@googlegroups.com, Sherman, Paul CTR USAF ACC 83 FWS/DO4, b...@bkelly.ws
Hello James,

I received an email from you, but here is the attachment. From the google
site I expected some code. Please reply to all so Paul will get it, and in
case the Air force blocks it, I will get it at home.

Bryan Kelly
Wyle Systems Analyst
83FWS/DO4
1287 Florida Ave
Tyndall AFB FL 32402
Phone: 850-283-8667

Sherman, Paul

unread,
May 8, 2012, 12:20:26 PM5/8/12
to ia...@googlegroups.com
The story, to date, goe like this. I created an ActiveX class named SeekerView. I then took the
SampleEveryPoint class and folded in the IAcceptIadsParameter and ISynchronizeOutput classes.

After correcting the compiler errors due to typos, I'm left with the following :

c:\..\atlcom.h (1994) : error C2259 : 'ATL::CComObject<Base>' : cannot instantiate abstract class
with
[
Base=CSeekerView
]
due to following members :
'HRESULT IAcceptIadsParameters::get_AttachPointDepth(long, long *)' : is abstract
c:\...\iads.h(1607) : see declaration of 'IAcceptIadsParameter::get_AttachPointDepth'
'HRESULT IAcceptIadsParameters::RemoveAll(void)' : is abstract
c:\...\iads.h(1631) : see declaration of 'IAcceptIadsParameter::RemoveAll'
'HRESULT ISynchronizeOutput::Put_IsRealTime(VARIANT_BOOL)' : is abstract
c:\...\iads.h(1890) : see declaration of 'ISynchronizeOutput::put_IsRealTime'
c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\atlcom.h(1983) :
while compiling class template member function 'HRESULT ATL::CComCreator<T1>::CreateInstance(void *,const IID &,LPVOID *)'
with
[
T1=ATL::CComObject<CSeekerView>
]
c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\atlcom.h(2086) : see reference to class template instantiation 'ATL::CComCreator<T1>' being compiled
with
[
T1=ATL::CComObject<CSeekerView>
]
c:\program files (x86)\microsoft visual studio 10.0\vc\atlmfc\include\atlcom.h(2082) : while compiling class template member function 'HRESULT ATL::CComCreator2<T1,T2>::CreateInstance(void *,const IID &, LPVOID *)'
with
[
T1=ATL::CComCreator<ATL::CComObject<CSeekerView>>,
T2=ATL::CComCreator<ATL::CComAggObject<CSeekerView>>
]
c:\...\seekerview.h(412) : see reference to class template instantation 'ATL::CComCreator2<T1,T2>' being compiled
with
[
T1=ATL::CComCreator<ATL::CComObject<CSeekerView>>,
T2=ATL::CComCreator<ATL::CComAggObject<CSeekerView>>
]

Please tell me I put a colon where a semicolon should be.

- Paul


James Bretz

unread,
May 8, 2012, 12:56:19 PM5/8/12
to ia...@googlegroups.com
Hi Paul,

Looks like you are missing some functions. Each time it says "function is abstract", it means you didn't implement that function is your code. In the latest example project, the everyDataPoint class has steps numbered 1 though 20 something. Make sure you follow each step.

Jim

Sherman, Paul

unread,
May 14, 2012, 5:20:35 PM5/14/12
to ia...@googlegroups.com
I've got my ActiveX app compiling, with the augmentations from SampleEveryDataPoint. When I run it, I can drag the parmeter value over to the ActiveX app and a list of the property values pop up. I drag the parameter into the "AttachPoint1" property, the property list disappears but nothing else happens and none of my breakpoints, from the SampleEveryDataPoint, are hit.


My next step in debugging is to suspect my homemade .iadsData file. If I feed the .iadsData file, with the .iadsIndex file in the same directory, to the "IADS DATA VIEWER", it seems to present the data successfully. From my expermentation, it appears that with the IADS Local-Mode ClientWorkStation, the .iadsData files has a 1024 byte header with a string "IadsDataFileVersionX.X and some other data depending on the type of data in the file. I copied the 1024 bytes, from an existing video file, with dummy data, to a new file and then appended real video data that fit our format. So, my first question is :

1) I've got 695 - 16 bit words of data in a blob. Are there bytes in the 1024 header that need to be set for this ? Such as Sample Rate, Start Time and Stop Time.

2) I noticed, in my experimentation, that Iads has a unique format for floating point numbers in 32 bit words. Is there a special format for 16 bit unsigned intergers ?

3) The S01_VIDEO.iadsData file is accompanied by a S01_VIDEO.iadsIndex file. What
is the purpose and format of this file ?



In the Configuration tool - ParameterDefaults values for S01_VIDEO are :

In Parameter Defaults column - Export
In Parameter column - S01_VIDEO
In Parameter Type column - blob
In Width column - 1
In Data Source Type column - Tpp
In Update Rate column - refuses to allow value to be entered

In the Configuration tool - Test - Blob Definitions are :

In BlobName column - S01_VIDEO
In FieldName column - VideoData
In Start Bit column - 0
In Stop Bit column - 11119
In IadsType column - int
In Source Type column - uint16


- Thanks,
Paul



Michael Jones

unread,
May 14, 2012, 5:38:43 PM5/14/12
to ia...@googlegroups.com
Hello Paul,

You can test your generated data file by dropping that parameter onto a stripchart.  If it doesn't work there, you are likely correct that there is something wrong with the file you generated.

Let us know if it works in a stripchart success or failure may provide a clue.

.iadsIndex Files are only used for Aperiodic Data (non-synchronous) or Multi-segment Periodic Data (gaps of 'missing' data)

---------

For generating IADS Data Files, I recommend using the API we provide.

http://iads.symvionics.com/programs.html
Under the API: section
Get the IADS Data File Interface

An alternative to the API is the PostTest Data Server application which has the ability to import from simple CSV files. When the import operation is complete it will generate a synchronous dataset at a specified sample rate.

Mike

Sherman, Paul

unread,
May 15, 2012, 12:04:25 PM5/15/12
to ia...@googlegroups.com
Mike :

The Blob Viewer (in IADS) and the IADS Data Viewer both see the S01_VIDEO.iadsData file
and display the appropriate values. In both apps, the values are shown with reverse byte endian.
So, the sixteen bit value 0X03C0 show up as C0 03 in both. The strip chart is flatlined at 0 even
after I modified the type and range.

The 1024 byte header has the non-zero values :
"IadsDataFileVersion1.2" in bytes 0 .. 21
"h" in byte 81
'U' in byte 86
"n" in byte 96

After that, I write the frame counter (0 - 15) in the first unsigned short word of an array of 695
unsigned short words and fill the remained with video data.

- Thanks,
Paul

________________________________
--
You received this message because you are subscribed to the Google Groups "IADS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/iads/-/BlNpHDGWUNQJ.

Michael Jones

unread,
May 15, 2012, 12:54:26 PM5/15/12
to ia...@googlegroups.com
Since the Stripchart is flatlined, I'm going to make a bet that something is not correctly laid out in your reverse engineered datafile.

You should have access to at the PostTest Data Server; Bryan Kelly might know where its installed.  It would be a simple matter to create data files using that app to Import a CSV file of your video data. 

Mike

James Bretz

unread,
May 15, 2012, 2:41:15 PM5/15/12
to ia...@googlegroups.com
Paul,

The PC is little-endian so you will see the bytes in reverse order. The
stripchart always displays 0 for a raw blob parameter. You would have to use
the Decom function using the blob as an input to pull out an individual
element. The data file header contains information about the size of the
blob, whether it's aperiodic or not, sampleRate, dataType, startTime,
version, etc. If you want a clean data file, it's best to use the API that
Mike noted.

The good news is that if the Blob viewer is showing data then your reverse
engineered parameter is at least partially correct... the bad news is that
means your ActiveX display is missing some code.

Put a break on the "Add" function. If it doesn't hit there then most likely
you forgot to add the "IAcceptIadsParameter" interface to the
"BEGIN_COM_MAP" section of the code (and probably missed some other
interfaces). Consult the latest SampleEveryDataPoint.h file and make sure
you didn't skip steps 1,2,3,4,5&6

Jim

--------------------------------------------------
From: "Sherman, Paul" <pshe...@smartronix.com>
Sent: Tuesday, May 15, 2012 9:04 AM
To: <ia...@googlegroups.com>
Subject: RE: [IADS] Re: .iadsData and .iadsIndex file formats

Sherman, Paul

unread,
May 16, 2012, 11:21:29 AM5/16/12
to ia...@googlegroups.com
Jim and/or Mike :

I've gone over the merge of my SeekerView class with the SampleEveryDataPoint code
and it looks like I've got everything. Here's my current situation/problem. In the debugger,
I drag the blob data parameter into my ActiveX app and I get a property menu that includes
"Seeker Data" which is the string that I used inplace of "AttachPoint1". When I click on
"Seeker Data", the debugger goes to function "Item" In the first "if" statement, that
compares AttachPointNameOrIndex.vt with VT_I4, the debugger shows .vt equal to 8.
Since I'm handling a B_STR, I changed VT_I4 to VT_BSTR. But on the next line

LONG index = AttachPointNameorIndex.lVal

the return value assigned to index is a very large random interger value and since it's not equal to 0,
it returns E_INVALIDARG.
- Paul


________________________________

Myers, Darrell G CTR USAF AFMC 412 TW/ENR

unread,
May 16, 2012, 12:20:48 PM5/16/12
to ia...@googlegroups.com

Hi Paul,

The following code snippet might help you out. If the .vt you are getting
is equal to 8 then you are in fact getting a BSTR. You just need to access
the bstrVal field of the VARIANT.

Look at the code below and see how each type is handled differently.

Hope this helps,
Greg

----------------------------------------------------------
if ( AttachPointNameOrIndex.vt == VT_I4 )
{
LONG index = AttachPointNameOrIndex.lVal;

// check if in range of mParameters here... return E_INVALIDARG;
if out of bounds..
if ( index < 0 || (index >= (long)m_AttachPointList.size()) )
return E_INVALIDARG;

attachPointIndex = index;
}
else if ( AttachPointNameOrIndex.vt == VT_BSTR)
{
for( register long i=0; i<(long)m_AttachPointList.size();
i++ )
{
if (
wcscmp(m_AttachPointList[i]->Name(),AttachPointNameOrIndex.bstrVal) == 0 )
{
attachPointIndex = i;
break;
}
}
}
else
return E_INVALIDARG;

-----Original Message-----
From: ia...@googlegroups.com [mailto:ia...@googlegroups.com] On Behalf Of
Sherman, Paul
Sent: Wednesday, May 16, 2012 8:21 AM
To: ia...@googlegroups.com

James Bretz

unread,
May 16, 2012, 12:52:28 PM5/16/12
to ia...@googlegroups.com
Paul/Greg,

Looks like I introduced a bug into the example code. Sorry about that. Yes,
the function should be able to handle both types VT_BSTR and VT_I4. The
strange part is that the parameter will still get attached (at least in my
version of Iads) on drop. After the Item is called, it calls my "Add"
function. That's probably why I didn't notice the error.

I'll add the additional code and post it soon.... but basically, just do as
Greg suggested. Compare the BSTR value to your attach point name, and if it
matches then return it's reference (as the example code does),
Jim

--------------------------------------------------
From: "Myers, Darrell G CTR USAF AFMC 412 TW/ENR"
<Darrell....@edwards.af.mil>
Sent: Wednesday, May 16, 2012 9:20 AM
To: <ia...@googlegroups.com>
Subject: RE: [IADS] Run time situation for SampleEveryDataPoint

James Bretz

unread,
May 16, 2012, 1:37:05 PM5/16/12
to ia...@googlegroups.com
Ok, here's the corrected code for the SampleEveryDataPoint class:

// Step 16: Implement Item function from the IAcceptIadsParameter
interface
// The Iads container will call this function to retrieve the parameter at
a given index
STDMETHODIMP Item( /*[in]*/ VARIANT AttachPointNameOrIndex,
/*[in,optional,defaultvalue(0)]*/ long AttachPointDepthIndex,
/*[out,retval]*/ IParameter** ppItem )
{
// Handle queries of our parameter list of type VT_I4 (zero based index)
and VT_BSTR (name of attachPoint)
if ( AttachPointNameOrIndex.vt == VT_I4 )
{
LONG index = AttachPointNameOrIndex.lVal;

// Check if requested index is in range of parameter attachments.
Return E_INVALIDARG if out of bounds..
if ( index < 0 || index > 0 ) return E_INVALIDARG;

// Now return a reference to our parameter
*ppItem = mParameters[index];
if ( mParameters[index] ) mParameters[index]->AddRef(); // Add a ref
count so it doesn't get deleted
return S_OK;
}
else if ( AttachPointNameOrIndex.vt == VT_BSTR )
{
// Get the index from the AttachPointName
if ( wcscmp(AttachPointNameOrIndex.bstrVal,L"EveryDataPoint") == 0 )
{
*ppItem = mParameters[0];
if ( mParameters[0] ) mParameters[0]->AddRef(); // Add a ref count
so it doesn't get deleted
return S_OK;
}
}

return E_FAIL;
}

// Step 17: Implement Remove function from the IAcceptIadsParameter
interface
// The Iads container will call this function to remove a parameter at a
given index
STDMETHODIMP Remove( /*[in]*/ VARIANT AttachPointNameOrIndexOrObject,
/*[in,optional,defaultvalue(0)]*/long AttachPointDepthIndex ) // ?? by [in]
VARIANT indexOrName???
{
if ( AttachPointNameOrIndexOrObject.vt == VT_I4 )
{
LONG index = AttachPointNameOrIndexOrObject.lVal;

// Check if requested index is in range of parameter attachments.
Return E_INVALIDARG if out of bounds..
if ( index < 0 || index > 0 ) return E_INVALIDARG;

if ( mParameters[0] != NULL )
{
mParameters[index]->Release(); // Release our reference count to
the parameter
mParameters[index] = NULL; // Set the parameter to NULL
}
return S_OK;
}
else if ( AttachPointNameOrIndexOrObject.vt == VT_BSTR )
{
// Get the index from the AttachPointName
if ( wcscmp(AttachPointNameOrIndexOrObject.bstrVal,L"EveryDataPoint")
== 0 )
{
mParameters[0]->Release(); // Release our reference count to the
parameter
mParameters[0] = NULL; // Set the parameter to NULL
}
}

return E_FAIL;
}

--------------------------------------------------
From: "James Bretz" <j...@iads-soft.com>
Sent: Wednesday, May 16, 2012 9:52 AM
To: <ia...@googlegroups.com>
Subject: Re: [IADS] Run time situation for SampleEveryDataPoint

Brett Mather

unread,
Jun 7, 2019, 11:13:00 PM6/7/19
to IADS
I know this thread is from years ago, but I'm interested in returning multiple parameters from a custom DLL in C#.  The PDF tutorial for C# doesn't seem to cover multiple outputs or blobs.  I see something about it in the C++ version so I imagine it should also be possible in C#.  Any ideas where I can find this?

Brett

Adam Chant

unread,
Jun 10, 2019, 11:44:31 AM6/10/19
to ia...@googlegroups.com

Brett,
One of our developers will look the C++ code over and reply with the changes for C#.
The process should generally be the same, in that you will have to create a blob as output, but how the necessary Arrays are handled in C# may be a little different.
Thank you,

 

Adam Chant
Symvionics, Inc.
IADS Application Engineer
(661) 273-7003 x 210

To unsubscribe from this group and stop receiving emails from it, send an email to iads+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/iads/31a48f2b-e469-42e2-9afa-95625a82a537%40googlegroups.com.

James Bretz

unread,
Jun 10, 2019, 2:32:06 PM6/10/19
to ia...@googlegroups.com

Brett,

 

I’m not sure if this has ever been done before in C# honestly. You’d be breaking new ground.

 

Essentially we would need to figure out how to mimic the C++ code in the tutorial to return a blob (see below).

 

So you’d need to allocate an array of ‘bytes’, the inject the size of the blob (in bytes) into the first 4 byte field, the pack

in the N arguments into the array, and return that array.

 

I’m not sure how to do this in C#, but maybe you do.

 

If anyone on the group has done this before, can you post a code snippet?

Jim

 

 

      // Get a pointer to the safeArray data that we allocated in the "initialization stage" above

      BYTE* sa;

      ::SafeArrayAccessData( mSA, (void**)&sa );

 

      // Now access the first 4 byte integer so we can inject the Blob size (in bytes). This step will become vital when variable size blobs are implemented

      unsigned __int32* blobSizeInBytes = (unsigned __int32*)sa;

 

      // Set the blob size in bytes

      *blobSizeInBytes = mBlobSizeInBytes;

 

      // Now let's inject the data into the remaining part of the Blob.

      // Get a pointer to the payload portion of the Blob (starting at 5th byte)

      float* payloadValues = (float*)(sa + sizeof(unsigned __int32));

 

      // Set arg2 and arg3 into the blob payload (array), plus their sum, product, and ratio

      payloadValues[0] = (float)arg2; 

      payloadValues[1] = (float)arg3;

      payloadValues[2] = (float)(arg2+arg3); 

      payloadValues[3] = (float)(arg2*arg3);

      payloadValues[4] = (float)(arg2/arg3); 

 

      // Likewise, if you had your own internal function to compute the results, you could simply pass in the input args

      // and a reference to this array. Your function would simply write the result directly into the array

      // Make sure you maintain a consistent order to your outputs, because we'll have to extract them "one by one" later

      // CalculateMyResults( arg2, arg3, payloadValue );

 

      SafeArrayUnaccessData( mSA );

 

      // Finally, set the blob output type and reference the safeArray we just built

      dataOut->vt = VT_ARRAY|VT_UI1;

      dataOut->parray = mSA;

 

From: ia...@googlegroups.com [mailto:ia...@googlegroups.com] On Behalf Of Adam Chant


Sent: Monday, June 10, 2019 8:44 AM
To: ia...@googlegroups.com

Kathy Rodittis

unread,
Jun 10, 2019, 4:38:39 PM6/10/19
to ia...@googlegroups.com

Brett-

Below is a function that returns a blob in C#. To access the different pieces you need to use our DECOM() function in a derived parameter, like so:

Decom( Class1Blob, 0, 4, 0,31,0,1,0)

Where Class1Blob is of ParamType = blob and DataSourceArgument = IadsFunctionBlob.Class1()

 

This would return the first 4 bytes of the data that comes from this function as an integer ( which you must also indicate in the ParamType column of the configuration editor ).

There might be better ways to handle the “byte transfer” between the return array and your native data in C#.  As Jim indicated, none of us here at IADS are C# programmers. 😉

-Kathy

 

namespace IadsFunctionBlob

{

  public class Class1 : IadsFunctionLib.IIadsFunction

  {

    byte[] dataOut;

    byte[] arraySize;

    byte[] intOut;

 

    public void Compute(ref object dataIn, ref object returnData )

    {

      Array dataInArray = (Array)dataIn;

 

      if (dataOut == null)

      {

        //first time through

        dataOut = new byte[32];

        arraySize = BitConverter.GetBytes((int)32);

        for (int i = 0; i < 4; ++i)

          dataOut[i] = arraySize[i];

      }

 

      for (int i = 1; i < 32/4; ++i)

      {

        intOut = BitConverter.GetBytes(i);

        for (int j = 0; j < 4; ++j)

          dataOut[i * 4 + j] = intOut[j];

      }

      returnData = dataOut;

Brett Mather

unread,
Jun 19, 2019, 10:22:23 AM6/19/19
to IADS
Thanks Kathy and Jim!

Kathy's example was enough to get me going. 

Brett

To unsubscribe from this group and stop receiving emails from it, send an email to ia...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "IADS" group.

To unsubscribe from this group and stop receiving emails from it, send an email to ia...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "IADS" group.

To unsubscribe from this group and stop receiving emails from it, send an email to ia...@googlegroups.com.

Reply all
Reply to author
Forward
0 new messages