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
27 #include <MemoryX/interface/workingmemory/WorkingMemoryUpdaterBase.h>
28 #include <MemoryX/interface/memorytypes/MemorySegments.h>
29 
30 // std
31 #include <string>
32 #include <map>
33 #include <set>
34 
35 namespace armarx::VariantType
36 {
37  const armarx::VariantTypeId LocalizationQuery = armarx::Variant::addTypeName("::armarx::LocalizationQueryBase");
38 }
39 
40 namespace memoryx
41 {
42  class LocalizationQuery;
44 
45  /**
46  * @brief The LocalizationQuery class is used to create LocalizationJob instances and provide an interface to query if the jobs have finished running
47  */
49  virtual public LocalizationQueryBase
50  {
51  friend class LocalizationJob;
53  friend class armarx::GenericFactory<LocalizationQueryBase, LocalizationQuery>;
54 
55  public:
56  LocalizationQuery(const std::string& queryName, const std::string& objectClassName, int cycleTimeMS, int priority);
57 
58  /**
59  * @brief getFinished indicates if there are localization jobs in the queue which have not finished yet
60  * @return true if all localization jobs have finished running, false otherwise
61  */
62  bool getFinished();
63 
64  public:
65  // inherited from VariantDataClass
66  Ice::ObjectPtr ice_clone() const override
67  {
68  return this->clone();
69  }
70 
71  // inherited from variantdataclass
72  armarx::VariantDataClassPtr clone(const Ice::Current& c = Ice::emptyCurrent) const override
73  {
74  LocalizationQueryPtr query = new LocalizationQuery(queryName, className, cycleTimeMS, priority);
75  query->jobsFinished = jobsFinished;
76  return query;
77  }
78 
79  std::string output(const Ice::Current& c = Ice::emptyCurrent) const override
80  {
81  return "";
82  }
83 
84  int getType(const Ice::Current& c = Ice::emptyCurrent) const override
85  {
87  }
88 
89  bool validate(const Ice::Current& c = Ice::emptyCurrent) override
90  {
91  return true;
92  }
93 
94  void serialize(const ::armarx::ObjectSerializerBasePtr&, const Ice::Current& = Ice::emptyCurrent) const override {}
95  void deserialize(const ::armarx::ObjectSerializerBasePtr&, const Ice::Current& = Ice::emptyCurrent) override {}
96 
97  private:
99 
100  std::vector<LocalizationJobPtr> createJobs(const memoryx::ObjectClassMemorySegmentBasePtr& objectClassSegment);
101  void setJobFinished(std::string recognitionMethod);
102  ObjectClassPtr getLocalizableObjectClass(const EntityBasePtr& entity);
103 
104  std::mutex jobsMutex;
105  };
106 }
107 
memoryx::LocalizationQuery::validate
bool validate(const Ice::Current &c=Ice::emptyCurrent) override
Definition: LocalizationQuery.h:89
memoryx::LocalizationJob
The LocalizationJob class is the description of the basic workload executed by ObjectLocalizationMemo...
Definition: LocalizationJob.h:42
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
ObjectClass.h
memoryx::LocalizationQuery::output
std::string output(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: LocalizationQuery.h:79
IceInternal::Handle
Definition: forward_declarations.h:8
memoryx::LocalizationQuery::getType
int getType(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: LocalizationQuery.h:84
memoryx::LocalizationQuery
The LocalizationQuery class is used to create LocalizationJob instances and provide an interface to q...
Definition: LocalizationQuery.h:48
LocalizationJob.h
memoryx::ObjectLocalizationMemoryUpdater
Definition: ObjectLocalizationMemoryUpdater.h:90
memoryx::LocalizationQuery::serialize
void serialize(const ::armarx::ObjectSerializerBasePtr &, const Ice::Current &=Ice::emptyCurrent) const override
Definition: LocalizationQuery.h:94
armarx::VariantType
Definition: ChannelRef.h:160
armarx::VariantType::LocalizationQuery
const armarx::VariantTypeId LocalizationQuery
Definition: LocalizationQuery.h:37
armarx::VariantTypeId
Ice::Int VariantTypeId
Definition: Variant.h:44
armarx::GenericFactory
Definition: FactoryCollectionBase.h:51
memoryx::ObjectClassPtr
IceInternal::Handle< ObjectClass > ObjectClassPtr
Definition: ObjectClass.h:35
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36
memoryx::LocalizationQuery::ice_clone
Ice::ObjectPtr ice_clone() const override
Definition: LocalizationQuery.h:66
memoryx::LocalizationQuery::clone
armarx::VariantDataClassPtr clone(const Ice::Current &c=Ice::emptyCurrent) const override
Definition: LocalizationQuery.h:72
memoryx::LocalizationQuery::getFinished
bool getFinished()
getFinished indicates if there are localization jobs in the queue which have not finished yet
Definition: LocalizationQuery.cpp:104
memoryx::LocalizationQuery::deserialize
void deserialize(const ::armarx::ObjectSerializerBasePtr &, const Ice::Current &=Ice::emptyCurrent) override
Definition: LocalizationQuery.h:95
armarx::Variant::addTypeName
static VariantTypeId addTypeName(const std::string &typeName)
Register a new type for the use in a Variant.
Definition: Variant.cpp:751