Exemplo n.º 1
0
 internal Symbol(AdsSymbolEntry entry, ISymbol parent, ISymbolFactoryServices factoryServices)
 {
     this.accessRights = SymbolAccessRights.All;
     if (entry == null)
     {
         throw new ArgumentNullException("entry");
     }
     if (factoryServices == null)
     {
         throw new ArgumentNullException("factoryServices");
     }
     this.factoryServices  = factoryServices;
     this.indexGroup       = entry.indexGroup;
     this.indexOffset      = entry.indexOffset;
     base.comment          = entry.comment;
     base.dataTypeId       = (AdsDatatypeId)entry.dataType;
     base.category         = DataTypeCategory.Unknown;
     this.parent           = parent;
     base.instanceName     = this.getInstanceName(entry.name);
     this.instancePath     = this.getInstancePath(entry.name);
     base.size             = (int)entry.size;
     base.typeName         = entry.type;
     base.resolvedDataType = null;
     base.flags            = entry.flags;
     if (entry.attributeCount > 0)
     {
         base.attributes = new TypeAttributeCollection(entry.attributes);
     }
 }
Exemplo n.º 2
0
 internal Instance(AdsSymbolEntry symbol)
 {
     this.comment      = symbol.comment;
     this.instanceName = symbol.name;
     this.size         = (int)symbol.size;
     this.typeName     = AlignTypeName(symbol.type);
     this.dataTypeId   = (AdsDatatypeId)symbol.dataType;
     this.flags        = symbol.flags;
     if ((symbol.attributeCount > 0) && (symbol.attributes != null))
     {
         this.attributes = new TypeAttributeCollection(symbol.attributes);
     }
 }
Exemplo n.º 3
0
 internal Symbol(AdsSymbolEntry entry, IDataType type, ISymbol parent, ISymbolFactoryServices factoryServices) : this(entry, parent, factoryServices)
 {
     base.category         = type.Category;
     base.resolvedDataType = type;
     if ((base.attributes != null) && (base.attributes.Count >= 2))
     {
         ISubRangeType subRange = null;
         if (TryParseSubRange(type, base.attributes, factoryServices.Binder, out subRange))
         {
             base.category         = subRange.Category;
             base.resolvedDataType = subRange;
         }
     }
 }
Exemplo n.º 4
0
 internal ReferenceInstance(AdsSymbolEntry entry, IReferenceType type, ISymbol parent, ISymbolFactoryServices factoryServices) : base(entry, type, parent, factoryServices)
 {
     base.category = DataTypeCategory.Reference;
 }
Exemplo n.º 5
0
 internal StructInstance(AdsSymbolEntry entry, IStructType type, ISymbol parent, ISymbolFactoryServices factoryServices) : base(entry, type, parent, factoryServices)
 {
     base.category = DataTypeCategory.Struct;
 }
Exemplo n.º 6
0
 internal PointerInstance(AdsSymbolEntry entry, IPointerType type, ISymbol parent, ISymbolFactoryServices factoryServices) : base(entry, type, parent, factoryServices)
 {
     base.category = DataTypeCategory.Pointer;
 }
Exemplo n.º 7
0
 internal TcAdsSymbolInfo(AdsParseSymbols symbolParser, TcAdsSymbolInfo parent, int subIndex, AdsSymbolEntry symbolEntry, TcAdsDataType typeEntry) : this(symbolParser, parent, subIndex)
 {
     if (symbolEntry == null)
     {
         throw new ArgumentNullException("symbolEntry");
     }
     this.indexGroup  = symbolEntry.indexGroup;
     this.indexOffset = symbolEntry.indexOffset;
     this.size        = symbolEntry.size;
     this.dataTypeId  = (AdsDatatypeId)symbolEntry.dataType;
     if (typeEntry != null)
     {
         this.typeEntryFlags = typeEntry.Flags;
     }
     if (this.typeEntryFlags.HasFlag(AdsDataTypeFlags.None | AdsDataTypeFlags.Static))
     {
         this.indexGroup  = 0xf019;
         this.indexOffset = 0;
     }
     this.flags        = symbolEntry.flags;
     this.instancePath = symbolEntry.name;
     this.shortName    = symbolEntry.name;
     this.typeName     = symbolEntry.type;
     this.comment      = symbolEntry.comment;
     this.dataType     = typeEntry;
     if (((symbolEntry.array != null) || (typeEntry == null)) || !typeEntry.IsArray)
     {
         this.arrayInfo = symbolEntry.array;
     }
     else
     {
         this.arrayInfo = typeEntry.Dimensions.ToArray();
         if (typeEntry.Size != this.size)
         {
             this.size = (uint)typeEntry.Size;
         }
     }
     if (symbolEntry.attributes != null)
     {
         this.attributes = new TypeAttributeCollection(symbolEntry.attributes).AsReadOnly();
     }
     else
     {
         this.attributes = null;
     }
 }
Exemplo n.º 8
0
 internal ArrayInstance(AdsSymbolEntry entry, IArrayType type, ISymbol parent, ISymbolFactoryServices factoryServices) : base(entry, type, parent, factoryServices)
 {
     base.category = DataTypeCategory.Array;
 }
Exemplo n.º 9
0
 internal RpcStructInstance(AdsSymbolEntry entry, RpcStructType structRpcCallable, ISymbol parent, ISymbolFactoryServices services) : base(entry, structRpcCallable, parent, services)
 {
 }
Exemplo n.º 10
0
 internal UnionInstance(AdsSymbolEntry entry, IUnionType type, ISymbol parent, ISymbolFactoryServices factoryServices) : base(entry, type, parent, factoryServices)
 {
     base.category = DataTypeCategory.Union;
 }
Exemplo n.º 11
0
        private static ISymbol ParseSymbol(AdsBinaryReader symbolReader, Encoding encoding, ISymbolFactoryServices factoryServices)
        {
            AdsSymbolEntry entry = new AdsSymbolEntry(-1L, encoding, symbolReader);

            return(factoryServices.SymbolFactory.CreateInstance(entry, null));
        }