Esempio n. 1
0
 /// <summary>Register service method with a service binder with or without implementation. Useful when customizing the  service binding logic.
 /// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary>
 /// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static void BindService(grpc::ServiceBinderBase serviceBinder, RegisterBase serviceImpl)
 {
     serviceBinder.AddMethod(__Method_RegisterUser, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::GrpcAuthService.UserRequest, global::GrpcAuthService.UserReply>(serviceImpl.RegisterUser));
     serviceBinder.AddMethod(__Method_UpdateUser, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::GrpcAuthService.UserRequest, global::GrpcAuthService.UserReply>(serviceImpl.UpdateUser));
     serviceBinder.AddMethod(__Method_DeleteUser, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::GrpcAuthService.UserIdRequest, global::GrpcAuthService.UserReply>(serviceImpl.DeleteUser));
     serviceBinder.AddMethod(__Method_GetUserById, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::GrpcAuthService.UserIdRequest, global::Google.Protobuf.WellKnownTypes.Empty>(serviceImpl.GetUserById));
     serviceBinder.AddMethod(__Method_GetAllUsers, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::Google.Protobuf.WellKnownTypes.Empty, global::GrpcAuthService.AllUsersReply>(serviceImpl.GetAllUsers));
 }
Esempio n. 2
0
 /// <summary>Register service method with a service binder with or without implementation. Useful when customizing the  service binding logic.
 /// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary>
 /// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static void BindService(grpc::ServiceBinderBase serviceBinder, RegisterBase serviceImpl)
 {
     serviceBinder.AddMethod(__Method_doServiceRegister, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::SkyWalking.NetworkProtocol.Services, global::SkyWalking.NetworkProtocol.ServiceRegisterMapping>(serviceImpl.doServiceRegister));
     serviceBinder.AddMethod(__Method_doServiceInstanceRegister, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::SkyWalking.NetworkProtocol.ServiceInstances, global::SkyWalking.NetworkProtocol.ServiceInstanceRegisterMapping>(serviceImpl.doServiceInstanceRegister));
     serviceBinder.AddMethod(__Method_doEndpointRegister, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::SkyWalking.NetworkProtocol.Enpoints, global::SkyWalking.NetworkProtocol.EndpointMapping>(serviceImpl.doEndpointRegister));
     serviceBinder.AddMethod(__Method_doNetworkAddressRegister, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::SkyWalking.NetworkProtocol.NetAddresses, global::SkyWalking.NetworkProtocol.NetAddressMapping>(serviceImpl.doNetworkAddressRegister));
     serviceBinder.AddMethod(__Method_doServiceAndNetworkAddressMappingRegister, serviceImpl == null ? null : new grpc::UnaryServerMethod <global::SkyWalking.NetworkProtocol.ServiceAndNetworkAddressMappings, global::SkyWalking.NetworkProtocol.Commands>(serviceImpl.doServiceAndNetworkAddressMappingRegister));
 }
 /// <summary>Register service method implementations with a service binder. Useful when customizing the service binding logic.
 /// Note: this method is part of an experimental API that can change or be removed without any prior notice.</summary>
 /// <param name="serviceBinder">Service methods will be bound by calling <c>AddMethod</c> on this object.</param>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static void BindService(grpc::ServiceBinderBase serviceBinder, RegisterBase serviceImpl)
 {
     serviceBinder.AddMethod(__Method_doServiceRegister, serviceImpl.doServiceRegister);
     serviceBinder.AddMethod(__Method_doServiceInstanceRegister, serviceImpl.doServiceInstanceRegister);
     serviceBinder.AddMethod(__Method_doEndpointRegister, serviceImpl.doEndpointRegister);
     serviceBinder.AddMethod(__Method_doNetworkAddressRegister, serviceImpl.doNetworkAddressRegister);
     serviceBinder.AddMethod(__Method_doServiceAndNetworkAddressMappingRegister, serviceImpl.doServiceAndNetworkAddressMappingRegister);
 }
Esempio n. 4
0
 /// <summary>Creates service definition that can be registered with a server</summary>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static grpc::ServerServiceDefinition BindService(RegisterBase serviceImpl)
 {
     return(grpc::ServerServiceDefinition.CreateBuilder()
            .AddMethod(__Method_RegisterUser, serviceImpl.RegisterUser)
            .AddMethod(__Method_UpdateUser, serviceImpl.UpdateUser)
            .AddMethod(__Method_DeleteUser, serviceImpl.DeleteUser)
            .AddMethod(__Method_GetUserById, serviceImpl.GetUserById)
            .AddMethod(__Method_GetAllUsers, serviceImpl.GetAllUsers).Build());
 }
Esempio n. 5
0
 /// <summary>Creates service definition that can be registered with a server</summary>
 /// <param name="serviceImpl">An object implementing the server-side handling logic.</param>
 public static grpc::ServerServiceDefinition BindService(RegisterBase serviceImpl)
 {
     return(grpc::ServerServiceDefinition.CreateBuilder()
            .AddMethod(__Method_doServiceRegister, serviceImpl.doServiceRegister)
            .AddMethod(__Method_doServiceInstanceRegister, serviceImpl.doServiceInstanceRegister)
            .AddMethod(__Method_doEndpointRegister, serviceImpl.doEndpointRegister)
            .AddMethod(__Method_doNetworkAddressRegister, serviceImpl.doNetworkAddressRegister)
            .AddMethod(__Method_doServiceAndNetworkAddressMappingRegister, serviceImpl.doServiceAndNetworkAddressMappingRegister).Build());
 }
        public static string GetInputForReg(RegisterBase reg)
        {
            try
            {
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine($"Enter the base 10 value for {reg.Name}:");

                Console.ForegroundColor = ConsoleColor.White;
                var inputStr = Console.ReadLine()?.Trim();

                long inputInt;
                if (!long.TryParse(inputStr, out inputInt))
                {
                    throw new ArgumentException("Please enter an integer number.");
                }

                var bits = reg.Bits;
                var max  = Math.Pow(2, bits - 1);
                var min  = 0;

                if (inputInt > max)
                {
                    throw new ArgumentException($"The max number allowed for this register is {max}.");
                }

                if (inputInt < min)
                {
                    throw new ArgumentException($"The minimum number allowed for this register is {min}.");
                }

                return(Convert.ToString(inputInt, 2).PadLeft(bits, '0'));
            }
            catch (Exception error)
            {
                Log.Error(error);
                return(GetInputForReg(reg));
            }
        }
 public bool IsCompatible(RegisterBase reg)
 {
     return(StartCycle > reg.StopCycle || StopCycle < reg.StartCycle);
 }
Esempio n. 8
0
        private int writeDataPathMultiplexerRegister(StreamWriter stream, int inputBitIndex, RegisterBase register)
        {
            var regUnit = RegisterAllocator.Units.FirstOrDefault(registerUnit => registerUnit.Registers.Contains(register));

            if (regUnit != null)
            {
                //must be a shared register unit
                stream.WriteLine($"\t\t\tinput({inputBitIndex + regUnit.Bits - 1} downto {inputBitIndex}) => {regUnit.Name}_out({regUnit.Bits - 1} downto 0), -- {register.Name}");
                return(regUnit.Bits);
            }

            //must be an input
            stream.WriteLine($"\t\t\tinput({inputBitIndex + register.Bits - 1} downto {inputBitIndex}) => {register.Name}_out({register.Bits - 1} downto 0), -- {register.Name}");
            return(register.Bits);
        }