ConditionRoot.h
Go to the documentation of this file.
1
/*
2
* This file is part of ArmarX.
3
*
4
* Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5
*
6
* ArmarX is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License version 2 as
8
* published by the Free Software Foundation.
9
*
10
* ArmarX is distributed in the hope that it will be useful, but
11
* WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
14
*
15
* You should have received a copy of the GNU General Public License
16
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
*
18
* @package ArmarX::Core
19
* @author Kai Welke (welke _at_ kit _dot_ edu)
20
* @date 2012
21
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22
* GNU General Public License
23
*/
24
25
#pragma once
26
27
#include <memory>
28
#include <mutex>
29
#include <string>
30
31
#include <IceUtil/Handle.h>
32
33
#include <
ArmarXCore/core/system/ImportExport.h
>
34
#include <ArmarXCore/interface/observers/Event.h>
35
#include <ArmarXCore/interface/observers/VariantBase.h>
36
#include <
ArmarXCore/observers/condition/TermImpl.h
>
37
#include <
ArmarXCore/observers/variant/DatafieldRef.h
>
38
39
namespace
armarx
40
{
41
class
ConditionRoot;
42
class
LiteralImpl;
43
44
/**
45
* Typedef of ConditionRootPtr as IceInternal::Handle<ConditionRoot> for convenience.
46
*/
47
using
ConditionRootPtr
=
IceInternal::Handle<ConditionRoot>
;
48
using
LiteralImplPtr
=
IceInternal::Handle<LiteralImpl>
;
49
50
/**
51
* @class ConditionRoot
52
* @brief ConditionRoot Condition roots are top-level nodes of the expression tree.
53
* @ingroup Conditions
54
*
55
* Condition roots are the root node of expression tree. They have an event as member, which is
56
* fires once the expression described by the tree is fulfilled.
57
*/
58
class
ARMARXCORE_IMPORT_EXPORT
ConditionRoot
:
59
virtual
public
TermImpl
,
60
virtual
public
ConditionRootBase
61
{
62
friend
class
ConditionHandler
;
63
template
<
class
BaseClass,
class
VariantClass>
64
friend
class
GenericFactory
;
65
66
public
:
67
/**
68
* Update state f the ConditionRoot object based on the child.
69
* Fire ConditionRoot::event if value is true.
70
* The event is only fired, if no previous event has been fired.
71
*/
72
void
update
(
const
Ice::Current&
c
= Ice::emptyCurrent)
override
;
73
void
updateWithData(
const
Ice::Current&
c
= Ice::emptyCurrent)
override
;
74
75
/**
76
* output to stream. pure virtual.
77
*
78
* @param stream
79
*/
80
void
output(std::ostream& out)
const override
;
81
82
protected
:
83
/**
84
* Creates an empty ConditionRoot. Used by Ice factory.
85
*/
86
ConditionRoot
();
87
88
/**
89
* Creates and initializes a ConditionRoot. Used by ConditionHandler.
90
*/
91
ConditionRoot
(
const
EventListenerInterfacePrx& listener,
92
const
EventBasePtr& event,
93
const
std::string& description,
94
bool
onlyFireOnce,
95
const
DatafieldRefList& refs);
96
97
public
:
98
/**
99
* stream operator for Condition
100
*/
101
friend
std::ostream&
102
operator<<
(std::ostream& stream,
const
ConditionRoot
& rhs)
103
{
104
rhs.
output
(stream);
105
106
return
stream;
107
}
108
109
/**
110
* stream operator for ConditionPtr
111
*/
112
friend
std::ostream&
113
operator<<
(std::ostream& stream,
const
ConditionRootPtr
& rhs)
114
{
115
rhs->output(stream);
116
117
return
stream;
118
}
119
120
static
std::vector<LiteralImplPtr> ExtractLiterals(
const
TermImplBasePtr& expression);
121
122
123
private
:
124
std::mutex updateMutex;
125
DatafieldRefList refs;
126
};
127
}
// namespace armarx
c
constexpr T c
Definition:
UnscentedKalmanFilterTest.cpp:46
armarx::ConditionHandler
Definition:
ConditionHandler.h:62
TermImpl.h
IceInternal::Handle
Definition:
forward_declarations.h:8
DatafieldRef.h
armarx::armem::server::ltm::util::mongodb::detail::update
bool update(mongocxx::collection &coll, const nlohmann::json &query, const nlohmann::json &update)
Definition:
mongodb.cpp:68
armarx::ConditionRoot::output
void output(std::ostream &out) const override
output to stream.
Definition:
ConditionRoot.cpp:129
armarx::operator<<
std::ostream & operator<<(std::ostream &os, const PythonApplicationManager::Paths &paths)
Definition:
PythonApplicationManager.cpp:285
armarx::ConditionRoot
ConditionRoot Condition roots are top-level nodes of the expression tree.
Definition:
ConditionRoot.h:58
ImportExport.h
armarx::GenericFactory
Definition:
FactoryCollectionBase.h:51
ARMARXCORE_IMPORT_EXPORT
#define ARMARXCORE_IMPORT_EXPORT
Definition:
ImportExport.h:38
armarx::TermImpl
Definition:
TermImpl.h:53
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition:
ArmarXTimeserver.cpp:27
ArmarXCore
observers
condition
ConditionRoot.h
Generated on Sat Mar 29 2025 09:17:21 for armarx_documentation by
1.8.17