internal static GrpcSbType CreateType(SbType sbType, long id) =>
 new GrpcSbType
 {
     Id    = id,
     Flags = (uint)sbType.GetTypeFlags(),
     Name  = sbType.GetName() ?? "",
     NumberOfDirectBaseClasses = sbType.GetNumberOfDirectBaseClasses(),
 };
Example #2
0
        public IEnumerable <string> GetAllInheritedTypes()
        {
            SbType typeInfo = _remoteValue.GetTypeInfo();

            if (typeInfo == null)
            {
                yield break;
            }

            TypeFlags typeFlags = typeInfo.GetTypeFlags();

            if (typeFlags.HasFlag(TypeFlags.IS_POINTER) ||
                typeFlags.HasFlag(TypeFlags.IS_REFERENCE))
            {
                typeInfo = typeInfo.GetPointeeType();
                if (typeInfo == null)
                {
                    yield break;
                }
            }

            var typeQueue = new Queue <SbType>();

            typeQueue.Enqueue(typeInfo);

            while (typeQueue.Count > 0)
            {
                SbType curType = typeQueue.Dequeue();
                yield return(curType.GetName());

                uint numDirectBaseClasses = curType.GetNumberOfDirectBaseClasses();
                for (uint i = 0; i < numDirectBaseClasses; i++)
                {
                    typeQueue.Enqueue(curType.GetDirectBaseClassAtIndex(i).GetTypeInfo());
                }
            }
        }