Beispiel #1
0
 /// <summary>
 /// register a type that is mapped. The idl-definition of this type is stored in the file idlFile
 /// </summary>
 /// <param name="mapped"></param>
 /// <param name="idlFile">the filename of the idlFile containing the mapped type. The filename is relative to the output-directory, does not include the full path</param>
 private void RegisterMappedType(MapTypeInfo mapped, string idlFile)
 {
     if (m_alreadyMappedTypes.Contains(mapped) || IsDefaultMapped(mapped.Type))
     {
         throw new Exception("reregister of mapped type not possible, already mapped: " + mapped);
     }
     m_alreadyMappedTypes.Add(mapped);
     m_filesForMappedTypes.Add(mapped, idlFile);
 }
Beispiel #2
0
 /// <summary>get the name of the idl-file for the mapped type</summary>
 public string GetIdlFileForMappedType(MapTypeInfo mapped)
 {
     if (!IsCustomMappedToIdlType(mapped.Type))
     {
         object res = m_filesForMappedTypes[mapped];
         return((string)res);
     }
     else
     {
         GeneratorMappingPlugin     mappingPlugin = GeneratorMappingPlugin.GetSingleton();
         GeneratorCustomMappingDesc mappingDesc   = mappingPlugin.GetMappingForIdlTarget(mapped.Type);
         return(mappingDesc.IdlFileName);
     }
 }
Beispiel #3
0
        /// <summary>
        /// gets the type, which should be mapped next
        /// </summary>
        public MapTypeInfo GetNextTypeToMap()
        {
            MapTypeInfo result = null;

            while (m_toMap.Count > 0)
            {
                MapTypeInfo candidate = (MapTypeInfo)m_toMap.Dequeue();
                if (!CheckMapped(candidate))
                {
                    result = candidate;
                    break;
                }
            }
            return(result);
        }
Beispiel #4
0
        /// <summary>stores the dependant types, which are not already mapped</summary>
        /// <param name="deps"></param>
        private void StoreToMapNext(IList /* MapTypeInfo */ deps)
        {
            IEnumerator enumerator = deps.GetEnumerator();

            while (enumerator.MoveNext())
            {
                MapTypeInfo info = (MapTypeInfo)enumerator.Current;


                // check if already mapped
                // CheckMapped for custom mapped types is ture, because in info target type is stored.
                if (!(CheckMapped(info) || m_toMap.Contains(info)))
                {
                    m_toMap.Enqueue(info);
                }
            }
        }
Beispiel #5
0
        private void AddToDepList(ArrayList depList, MapTypeInfo info, bool useAnanymousSequences)
        {
            if (info.Type.IsByRef)
            {
                info = CreateMapTypeInfo(info.Type.GetElementType(),
                                         info.Attributes);
            }

            if (useAnanymousSequences && info.Attributes.IsInCollection(typeof(IdlSequenceAttribute)))
            {
                // for anonymous IDL-sequence: add dep for sequence element and not for sequence itself,
                // because the sequence type itself will never be mapped to a type on it's own.
                // remark: non-anonymous sequences are mapped to a type-def
                info.RemoveAttributeOfType(ReflectionHelper.IdlSequenceAttributeType);
                Type elemType = info.Type.GetElementType();
                info = CreateMapTypeInfo(elemType, info.Attributes);
            }

            if (!depList.Contains(info))
            {
                depList.Add(info);
            }
        }
Beispiel #6
0
 /// <summary>checks if a type is already mapped</summary>
 /// <returns>true, if mapped, else false</returns>
 public bool CheckMapped(MapTypeInfo toMap)
 {
     return(m_alreadyMappedTypes.Contains(toMap) ||
            IsMappedBeforeGeneration(toMap.Type));
 }
        private void AddToDepList(ArrayList depList, MapTypeInfo info, bool useAnanymousSequences) {
            if (info.Type.IsByRef) {
                info = CreateMapTypeInfo(info.Type.GetElementType(),
                                         info.Attributes);
            }
 
            if (useAnanymousSequences && info.Attributes.IsInCollection(typeof(IdlSequenceAttribute))) {
                // for anonymous IDL-sequence: add dep for sequence element and not for sequence itself,
                // because the sequence type itself will never be mapped to a type on it's own.
                // remark: non-anonymous sequences are mapped to a type-def
                info.RemoveAttributeOfType(ReflectionHelper.IdlSequenceAttributeType);
                Type elemType = info.Type.GetElementType();
                info = CreateMapTypeInfo(elemType, info.Attributes);
            }
 
            if (!depList.Contains(info)) {
                depList.Add(info);
            }
        }
 /// <summary>checks if a type is already mapped</summary>
 /// <returns>true, if mapped, else false</returns>
 public bool CheckMapped(MapTypeInfo toMap) {
     return (m_alreadyMappedTypes.Contains(toMap) ||
             IsMappedBeforeGeneration(toMap.Type));
 }
 /// <summary>get the name of the idl-file for the mapped type</summary>
 public string GetIdlFileForMappedType(MapTypeInfo mapped) {
     if (!IsCustomMappedToIdlType(mapped.Type)) {
         object res = m_filesForMappedTypes[mapped];
         return (string) res;
     } else {
         GeneratorMappingPlugin mappingPlugin = GeneratorMappingPlugin.GetSingleton();
         GeneratorCustomMappingDesc mappingDesc = mappingPlugin.GetMappingForIdlTarget(mapped.Type);
         return mappingDesc.IdlFileName;
     }
 }
 /// <summary>
 /// register a type that is mapped. The idl-definition of this type is stored in the file idlFile
 /// </summary>
 /// <param name="mapped"></param>
 /// <param name="idlFile">the filename of the idlFile containing the mapped type. The filename is relative to the output-directory, does not include the full path</param>
 private void RegisterMappedType(MapTypeInfo mapped, string idlFile) {
     if (m_alreadyMappedTypes.Contains(mapped) || IsDefaultMapped(mapped.Type)) {
         throw new Exception("reregister of mapped type not possible, already mapped: " + mapped);
     }
     m_alreadyMappedTypes.Add(mapped);
     m_filesForMappedTypes.Add(mapped, idlFile);
 }