public override void FillClone(OPSObject cloneO) { base.FillClone(cloneO); Cheese cloneResult = (Cheese)cloneO; cloneResult.name = this.name; cloneResult.age = this.age; }
public override void FillClone(OPSObject cloneO) { base.FillClone(cloneO); TestData cloneResult = (TestData)cloneO; cloneResult.text = this.text; cloneResult.value = this.value; }
public override void FillClone(OPSObject cloneO) { base.FillClone(cloneO); PizzaData cloneResult = (PizzaData)cloneO; cloneResult.cheese = this.cheese; cloneResult.tomatoSauce = this.tomatoSauce; }
/// /// <param name="cloneResult"></param> /// Fills the parameter "cloneResult" with all values from this object. public virtual void FillClone(OPSObject cloneResult) { cloneResult.typesString = this.typesString; cloneResult.key = this.key; cloneResult.spareBytes = new byte[this.spareBytes.Length]; this.spareBytes.CopyTo(cloneResult.spareBytes, 0); }
public override void FillClone(OPSObject cloneO) { base.FillClone(cloneO); BaseData cloneResult = (BaseData)cloneO; cloneResult.Id = this.Id; cloneResult.Name = this.Name; }
/// /// <param name="cloneResult"></param> /// Fills the parameter "cloneResult" with all values from this object. virtual public void FillClone(OPSObject cloneResult) { cloneResult.typesString = this.typesString; cloneResult.key = this.key; cloneResult.spareBytes = new byte[this.spareBytes.Length]; this.spareBytes.CopyTo(cloneResult.spareBytes, 0); }
void NotifyNewOPSObject(OPSObject o) { if (ApplyFilterQoSPolicies(o)) { long currentTime = System.DateTime.Now.Ticks; if (currentTime - timeLastDataForTimeBase > timeBaseMinSeparationTime || timeBaseMinSeparationTime == 0) { lastDeadlineTime = currentTime; timeLastDataForTimeBase = currentTime; sampleTime2 = sampleTime1; sampleTime1 = currentTime; data = o; if (data != null) { NewDataArrived(data); } lock (newDataEvent) { Monitor.PulseAll(newDataEvent); } } } }
/// Returns a new allocated deep copy/clone of this object. virtual public object Clone() { OPSObject cloneResult = new OPSObject(); FillClone(cloneResult); return(cloneResult); }
public override void FillClone(OPSObject cloneO) { base.FillClone(cloneO); LHCData cloneResult = (LHCData)cloneO; cloneResult.bearnaise = this.bearnaise; cloneResult.beef = this.beef; cloneResult.p = new List<pizza.PizzaData>(this.p.Count); this.p.ForEach((item) => { cloneResult.p.Add((pizza.PizzaData)item.Clone()); }); }
protected void Write(OPSObject opsObject) { if (opsObject == null) { throw new CommException("Trying to send OPSObject that is null!"); } if (sendDataHandler == null) { Init(); } if (sendDataHandler == null) { return; } this.sampleTime2 = this.sampleTime1; this.sampleTime1 = System.DateTime.Now.Ticks; OPSMessage message = new OPSMessage(); opsObject.SetKey(this.key); message.SetData(opsObject); message.SetPublicationID(this.currentPublicationID); message.SetTopicName(this.topic.GetName()); message.SetPublisherName(this.name); //inProcessTransport.copyAndPutMessage(message); WriteByteBuffer buf = new WriteByteBuffer(this.bytes, Globals.MAX_SEGMENT_SIZE); try { OPSArchiverOut archiverOut = new OPSArchiverOut(buf, topic.GetOptNonVirt()); archiverOut.Inout("message", message); // If o has spare bytes, write them to the end of the buf if (opsObject.spareBytes.Length > 0) { buf.Write(opsObject.spareBytes, 0, opsObject.spareBytes.Length); } // Finish will fill in nrOf segments in all segments. buf.Finish(); int sizeToSend = buf.Position(); sendDataHandler.SendData(this.bytes, sizeToSend, this.topic); } catch (System.IO.IOException ex) { Logger.ExceptionLogger.LogException(ex); } IncCurrentPublicationID(); }
private bool ApplyFilterQoSPolicies(OPSObject o) { foreach (IFilterQoSPolicy filter in filterQoSPolicies) { if (!filter.ApplyFilter(o)) { //Indicates that this data sample NOT should be delivered to the application. return(false); } } return(true); }
public bool ApplyFilter(OPSObject o) { lock (lockThis) { foreach (string key in keys) { if (o.GetKey().Equals(key)) { return(true); } } return(false); } }
public bool ApplyFilter(OPSObject o) { lock(lockThis) { foreach (string key in keys) { if (o.GetKey().Equals(key)) { return true; } } return false; } }
public void SubscriberNewData(Subscriber sender, OPSObject data) { if (!(data is ParticipantInfoData)) return; ParticipantInfoData partInfo = (ParticipantInfoData)data; // Is it on our domain? if (partInfo.domain.Equals(participant.domainID)) { foreach (TopicInfoData tid in partInfo.subscribeTopics) { // We are only interrested in topics with UDP as transport if ( (tid.transport.Equals(Topic.TRANSPORT_UDP)) && (participant.HasPublisherOn(tid.name)) ) { udpSendDataHandler.AddSink(tid.name, partInfo.ip, partInfo.mc_udp_port); } } } }
public void SubscriberNewData(Subscriber sender, OPSObject data) { if (!(data is ParticipantInfoData)) { return; } ParticipantInfoData partInfo = (ParticipantInfoData)data; // Is it on our domain? if (partInfo.domain.Equals(participant.domainID)) { foreach (TopicInfoData tid in partInfo.subscribeTopics) { // We are only interrested in topics with UDP as transport if ((tid.transport.Equals(Topic.TRANSPORT_UDP)) && (participant.HasPublisherOn(tid.name))) { udpSendDataHandler.AddSink(tid.name, partInfo.ip, partInfo.mc_udp_port); } } } }
public override void FillClone(OPSObject cloneO) { base.FillClone(cloneO); ExtraAllt cloneResult = (ExtraAllt)cloneO; cloneResult.extraCheese = this.extraCheese; cloneResult.nrOfMushRooms = this.nrOfMushRooms; cloneResult.meetQuality = this.meetQuality; cloneResult.timestamp = this.timestamp; cloneResult.timeBakedHours = this.timeBakedHours; cloneResult.timeBakedSeconds = this.timeBakedSeconds; cloneResult.description = this.description; cloneResult.cheese_ = (pizza.special.Cheese)this.cheese_.Clone(); cloneResult.bools = new List<bool>(this.bools); cloneResult.bytes = new List<byte>(this.bytes); cloneResult.ints = new List<int>(this.ints); cloneResult.longs = new List<long>(this.longs); cloneResult.floats = new List<float>(this.floats); cloneResult.doubles = new List<double>(this.doubles); cloneResult.strings = new List<string>(this.strings); cloneResult.cheeses = new List<pizza.special.Cheese>(this.cheeses.Count); this.cheeses.ForEach((item) => { cloneResult.cheeses.Add((pizza.special.Cheese)item.Clone()); }); }
public void WriteAsOPSObject(OPSObject opsObject) { Write(opsObject); }
// This is the default implementation for when new data has arrived. // The method can be overriden to implament a type safe callback event. protected virtual void NewDataArrived(OPSObject o) { // Use a delegate to send data to interested receivers. newDataDefault(this, o); }
void NotifyNewOPSObject(OPSObject o) { if (ApplyFilterQoSPolicies(o)) { long currentTime = System.DateTime.Now.Ticks; if (currentTime - timeLastDataForTimeBase > timeBaseMinSeparationTime || timeBaseMinSeparationTime == 0) { lastDeadlineTime = currentTime; timeLastDataForTimeBase = currentTime; sampleTime2 = sampleTime1; sampleTime1 = currentTime; data = o; if (data != null) NewDataArrived(data); lock (newDataEvent) { Monitor.PulseAll(newDataEvent); } } } }
private bool ApplyFilterQoSPolicies(OPSObject o) { foreach (IFilterQoSPolicy filter in filterQoSPolicies) { if (!filter.ApplyFilter(o)) { //Indicates that this data sample NOT should be delivered to the application. return false; } } return true; }
public bool ApplyFilter(OPSObject o) { newUpdate = true; return(true); }
protected void Write(OPSObject opsObject) { if (opsObject == null) { throw new CommException("Trying to send OPSObject that is null!"); } if (sendDataHandler == null) { Init(); } if (sendDataHandler == null) { return; } this.sampleTime2 = this.sampleTime1; this.sampleTime1 = System.DateTime.Now.Ticks; OPSMessage message = new OPSMessage(); opsObject.SetKey(this.key); message.SetData(opsObject); message.SetPublicationID(this.currentPublicationID); message.SetTopicName(this.topic.GetName()); message.SetPublisherName(this.name); //inProcessTransport.copyAndPutMessage(message); WriteByteBuffer buf = new WriteByteBuffer(this.bytes, Globals.MAX_SEGMENT_SIZE); try { OPSArchiverOut archiverOut = new OPSArchiverOut(buf); archiverOut.Inout("message", message); // If o has spare bytes, write them to the end of the buf if (opsObject.spareBytes.Length > 0) { buf.Write(opsObject.spareBytes, 0, opsObject.spareBytes.Length); } // Finish will fill in nrOf segments in all segments. buf.Finish(); int sizeToSend = buf.Position(); sendDataHandler.SendData(this.bytes, sizeToSend, this.topic); } catch (System.IO.IOException ex) { Logger.ExceptionLogger.LogException(ex); } IncCurrentPublicationID(); }
protected override void NewDataArrived(OPSObject o) { if (newData != null) newData(this, (TestData)o); }
public override void FillClone(OPSObject cloneO) { base.FillClone(cloneO); BaseData cloneResult = (BaseData)cloneO; cloneResult.baseText = this.baseText; }
public bool ApplyFilter(OPSObject o) { newUpdate = true; return true; }
public override void FillClone(OPSObject cloneO) { base.FillClone(cloneO); CapricosaData cloneResult = (CapricosaData)cloneO; cloneResult.mushrooms = this.mushrooms; }
protected override void NewDataArrived(OPSObject o) { if (newData != null) newData(this, (ExtraAllt)o); }
/// Returns a new allocated deep copy/clone of this object. public virtual object Clone() { OPSObject cloneResult = new OPSObject(); FillClone(cloneResult); return cloneResult; }