object_finders.cpp
Go to the documentation of this file.
1/**
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package RobotAPI::libraries::aron
17 * @author Philip Scherer ( ulila@student.kit.edu )
18 * @date 2021
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22
23#include "object_finders.h"
24
25namespace armarx::aron
26{
27 SubObjectFinder::SubObjectFinder(const std::string& typeNamePrefix) :
28 typeNamePrefix(typeNamePrefix)
29 {
30 }
31
32 const std::map<std::string, std::pair<aron::data::VariantPtr, aron::type::VariantPtr>>&
34 {
35 return foundSubObjects;
36 }
37
38 void
40 {
41 if (elementType && simox::alg::starts_with(elementType->getFullName(), typeNamePrefix))
42 {
43 foundSubObjects.emplace(elementData->getPath().toString(),
44 std::make_pair(elementData, elementType));
45 }
46 }
47
48 void
50 {
51 // Ignore (the base class throws an exception here)
52 }
53
56 {
57 return RecursiveConstTypedVariantVisitor::GetObjectElementsWithNullType(elementData,
58 elementType);
59 }
60} // namespace armarx::aron
const std::map< std::string, std::pair< aron::data::VariantPtr, aron::type::VariantPtr > > & getFoundObjects()
Get the objects that have been found.
MapElements getObjectElements(DataInput &elementData, TypeInput &elementType) override
SubObjectFinder(const std::string &typeNamePrefix)
void visitUnknown(DataInput &elementData, TypeInput &elementType) override
void visitObjectOnEnter(DataInput &elementData, TypeInput &elementType) override
typename TypedVisitorBase< const data::VariantPtr, const type::VariantPtr >::TypeInput TypeInput
typename TypedVisitorBase< const data::VariantPtr, const type::VariantPtr >::DataInput DataInput
std::map< std::string, std::pair< DataInputNonConst, TypeInputNonConst > > MapElements