LocalizationQuery.h
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 MemoryX::Observers
17* @author Kai Welke (welke at kit dot edu), David Schiebener (david dot schiebener at kit dot edu)
18* @copyright 2012 Humanoids Group, HIS, KIT
19* @license http://www.gnu.org/licenses/gpl-2.0.txt
20* GNU General Public License
21*/
22#pragma once
23
24// memoryx types
25#include <MemoryX/interface/memorytypes/MemorySegments.h>
26#include <MemoryX/interface/workingmemory/WorkingMemoryUpdaterBase.h>
29
30// std
31#include <map>
32#include <set>
33#include <string>
34
35namespace armarx::VariantType
36{
38 armarx::Variant::addTypeName("::armarx::LocalizationQueryBase");
39}
40
41namespace memoryx
42{
43 class LocalizationQuery;
45
46 /**
47 * @brief The LocalizationQuery class is used to create LocalizationJob instances and provide an interface to query if the jobs have finished running
48 */
49 class LocalizationQuery : virtual public LocalizationQueryBase
50 {
51 friend class LocalizationJob;
53 friend class armarx::GenericFactory<LocalizationQueryBase, LocalizationQuery>;
54
55 public:
56 LocalizationQuery(const std::string& queryName,
57 const std::string& objectClassName,
58 int cycleTimeMS,
59 int priority);
60
61 /**
62 * @brief getFinished indicates if there are localization jobs in the queue which have not finished yet
63 * @return true if all localization jobs have finished running, false otherwise
64 */
65 bool getFinished();
66
67 public:
68 // inherited from VariantDataClass
69 Ice::ObjectPtr
70 ice_clone() const override
71 {
72 return this->clone();
73 }
74
75 // inherited from variantdataclass
76 armarx::VariantDataClassPtr
77 clone(const Ice::Current& c = Ice::emptyCurrent) const override
78 {
80 new LocalizationQuery(queryName, className, cycleTimeMS, priority);
81 query->jobsFinished = jobsFinished;
82 return query;
83 }
84
85 std::string
86 output(const Ice::Current& c = Ice::emptyCurrent) const override
87 {
88 return "";
89 }
90
91 int
92 getType(const Ice::Current& c = Ice::emptyCurrent) const override
93 {
95 }
96
97 bool
98 validate(const Ice::Current& c = Ice::emptyCurrent) override
99 {
100 return true;
101 }
102
103 void
104 serialize(const ::armarx::ObjectSerializerBasePtr&,
105 const Ice::Current& = Ice::emptyCurrent) const override
106 {
107 }
108
109 void
110 deserialize(const ::armarx::ObjectSerializerBasePtr&,
111 const Ice::Current& = Ice::emptyCurrent) override
112 {
113 }
114
115 private:
117 {
118 }
119
120 std::vector<LocalizationJobPtr>
121 createJobs(const memoryx::ObjectClassMemorySegmentBasePtr& objectClassSegment);
122 void setJobFinished(std::string recognitionMethod);
123 ObjectClassPtr getLocalizableObjectClass(const EntityBasePtr& entity);
124
125 std::mutex jobsMutex;
126 };
127} // namespace memoryx
constexpr T c
static VariantTypeId addTypeName(const std::string &typeName)
Register a new type for the use in a Variant.
Definition Variant.cpp:869
The LocalizationQuery class is used to create LocalizationJob instances and provide an interface to q...
friend class ObjectLocalizationMemoryUpdater
int getType(const Ice::Current &c=Ice::emptyCurrent) const override
std::string output(const Ice::Current &c=Ice::emptyCurrent) const override
bool validate(const Ice::Current &c=Ice::emptyCurrent) override
bool getFinished()
getFinished indicates if there are localization jobs in the queue which have not finished yet
armarx::VariantDataClassPtr clone(const Ice::Current &c=Ice::emptyCurrent) const override
void serialize(const ::armarx::ObjectSerializerBasePtr &, const Ice::Current &=Ice::emptyCurrent) const override
void deserialize(const ::armarx::ObjectSerializerBasePtr &, const Ice::Current &=Ice::emptyCurrent) override
Ice::ObjectPtr ice_clone() const override
LocalizationQuery(const std::string &queryName, const std::string &objectClassName, int cycleTimeMS, int priority)
const armarx::VariantTypeId LocalizationQuery
Ice::Int VariantTypeId
Definition Variant.h:43
VirtualRobot headers.
IceInternal::Handle< LocalizationQuery > LocalizationQueryPtr
IceInternal::Handle< ObjectClass > ObjectClassPtr
Definition ObjectClass.h:35