Ejemplo n.º 1
0
        public RosServiceDefinition()
        {
            try
            {
                RosType = BuiltIns.GetServiceType <T>();
            }
            catch (RosInvalidMessageException)
            {
                throw new RosIncompleteWrapperException(
                          $"Type '{typeof(T).Name}' must have a string constant named RosMessageType. " +
                          "It should also be tagged with the attribute [MessageName].");
            }

            const string serviceSeparator = "---";

            RosDefinition = RosRequestWrapper <T, TRequest, TResponse> .RosDefinition + "\n" +
                            serviceSeparator + "\n" +
                            RosResponseWrapper <T, TRequest, TResponse> .RosDefinition + "\n";

            RosMessageMd5 = RosWrapperBase.CreateMd5(
                RosRequestWrapper <T, TRequest, TResponse> .RosInputForMd5 +
                RosResponseWrapper <T, TRequest, TResponse> .RosInputForMd5);

            var alreadyWritten = new HashSet <Type>();

            RosDependencies = RosDefinition +
                              RosSerializableDefinition <TRequest> .CreatePartialDependencies(alreadyWritten) +
                              RosSerializableDefinition <TResponse> .CreatePartialDependencies(alreadyWritten);
        }
Ejemplo n.º 2
0
 public ServiceInfo(string callerId, string service, T?generator = default)
     : this(
         callerId, service,
         BuiltIns.GetMd5Sum <T>(),
         BuiltIns.GetServiceType <T>(),
         generator
         )
 {
 }