Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
drexlerd committed Feb 17, 2024
1 parent d05bc7a commit eb30ab5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
STRING "Choose the type of build." FORCE)
endif()

# set(CMAKE_BUILD_TYPE "Release")
set(CMAKE_BUILD_TYPE "Release")

message(STATUS "Build configuration: ${CMAKE_BUILD_TYPE}")

Expand Down
11 changes: 4 additions & 7 deletions include/loki/common/pddl/persistent_factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,13 @@ class PersistentFactory {
// Ensure that element with identifier i is stored at position i.
assert((identifier == (m_persistent_vector.size()-1))
|| (identifier == m_persistent_vector.size()));
// The pointer to the location in persistent memory.
const auto* element_ptr = static_cast<HolderType*>(nullptr);
// Explicitly call the constructor of T to give exclusive access to the factory.
auto element = HolderType(std::move(SubType(identifier, std::forward<Args>(args)...)));
bool overwrite_last_element = (identifier == m_persistent_vector.size() - 1);
if (overwrite_last_element) {
element_ptr = &(m_persistent_vector[identifier] = std::move(element));
} else {
element_ptr = &(m_persistent_vector.push_back(std::move(element)));
}
// The pointer to the location in persistent memory.
const auto* element_ptr = overwrite_last_element
? &(m_persistent_vector[identifier] = std::move(element))
: &(m_persistent_vector.push_back(std::move(element)));
assert(element_ptr);
/* Test for uniqueness */
auto it = m_uniqueness_set.find(element_ptr);
Expand Down
3 changes: 2 additions & 1 deletion src/domain/pddl/parser/constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ pddl::ObjectList ConstantListVisitor::operator()(const std::vector<ast::Name>& n
// std::vector<ast::Name> has single base type "object"
assert(context.scopes.get<pddl::TypeImpl>("object").has_value());
const auto& [type, _position, _error_handler] = context.scopes.get<pddl::TypeImpl>("object").value();
const auto constant_list = parse_constant_definitions(name_nodes, pddl::TypeList{type}, context);
const auto type_list = pddl::TypeList{type};
const auto constant_list = parse_constant_definitions(name_nodes, type_list, context);
return constant_list;
}

Expand Down
5 changes: 3 additions & 2 deletions src/domain/pddl/parser/types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ pddl::TypeList TypeReferenceTypeVisitor::operator()(const ast::TypeEither& node)
// we flatten nested either types
auto type_list = pddl::TypeList();
for (auto& child_node : node.types) {
auto types = boost::apply_visitor(*this, child_node);
auto types = boost::apply_visitor(TypeReferenceTypeVisitor(context), child_node);
type_list.insert(type_list.end(), types.begin(), types.end());
}
return type_list;
Expand Down Expand Up @@ -160,7 +160,8 @@ pddl::TypeList TypeDeclarationTypedListOfNamesVisitor::operator()(const std::vec
// std::vector<domain::ast::Name> has single base type "object"
assert(context.scopes.get<pddl::TypeImpl>("object").has_value());
const auto& [type_object, _position, _error_handler] = context.scopes.get<pddl::TypeImpl>("object").value();
const auto type_list = parse_type_definitions(name_nodes, pddl::TypeList{type_object}, context);
const auto base_types = pddl::TypeList{type_object};
const auto type_list = parse_type_definitions(name_nodes, base_types, context);
return type_list;
}

Expand Down

0 comments on commit eb30ab5

Please sign in to comment.