예제 #1
0
        public override Task <GetPointeeTypeResponse> GetPointeeType(GetPointeeTypeRequest request,
                                                                     ServerCallContext context)
        {
            SbType type        = typeStore.GetObject(request.Type.Id);
            SbType pointeeType = type.GetPointeeType();
            var    response    = new GetPointeeTypeResponse();

            if (pointeeType != null)
            {
                response.Type =
                    GrpcFactoryUtils.CreateType(pointeeType, typeStore.AddObject(pointeeType));
            }
            return(Task.FromResult(response));
        }
예제 #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());
                }
            }
        }