The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 Is ColeSafeArray the only way ?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

cosy

Germany
Posts

Posted - 04/20/2004 :  04:40:54 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi,
I use, as in the sample code for Automation server in vc++, the "COlesafearray method" to send data to Origin.My application needs to send data in real time - the data rate being around 1ms. The number of data being sent is random. This poses a problem. Colesafearray requires that the array size be defined prior to filling of data in the array.
COleSafeArray csa;
DWORD bounds[] = {250, 18} ;
csa.Create(VT_R8, 2, bounds);
But I need a array thats "flexible",which needs no prior definition of its size as my datasize (i.e., the number of rows) varies each time
How do I overcome this.Is there anyway out.
I also found that this method is slower that the DDE transfer !
Thanks,
Deepak Samuel.

cpyang

USA
1406 Posts

Posted - 04/20/2004 :  10:50:33 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
1. COleSafeArray is the only way to pass data via COM, but I don't quite understand the reason of your question. The example we created was using dynamic array size, as can be seen below,


COleSafeArray csa;
DWORD bounds[2] = {m_nRows, m_nColumns};
csa.Create(VT_R8, 2, bounds);

long index[2];
UINT nLowerBound = nRowStart;
UINT nUpperBound = m_nRows + nRowStart;

for( UINT ii=0; ii < m_nColumns; ii++ )
{
for( UINT jj=0; jj < m_nRows; jj++ )
{
index[0]=jj;
index[1]=ii;

double fVal = 0.0;
if( ii == 0 )
fVal = nLowerBound + jj + 1;
else
fVal = ((nLowerBound + jj + 1) * 10 + ii) * rand()/RAND_MAX;

csa.PutElement(index, &fVal);
}
}

//Put generated numeric data into Origin
m_pClient->SetWorksheet(m_strWksName, csa, nRowStart);



2. As for slower speed then DDE, that might be a different issue. The updating of graphs might be the reason. In DDE, there were realtime mode where the graph will not be redrawn, but only the data is appended to the graph. This mechanism is not yet implemented in the COM data transfer, so you might be seeing a complete redraw of your graph which will be slower. Try making the graph minimized and see if speed is better.

CP




Edited by - cpyang on 04/20/2004 11:05:08 AM
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000