private IEnumerator <RosActionCall> GetEnumeratorForRelativeActionNamePattern()
        {
            var goals = ActionMessages.GoalMessages.ToList();
            var globalActionMessages = new ConcurrentDictionary <string, ActionMessagesCollection>();

            foreach (var goal in goals)
            {
                var globalActionName = goal.Topic.Substring(0, goal.Topic.LastIndexOf("/", StringComparison.InvariantCulture));
                var actionMessages   = globalActionMessages.GetOrAdd(globalActionName,
                                                                     actionName => ActionMessagesCollection.Create(actionName, ActionMessages));

                yield return(new RosActionCall(goal, actionMessages));
            }
        }
        public static ActionMessagesCollection Create(string actionNamePattern, IEnumerable <IRecordedMessage> messages)
        {
            if (actionNamePattern == null)
            {
                throw new ArgumentNullException(nameof(actionNamePattern));
            }
            if (messages == null)
            {
                throw new ArgumentNullException(nameof(messages));
            }

            actionNamePattern = actionNamePattern.Trim();

            if (string.Empty.Equals(actionNamePattern))
            {
                throw new InvalidRosNamePatternException("ROS name pattern must not be empty", nameof(actionNamePattern));
            }

            if (actionNamePattern.EndsWith("/"))
            {
                throw new InvalidRosNamePatternException(
                          "ROS name pattern must not end with a namespace separator ('/')", nameof(actionNamePattern));
            }


            var actionName = actionNamePattern.Substring(actionNamePattern.LastIndexOf("/", StringComparison.InvariantCulture) + 1);

            if (RosNameRegex.ContainsPlaceholders(actionName))
            {
                throw new InvalidRosNamePatternException("ROS action name must not contain any placeholders", nameof(actionNamePattern));
            }

            var actionTopicsPattern = actionNamePattern + "/*";
            var actionMessages      = messages
                                      .InTopic(actionTopicsPattern);

            var actionMessagesCollection = new ActionMessagesCollection(actionNamePattern, actionMessages);

            return(actionMessagesCollection);
        }
 public RosActionCall(IRecordedMessage <ActionGoal> goal, ActionMessagesCollection actionMessages)
 {
     _goal           = goal ?? throw new ArgumentNullException(nameof(goal));
     _actionMessages = actionMessages ?? throw new ArgumentNullException(nameof(actionMessages));
 }
 public ActionCallCollection(ActionMessagesCollection actionMessages)
 {
     ActionMessages = actionMessages ?? throw new ArgumentNullException(nameof(actionMessages));
 }