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 <
ArmarXCore/core/system/ImportExport.h
>
28
29
#include <
ArmarXCore/observers/condition/TermImpl.h
>
30
#include <ArmarXCore/interface/observers/VariantBase.h>
31
#include <ArmarXCore/interface/observers/Event.h>
32
#include <
ArmarXCore/observers/variant/DatafieldRef.h
>
33
34
#include <IceUtil/Handle.h>
35
36
#include <string>
37
#include <memory>
38
#include <mutex>
39
40
41
namespace
armarx
42
{
43
class
ConditionRoot;
44
class
LiteralImpl;
45
46
/**
47
* Typedef of ConditionRootPtr as IceInternal::Handle<ConditionRoot> for convenience.
48
*/
49
using
ConditionRootPtr
=
IceInternal::Handle<ConditionRoot>
;
50
using
LiteralImplPtr
=
IceInternal::Handle<LiteralImpl>
;
51
52
/**
53
* @class ConditionRoot
54
* @brief ConditionRoot Condition roots are top-level nodes of the expression tree.
55
* @ingroup Conditions
56
*
57
* Condition roots are the root node of expression tree. They have an event as member, which is
58
* fires once the expression described by the tree is fulfilled.
59
*/
60
class
ARMARXCORE_IMPORT_EXPORT
ConditionRoot
:
61
virtual
public
TermImpl
,
62
virtual
public
ConditionRootBase
63
{
64
friend
class
ConditionHandler
;
65
template
<
class
BaseClass,
class
VariantClass>
66
friend
class
GenericFactory
;
67
68
public
:
69
/**
70
* Update state f the ConditionRoot object based on the child.
71
* Fire ConditionRoot::event if value is true.
72
* The event is only fired, if no previous event has been fired.
73
*/
74
void
update
(
const
Ice::Current&
c
= Ice::emptyCurrent)
override
;
75
void
updateWithData(
const
Ice::Current&
c
= Ice::emptyCurrent)
override
;
76
77
/**
78
* output to stream. pure virtual.
79
*
80
* @param stream
81
*/
82
void
output(std::ostream& out)
const override
;
83
84
protected
:
85
/**
86
* Creates an empty ConditionRoot. Used by Ice factory.
87
*/
88
ConditionRoot
();
89
90
/**
91
* Creates and initializes a ConditionRoot. Used by ConditionHandler.
92
*/
93
ConditionRoot
(
const
EventListenerInterfacePrx& listener,
const
EventBasePtr& event,
const
std::string& description,
bool
onlyFireOnce,
const
DatafieldRefList& refs);
94
95
public
:
96
/**
97
* stream operator for Condition
98
*/
99
friend
std::ostream&
operator<<
(std::ostream& stream,
const
ConditionRoot
& rhs)
100
{
101
rhs.
output
(stream);
102
103
return
stream;
104
}
105
106
/**
107
* stream operator for ConditionPtr
108
*/
109
friend
std::ostream&
operator<<
(std::ostream& stream,
const
ConditionRootPtr
& rhs)
110
{
111
rhs->output(stream);
112
113
return
stream;
114
}
115
116
static
std::vector<LiteralImplPtr> ExtractLiterals(
const
TermImplBasePtr& expression);
117
118
119
private
:
120
std::mutex updateMutex;
121
DatafieldRefList refs;
122
};
123
}
124
c
constexpr T c
Definition:
UnscentedKalmanFilterTest.cpp:43
armarx::ConditionHandler
Definition:
ConditionHandler.h:65
TermImpl.h
armarx::ConditionRoot::operator<<
friend std::ostream & operator<<(std::ostream &stream, const ConditionRootPtr &rhs)
stream operator for ConditionPtr
Definition:
ConditionRoot.h:109
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:67
armarx::ConditionRoot::operator<<
friend std::ostream & operator<<(std::ostream &stream, const ConditionRoot &rhs)
stream operator for Condition
Definition:
ConditionRoot.h:99
armarx::ConditionRoot::output
void output(std::ostream &out) const override
output to stream.
Definition:
ConditionRoot.cpp:121
armarx::ConditionRoot
ConditionRoot Condition roots are top-level nodes of the expression tree.
Definition:
ConditionRoot.h:60
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:28
ArmarXCore
observers
condition
ConditionRoot.h
Generated on Sat Oct 12 2024 09:14:02 for armarx_documentation by
1.8.17