Program Listing for File DomainExpert.hpp

Return to documentation for file (/tmp/ws/src/ros2_planning_system/plansys2_domain_expert/include/plansys2_domain_expert/DomainExpert.hpp)

// Copyright 2019 Intelligent Robotics Lab
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef PLANSYS2_DOMAIN_EXPERT__DOMAINEXPERT_HPP_
#define PLANSYS2_DOMAIN_EXPERT__DOMAINEXPERT_HPP_

#include <optional>
#include <string>
#include <vector>
#include <memory>

#include "plansys2_msgs/msg/action.hpp"
#include "plansys2_msgs/msg/durative_action.hpp"
#include "plansys2_msgs/msg/node.hpp"

#include "plansys2_pddl_parser/Domain.h"

#include "plansys2_domain_expert/DomainExpertInterface.hpp"
#include "plansys2_domain_expert/DomainReader.hpp"

namespace plansys2
{

class DomainExpert : public DomainExpertInterface
{
public:

  explicit DomainExpert(const std::string & domain);


  void extendDomain(const std::string & domain);


  std::string getName();


  std::vector<std::string> getTypes();


  std::vector<std::string> getConstants(const std::string & type);


  std::vector<plansys2::Predicate> getPredicates();


  std::optional<plansys2::Predicate> getPredicate(const std::string & predicate);


  std::vector<plansys2::Function> getFunctions();


  std::optional<plansys2::Function> getFunction(const std::string & function);


  std::vector<std::string> getActions();


  plansys2_msgs::msg::Action::SharedPtr getAction(
    const std::string & action,
    const std::vector<std::string> & params = {});


  std::vector<std::string> getDurativeActions();


  plansys2_msgs::msg::DurativeAction::SharedPtr getDurativeAction(
    const std::string & action,
    const std::vector<std::string> & params = {});


  std::string getDomain();


  bool existDomain(const std::string & domain_name);

private:
  std::shared_ptr<parser::pddl::Domain> domain_;
  DomainReader domains_;
};

}  // namespace plansys2

#endif  // PLANSYS2_DOMAIN_EXPERT__DOMAINEXPERT_HPP_