示例#1
0
        internal Symbol(ISymbol parent, IDataType type, string instanceName, int fieldOffset, ISymbolFactoryServices factoryServices) : this(0, 0, parent, type, instanceName, null, factoryServices)
        {
            DataType type2 = (DataType)type;

            this.calcAccess(parent, (DataType)type, fieldOffset, DataTypeFlagConverter.Convert(type2.Flags), type2.Flags, out this.indexGroup, out this.indexOffset);
            DataTypeCategory category = base.category;
        }
示例#2
0
 private Symbol(uint indexGroup, uint indexOffset, ISymbol parent, IDataType type, string instanceName, string instancePath, ISymbolFactoryServices factoryServices)
 {
     this.accessRights = SymbolAccessRights.All;
     if (factoryServices == null)
     {
         throw new ArgumentNullException("factoryServices");
     }
     if (string.IsNullOrEmpty(instanceName))
     {
         throw new ArgumentOutOfRangeException("instanceName");
     }
     this.factoryServices = factoryServices;
     this.parent          = parent;
     if (parent != null)
     {
         base.Bind(((IBinderProvider)parent).Binder);
     }
     this.indexGroup  = indexGroup;
     this.indexOffset = indexOffset;
     if (type != null)
     {
         base.dataTypeId = ((DataType)type).DataTypeId;
         base.category   = type.Category;
     }
     base.instanceName = instanceName;
     this.instancePath = instancePath;
     if (string.IsNullOrEmpty(this.instancePath))
     {
         if (parent == null)
         {
             this.instancePath = instanceName;
         }
         else if (type.IsPointer)
         {
             this.instancePath = parent.InstancePath + "." + instanceName;
         }
         else if (!parent.IsPointer)
         {
             this.instancePath = !parent.IsReference ? (parent.InstancePath + "." + instanceName) : parent.InstancePath;
         }
         else
         {
             base.instanceName = parent.InstanceName + "^";
             this.instancePath = parent.InstancePath + "^";
         }
     }
     base.SetContextMask(0);
     if (parent != null)
     {
         base.SetContextMask(((IContextMaskProvider)parent).ContextMask);
     }
     if (type != null)
     {
         base.flags    = DataTypeFlagConverter.Convert(((DataType)type).Flags);
         base.size     = type.Size;
         base.typeName = type.Name;
     }
     base.resolvedDataType = type;
 }
示例#3
0
 internal Instance(AdsFieldEntry subEntry)
 {
     this.comment       = subEntry.comment;
     this.instanceName  = subEntry.entryName;
     this.size          = (int)subEntry.size;
     this.typeName      = AlignTypeName(subEntry.typeName);
     this.dataTypeId    = subEntry.baseTypeId;
     this.flags         = DataTypeFlagConverter.Convert(subEntry.flags);
     this.staticAddress = (subEntry.flags & (AdsDataTypeFlags.None | AdsDataTypeFlags.Static)) != AdsDataTypeFlags.None;
     if (subEntry.HasAttributes && (subEntry.attributes != null))
     {
         this.attributes = new TypeAttributeCollection(subEntry.attributes);
     }
 }
示例#4
0
        private AdsSymbolFlags getSymbolFlags(ISymbol arrayParent, DataType elementType)
        {
            AdsSymbolFlags none = AdsSymbolFlags.None;
            ArrayType      type = (ArrayType)((DataType)arrayParent.DataType).ResolveType(DataTypeResolveStrategy.AliasReference);

            if (elementType != null)
            {
                none = DataTypeFlagConverter.Convert(elementType.Flags);
            }
            else if (type.ElementTypeId == AdsDatatypeId.ADST_BIT)
            {
                none |= AdsSymbolFlags.BitValue;
            }
            return(none | (((ISymbolFlagProvider)Unwrap(arrayParent)).Flags & (AdsSymbolFlags.None | AdsSymbolFlags.Persistent)));
        }
示例#5
0
 internal TcAdsSymbolInfo(AdsParseSymbols symbolParser, TcAdsSymbolInfo parent, int subIndex, TcAdsDataType typeEntry) : this(symbolParser, parent, subIndex)
 {
     if (typeEntry == null)
     {
         throw new ArgumentNullException("typeEntry");
     }
     this.indexGroup     = (uint)parent.IndexGroup;
     this.indexOffset    = (uint)parent.IndexOffset;
     this.size           = (uint)typeEntry.Size;
     this.dataTypeId     = typeEntry.DataTypeId;
     this.typeEntryFlags = typeEntry.Flags;
     this.flags          = DataTypeFlagConverter.Convert(typeEntry.Flags);
     this.instancePath   = parent.Name;
     this.shortName      = parent.ShortName;
     this.typeName       = typeEntry.Name;
     this.comment        = typeEntry.Comment;
     this.dataType       = typeEntry;
     this.arrayInfo      = typeEntry.ArrayInfo;
     this.attributes     = typeEntry.Attributes;
 }