Hi Skidrow406,
I'm not sure understand your question, but in my opion, u mean (see picture below) :
You have 2 schema (something like that) :
----
var schema = ["last_price", "time", "_change", "bid1vol", "bid1", "ask1", "ask1vol", "min", "max", "ref_price", "open_price", "stock_symbol", "ceiling" , "floor", "bid2vol", ...,"item_status"];
var schema2 = ["vnindex", "idxVol", "idxVal","idxchange", "item_status"];
-----
---
I think u need created 2 class :
---
public class IndexProducer
{
private IExternalFeedListener _listener;
public IndexProducer(Int32 vnIndex, Int64 TotalShare, Int64 TotalValue, Int32 idxTime)
{
...
}
public void SetFeedListener(IExternalFeedListener listener)
{
lock (this)
{
_listener = listener;
}
}
public IDictionary GetCurrentValues(bool fullData)
{
lock (this)
{
IDictionary eventData = new Hashtable();
if (fullData)
{
...
}
return eventData;
}
}
}
----
public class ExternalFeedProducer
{
...
private IExternalFeedListener _listener;
public ExternalFeedProducer(string name, Int32 openPrice, ... string status)
{
...
}
public string GetItemName() {
return _itemName;
}
public void SetFeedListener(IExternalFeedListener listener) {
lock (this) {
_listener = listener;
}
}
public IDictionary GetCurrentValues(bool fullData)
{
ReadINIFile settings;
lock (this)
{
IDictionary eventData = new Hashtable();
...
if (fullData)
{
...
}
return eventData;
}
}
}
And then
-------
public void Run()
{
...
//for each stock
for (int i=0; i < nStock; i++)
{
//create an IDictionary to store all field name/value pairs associate the IDictionary to the stock name in _snaps
string itemName= "item" + (i + 1);
ExternalFeedProducer myProducer = new ExternalFeedProducer(itemName, _openprices
, .., _status);
_stockGenerators[itemName]= myProducer;
//call onEvent on the listener and send the IDictionary
_listener.OnEvent(myProducer.GetItemName(), myProducer.GetCurrentValues(true), true);
}
//for each Index
for (int i=0; i < nStock; i++)
{
//create an IDictionary to store all field name/value pairs associate the IDictionary to the stock name in _snaps
string itemName= "indexItem" + (i + 1);
IndexProducer myProducer = new IndexProducer (itemName,...);
_stockGenerators[itemName]= myProducer;
//call onEvent on the listener and send the IDictionary
_listener.OnEvent(myProducer.GetItemName(), myProducer.GetCurrentValues(true), true);
}
...
}
That's right?