public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as Location; if (dest == null) { throw new ArgumentException("Can only copy to an object of the same type", "other"); } base.CopyTo(dest); if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (StatusElement != null) { dest.StatusElement = (Code <Hl7.Fhir.Model.Location.LocationStatus>)StatusElement.DeepCopy(); } if (NameElement != null) { dest.NameElement = (Hl7.Fhir.Model.FhirString)NameElement.DeepCopy(); } if (DescriptionElement != null) { dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopy(); } if (ModeElement != null) { dest.ModeElement = (Code <Hl7.Fhir.Model.Location.LocationMode>)ModeElement.DeepCopy(); } if (Type != null) { dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopy(); } if (Telecom != null) { dest.Telecom = new List <Hl7.Fhir.Model.ContactPoint>(Telecom.DeepCopy()); } if (Address != null) { dest.Address = (Hl7.Fhir.Model.Address)Address.DeepCopy(); } if (PhysicalType != null) { dest.PhysicalType = (Hl7.Fhir.Model.CodeableConcept)PhysicalType.DeepCopy(); } if (Position != null) { dest.Position = (Hl7.Fhir.Model.Location.PositionComponent)Position.DeepCopy(); } if (ManagingOrganization != null) { dest.ManagingOrganization = (Hl7.Fhir.Model.ResourceReference)ManagingOrganization.DeepCopy(); } if (PartOf != null) { dest.PartOf = (Hl7.Fhir.Model.ResourceReference)PartOf.DeepCopy(); } return(dest); }
/// <summary> /// PeerEventArgs Constructor /// </summary> /// <param name="parsed">a simple MessageParse</param> internal PeerEventArgs(dynamic parsed) { #if DEBUG FCP2Protocol.ArgsDebug(this, parsed); #endif lastGoodVersion = parsed.lastGoodVersion; opennet = parsed.opennet; myName = parsed.myName; identity = parsed.identity; location = parsed.location; testnet = parsed.testnet; version = parsed.version; physical = new PhysicalType(parsed); ark = new ArkType(parsed); dsaPubKey = new DsaPubKeyType(parsed); dsaGroup = new DsaGroupType(parsed); auth = new AuthType(parsed); @volatile = new VolatileType(parsed); metadata = new MetadataType(parsed); #if DEBUG parsed.PrintAccessCount(); #endif }
/// <summary> /// PeerEventArgs Constructor /// </summary> /// <param name="parsed">a simple MessageParse</param> internal PeerEventArgs(dynamic parsed) { #if DEBUG FCP2Protocol.ArgsDebug(this, parsed); #endif LastGoodVersion = parsed.lastGoodVersion; Opennet = parsed.opennet; MyName = parsed.myName; Identity = parsed.identity; Location = parsed.location; Testnet = parsed.testnet; Version = parsed.version; Physical = new PhysicalType(parsed); Ark = new ArkType(parsed); DsaPubKey = new DsaPubKeyType(parsed); DsaGroup = new DsaGroupType(parsed); Auth = new AuthType(parsed); Volatile = new VolatileType(parsed); Metadata = new MetadataType(parsed); #if DEBUG parsed.PrintAccessCount(); #endif }
/// <summary> /// NodeDataEventArgs Constructor /// </summary> /// <param name="parsed">a simple MessageParse</param> internal NodeDataEventArgs(dynamic parsed) { #if DEBUG FCP2Protocol.ArgsDebug(this, parsed); #endif LastGoodVersion = parsed.lastGoodVersion; Sig = parsed.sig; Opennet = parsed.opennet; Identity = parsed.identity; Version = parsed.version; Physical = new PhysicalType(parsed.physical); Ark = new ArkType(parsed.ark); DsaPubKey = new DsaPubKeyType(parsed.dsaPubKey); DsaPrivKey = new DsaPrivKeyType(parsed.dsaPrivKey); DsaGroup = new DsaGroupType(parsed.dsaGroup); Auth = new AuthType(parsed.auth); ClientNonce = parsed.clientNonce; Location = parsed.location; if (!parsed.location.LastConversionSucessfull) { Location = -1.0; } if ([email protected]()) { Volatile = new VolatileType(parsed.@volatile); } #if DEBUG parsed.PrintAccessCount(); #endif }
/// <summary> /// NodeDataEventArgs Constructor /// </summary> /// <param name="parsed">a simple MessageParse</param> internal NodeDataEventArgs(dynamic parsed) { #if DEBUG FCP2Protocol.ArgsDebug(this, parsed); #endif lastGoodVersion = parsed.lastGoodVersion; sig = parsed.sig; opennet = parsed.opennet; identity = parsed.identity; version = parsed.version; physical = new PhysicalType(parsed.physical); ark = new ArkType(parsed.ark); dsaPubKey = new DsaPubKeyType(parsed.dsaPubKey); dsaPrivKey = new DsaPrivKeyType(parsed.dsaPrivKey); dsaGroup = new DsaGroupType(parsed.dsaGroup); auth = new AuthType(parsed.auth); clientNonce = parsed.clientNonce; location = parsed.location; if (!parsed.location.LastConversionSucessfull) { location = -1.0; } if ([email protected]()) { @volatile = new VolatileType(parsed.@volatile); } #if DEBUG parsed.PrintAccessCount(); #endif }
private static IntPtr Make( string name, Repetition repetition, PhysicalType type, LogicalType logicalType, int length, int precision, int scale) { ExceptionInfo.Check(PrimitiveNode_Make(name, repetition, type, logicalType, length, precision, scale, out var primitiveNode)); return(primitiveNode); }
private void Initialize(Image Sprite, PhysicalType pt, int x, int y, int width32, int height, bool collidable) { physicalType = pt; X = x; Y = y; Width = width32 * 32; Height = height; collision = new Rectangle((int)X, (int)Y, Width, Height); if (Width > 32) { this.Sprite = new Bitmap(Width, Height); using (var brush = new TextureBrush(Sprite, WrapMode.Tile)) using (var g = Graphics.FromImage(this.Sprite)) { g.FillRectangle(brush, 0, 0, Width, Height); } } else { this.Sprite = Sprite; } Collidable = collidable; }
/// <summary> /// Updates the value of the scalar element identified by the given tag /// or adds a new scalar element if one does not already exist. /// </summary> /// <param name="tag">The tag which identifies the scalar element to be updated.</param> /// <param name="type">The physical type of the value contained in the scalar element.</param> /// <param name="bytes">The value to be entered into the scalar element.</param> /// <returns>The scalar element which was updated, or a new scalar element if one did not already exist.</returns> public ScalarElement AddOrUpdateScalar(Guid tag, PhysicalType type, byte[] bytes) { ScalarElement scalarElement = GetOrAddScalar(tag); scalarElement.TypeOfValue = type; scalarElement.SetValue(bytes, 0); return(scalarElement); }
public PrimitiveNode( string name, Repetition repetition, LogicalType logicalType, PhysicalType physicalType, int primitiveLength = -1) : this(Make(name, repetition, logicalType, physicalType, primitiveLength)) { }
/// <summary> /// Updates the values contained by the vector element identified by the given tag /// or adds a new vector element if one does not already exist. /// </summary> /// <param name="tag">The tag which identifies the vector element to be updated.</param> /// <param name="type">The physical type of the values contained in the vector element.</param> /// <param name="bytes">The values to be entered into the vector element.</param> /// <returns>The vector element which was updated, or a new vector element if one did not already exist.</returns> public VectorElement AddOrUpdateVector(Guid tag, PhysicalType type, byte[] bytes) { VectorElement vectorElement = GetOrAddVector(tag); vectorElement.TypeOfValue = type; vectorElement.Size = bytes.Length / type.GetByteSize(); vectorElement.SetValues(bytes, 0); return(vectorElement); }
public PhysicalEffect() : base() { xPos = "0"; yPos = "0"; zPos = "0"; xValue = "0"; yValue = "0"; zValue = "0"; physicalType = PhysicalType.Force; }
public PhysicalEffect(Effect copySource) : base(copySource) { xPos = "0"; yPos = "0"; zPos = "0"; xValue = "0"; yValue = "0"; zValue = "0"; physicalType = PhysicalType.Force; }
public PhysicalEffect(PhysicalEffect copySource) : base(copySource) { xPos = copySource.xPos; yPos = copySource.yPos; zPos = copySource.zPos; xValue = copySource.xValue; yValue = copySource.yValue; zValue = copySource.zValue; physicalType = copySource.physicalType; }
// Tags are readonly and can only be created by // defining them in the TagDefinitions.xml file. private Tag(XDocument doc, XElement element) { m_id = Guid.Parse((string)element.Element("id")); m_name = (string)element.Element("name"); m_standardName = (string)element.Element("standardName"); m_description = (string)element.Element("description"); m_elementType = GetElementType(element); m_physicalType = GetPhysicalType(element); m_required = ((string)element.Element("required") ?? "False").ParseBoolean(); m_formatString = (string)element.Element("formatString"); m_validIdentifiers = Identifier.GenerateIdentifiers(doc, this); }
// Reads a scalar element from the PQDIF file. private ScalarElement ReadScalar(BinaryReader recordBodyReader, PhysicalType typeOfValue) { ScalarElement element = new ScalarElement() { TypeOfValue = typeOfValue }; byte[] value = recordBodyReader.ReadBytes(typeOfValue.GetByteSize()); element.SetValue(value, 0); return(element); }
// Reads a vector element from the PQDIF file. private VectorElement ReadVector(BinaryReader recordBodyReader, PhysicalType typeOfValue) { VectorElement element = new VectorElement() { Size = recordBodyReader.ReadInt32(), TypeOfValue = typeOfValue }; byte[] values = recordBodyReader.ReadBytes(element.Size * typeOfValue.GetByteSize()); element.SetValues(values, 0); return(element); }
public BodyInfo(PhysicalType physicalType, Shape[] shapes) { size = 0f; this.shapes = shapes; foreach (Shape shape in shapes) { size = Math.Max(size, shape.GetMaxDistance()); if (typeof(Polygon) == shape.GetType()) { ((Polygon)shape).CalculateNormals(); } } this.physicalType = physicalType; size *= 2f; }
// Reads an element from the PQDIF file. private Element ReadElement(BinaryReader recordBodyReader) { Element element; Guid tagOfElement = new Guid(recordBodyReader.ReadBytes(16)); ElementType typeOfElement = (ElementType)recordBodyReader.ReadByte(); PhysicalType typeOfValue = (PhysicalType)recordBodyReader.ReadByte(); bool isEmbedded = recordBodyReader.ReadByte() != 0; // Read reserved byte recordBodyReader.ReadByte(); long link; long returnLink; returnLink = recordBodyReader.BaseStream.Position + 8L; if (!isEmbedded || typeOfElement != ElementType.Scalar) { link = recordBodyReader.ReadInt32(); recordBodyReader.BaseStream.Seek(link, SeekOrigin.Begin); } switch (typeOfElement) { case ElementType.Collection: element = ReadCollection(recordBodyReader); break; case ElementType.Scalar: element = ReadScalar(recordBodyReader, typeOfValue); break; case ElementType.Vector: element = ReadVector(recordBodyReader, typeOfValue); break; default: element = new UnknownElement(typeOfElement); element.TypeOfValue = typeOfValue; break; } element.TagOfElement = tagOfElement; recordBodyReader.BaseStream.Seek(returnLink, SeekOrigin.Begin); return(element); }
private static IntPtr Make( string name, Repetition repetition, LogicalType logicalType, PhysicalType physicalType, int primitiveLength) { if (name == null) { throw new ArgumentNullException(nameof(name)); } ExceptionInfo.Check(PrimitiveNode_Make(name, repetition, logicalType?.Handle.IntPtr ?? IntPtr.Zero, physicalType, primitiveLength, out var primitiveNode)); GC.KeepAlive(logicalType?.Handle); return(primitiveNode); }
private static (LogicalType LogicalType, PhysicalType PhysicalType) GetEntry( LogicalType?logicalTypeOverride, LogicalType?logicalType, PhysicalType physicalType) { // By default, return the first listed logical type. if (logicalTypeOverride == null || logicalTypeOverride is NoneLogicalType) { if (logicalType == null) { throw new ArgumentNullException(nameof(logicalType), $"both {nameof(logicalType)} and {nameof(logicalTypeOverride)} are null"); } return(logicalType, physicalType); } // Milliseconds TimeSpan can be stored on Int32 if (logicalTypeOverride is TimeLogicalType { TimeUnit: TimeUnit.Millis })
private static (LogicalType LogicalType, PhysicalType PhysicalType) GetEntry( LogicalType logicalTypeOverride, LogicalType logicalType, PhysicalType physicalType) { // By default, return the first listed logical type. if (logicalTypeOverride == null || logicalTypeOverride is NoneLogicalType) { return(logicalType, physicalType); } // Milliseconds TimeSpan can be stored on Int32 if (logicalTypeOverride is TimeLogicalType timeLogicalType && timeLogicalType.TimeUnit == TimeUnit.Millis) { physicalType = PhysicalType.Int32; } // Otherwise allow one of the supported override. return(logicalTypeOverride, physicalType); }
public List <object> GetListOfObjects() { List <object> res = new List <object>(); foreach (VhdlFile file in parent.files) { foreach (LibraryUnit libraryUnit in file.Elements) { if (libraryUnit is PackageDeclaration) { foreach (IPackageDeclarativeItem o in (libraryUnit as PackageDeclaration).Declarations) { if (o is EnumerationType) { EnumerationType type = o as EnumerationType; res.Add(type); //TODO: support overloading foreach (EnumerationLiteral literal in type.Literals) { res.Add(literal); } } else if (o is PhysicalType) { PhysicalType type = o as PhysicalType; res.Add(type); } } } if (libraryUnit is INamedEntity) { INamedEntity ie = (INamedEntity)libraryUnit; res.Add(ie); } } } return(res); }
/// <summary> /// Gets the size of the physical type, in bytes. /// </summary> /// <param name="type">The physical type.</param> /// <returns>The size of the physical type, in bytes.</returns> public static int GetByteSize(this PhysicalType type) { switch (type) { case PhysicalType.Boolean1: case PhysicalType.Char1: case PhysicalType.Integer1: case PhysicalType.UnsignedInteger1: return(1); case PhysicalType.Boolean2: case PhysicalType.Char2: case PhysicalType.Integer2: case PhysicalType.UnsignedInteger2: return(2); case PhysicalType.Boolean4: case PhysicalType.Integer4: case PhysicalType.UnsignedInteger4: case PhysicalType.Real4: return(4); case PhysicalType.Real8: case PhysicalType.Complex8: return(8); case PhysicalType.Timestamp: return(12); case PhysicalType.Complex16: case PhysicalType.Guid: return(16); default: throw new ArgumentOutOfRangeException("type"); } }
private static extern IntPtr ColumnChunkMetaData_Type(IntPtr columnChunkMetaData, out PhysicalType type);
internal InstalmentInfoNotFoundException(Guid orderId, PhysicalType physicalType) { this.OrderId = orderId; this.PhysicalType = physicalType; }
private static extern IntPtr PrimitiveNode_Make( [MarshalAs(UnmanagedType.LPUTF8Str)] string name, Repetition repetition, IntPtr logicalType, PhysicalType type, int primitiveLength, out IntPtr primitiveNode);
private static extern IntPtr ColumnReader_Type(IntPtr columnReader, out PhysicalType type);
private static extern IntPtr PrimitiveNode_Physical_Type(IntPtr node, out PhysicalType physicalType);
// Reads a vector element from the PQDIF file. private VectorElement ReadVector(BinaryReader recordBodyReader, PhysicalType typeOfValue) { VectorElement element = new VectorElement() { Size = recordBodyReader.ReadInt32(), TypeOfValue = typeOfValue }; byte[] values = recordBodyReader.ReadBytes(element.Size * typeOfValue.GetByteSize()); element.SetValues(values, 0); return element; }
// Reads an element from the PQDIF file. private Element ReadElement(BinaryReader recordBodyReader) { Element element; Guid tagOfElement = Guid.Empty; ElementType typeOfElement = 0; PhysicalType typeOfValue = 0; bool isEmbedded; // Calculate the location of the next element // after this one in case we encounter any errors long nextLink = recordBodyReader.BaseStream.Position + 28L; try { tagOfElement = new Guid(recordBodyReader.ReadBytes(16)); typeOfElement = (ElementType)recordBodyReader.ReadByte(); typeOfValue = (PhysicalType)recordBodyReader.ReadByte(); isEmbedded = recordBodyReader.ReadByte() != 0; // Read reserved byte recordBodyReader.ReadByte(); long link; long returnLink; returnLink = recordBodyReader.BaseStream.Position + 8L; if (!isEmbedded || typeOfElement != ElementType.Scalar) { link = recordBodyReader.ReadInt32(); if (link < 0 || link >= recordBodyReader.BaseStream.Length) { throw new InvalidOperationException("Element link is outside the bounds of the file"); } recordBodyReader.BaseStream.Seek(link, SeekOrigin.Begin); } switch (typeOfElement) { case ElementType.Collection: element = ReadCollection(recordBodyReader); break; case ElementType.Scalar: element = ReadScalar(recordBodyReader, typeOfValue); break; case ElementType.Vector: element = ReadVector(recordBodyReader, typeOfValue); break; default: element = new UnknownElement(typeOfElement); element.TypeOfValue = typeOfValue; break; } element.TagOfElement = tagOfElement; recordBodyReader.BaseStream.Seek(returnLink, SeekOrigin.Begin); return(element); } catch (Exception ex) { m_exceptionList.Add(ex); // Jump to the location of the next element after this one if (nextLink < recordBodyReader.BaseStream.Length) { recordBodyReader.BaseStream.Seek(nextLink, SeekOrigin.Begin); } else { recordBodyReader.BaseStream.Seek(0L, SeekOrigin.End); } return(new ErrorElement(typeOfElement, ex) { TagOfElement = tagOfElement, TypeOfValue = typeOfValue }); } }
public static extern void SetupDevice1(int devId, PhysicalType connType);
// Reads a scalar element from the PQDIF file. private ScalarElement ReadScalar(BinaryReader recordBodyReader, PhysicalType typeOfValue) { ScalarElement element = new ScalarElement() { TypeOfValue = typeOfValue }; byte[] value = recordBodyReader.ReadBytes(typeOfValue.GetByteSize()); element.SetValue(value, 0); return element; }
public List <object> GetLocalListOfObjects() { List <object> res = new List <object>(); foreach (E declaration in this) { if (declaration is EnumerationType) { EnumerationType type = declaration as EnumerationType; res.Add(type); //TODO: support overloading foreach (EnumerationLiteral literal in type.Literals) { res.Add(literal); } } else if (declaration is RecordType) { RecordType type = declaration as RecordType; res.Add(type); foreach (VHDL.type.RecordType.ElementDeclaration el in type.Elements) { foreach (string name in el.Identifiers) { res.Add(name); } } } else if (declaration is PhysicalType) { PhysicalType type = declaration as PhysicalType; res.Add(type); res.Add(new PhysicalLiteral(null, type.PrimaryUnit, declaration as PhysicalType)); foreach (PhysicalType.Unit unit in type.Units) { res.Add(unit.Identifier); } } else if (declaration is NamedEntity) { INamedEntity identElement = (NamedEntity)declaration; res.Add(declaration); } else if (declaration is SignalDeclaration) { SignalDeclaration objDecl = declaration as SignalDeclaration; foreach (var o in objDecl.Objects) { res.Add(o); } } else if (declaration is ConstantDeclaration) { ConstantDeclaration objDecl = declaration as ConstantDeclaration; foreach (var o in objDecl.Objects) { res.Add(o); } } else if (declaration is VariableDeclaration) { VariableDeclaration objDecl = declaration as VariableDeclaration; foreach (var o in objDecl.Objects) { res.Add(o); } } else if (declaration is FileDeclaration) { FileDeclaration objDecl = declaration as FileDeclaration; foreach (var o in objDecl.Objects) { res.Add(o); } } else if (declaration is Alias) { res.Add(declaration); } else if (declaration is Subtype) { res.Add(declaration); } else if (declaration is UseClause) { UseClause use = declaration as UseClause; res.AddRange(use.Scope.GetLocalListOfObjects()); } else if (declaration.GetType().BaseType == typeof(ObjectDeclaration <>)) { ObjectDeclaration <VhdlObject> objDecl = declaration as ObjectDeclaration <VhdlObject>; foreach (VhdlObject o in objDecl.Objects) { res.Add(o); } } } return(res); }
public object Resolve(string identifier) { foreach (E declaration in this) { if (declaration is EnumerationType) { EnumerationType type = declaration as EnumerationType; if (identifier.EqualsIdentifier(type.Identifier)) { return(type); } //TODO: support overloading foreach (EnumerationLiteral literal in type.Literals) { if (identifier.EqualsIdentifier(literal.ToString())) { return(literal); } } } else if (declaration is RecordType) { RecordType type = declaration as RecordType; if (identifier.EqualsIdentifier(type.Identifier)) { return(type); } foreach (VHDL.type.RecordType.ElementDeclaration el in type.Elements) { foreach (string name in el.Identifiers) { if (identifier.EqualsIdentifier(name)) { return(new Variable(name, el.Type)); } } } } else if (declaration is PhysicalType) { PhysicalType type = declaration as PhysicalType; if (identifier.EqualsIdentifier(type.Identifier)) { return(type); } //TODO: don't use strings for the physical literals if (identifier.EqualsIdentifier(type.PrimaryUnit)) { return(new PhysicalLiteral(null, type.PrimaryUnit, declaration as PhysicalType)); } foreach (PhysicalType.Unit unit in type.Units) { if (identifier.EqualsIdentifier(unit.Identifier)) { return(new PhysicalLiteral(null, unit.Identifier, declaration as PhysicalType)); } } } else if (declaration is NamedEntity) { INamedEntity identElement = (NamedEntity)declaration; if (identifier.EqualsIdentifier(identElement.Identifier)) { return(declaration); } } else if (declaration is SignalDeclaration) { SignalDeclaration objDecl = declaration as SignalDeclaration; foreach (var o in objDecl.Objects) { if (o.Identifier.EqualsIdentifier(identifier)) { return(o); } } } else if (declaration is ConstantDeclaration) { ConstantDeclaration objDecl = declaration as ConstantDeclaration; foreach (var o in objDecl.Objects) { if (o.Identifier.EqualsIdentifier(identifier)) { return(o); } } } else if (declaration is VariableDeclaration) { VariableDeclaration objDecl = declaration as VariableDeclaration; foreach (var o in objDecl.Objects) { if (o.Identifier.EqualsIdentifier(identifier)) { return(o); } } } else if (declaration is FileDeclaration) { FileDeclaration objDecl = declaration as FileDeclaration; foreach (var o in objDecl.Objects) { if (o.Identifier.EqualsIdentifier(identifier)) { return(o); } } } else if (declaration is Alias) { Alias objDecl = declaration as Alias; if (objDecl.Designator.EqualsIdentifier(identifier)) { return(objDecl.Aliased);//new Variable(objDecl.Aliased, objDecl.SubtypeIndication); } } else if (declaration is Subtype) { Subtype objDecl = declaration as Subtype; if (objDecl.Identifier.EqualsIdentifier(identifier)) { return(objDecl); } } else if (declaration is UseClause) { UseClause use = declaration as UseClause; object res = use.Scope.resolve(identifier); if (res != null) { return(res); } } else if (declaration.GetType().BaseType == typeof(ObjectDeclaration <>)) { ObjectDeclaration <VhdlObject> objDecl = declaration as ObjectDeclaration <VhdlObject>; foreach (VhdlObject o in objDecl.Objects) { if (o.Identifier.EqualsIdentifier(identifier)) { return(o); } } } } return(null); }