Event.cpp
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
19  * @author
20  * @date
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 #include "Event.h"
25 
29 //#include <ArmarXCore/observers/variant/Variant.h>
30 
31 template class ::IceInternal::Handle<::armarx::Event>;
32 
33 armarx::Event::Event(std::string eventReceiverName, std::string eventName)
34 {
35  this->eventReceiverName = eventReceiverName;
36  this->eventName = eventName;
37 }
38 
40 {
41  properties[key] = new SingleVariant(value);
42  return this;
43 }
44 
45 armarx::EventPtr armarx::Event::add(const std::string key, const armarx::VariantContainerBasePtr& valueContainer)
46 {
47  properties[key] = valueContainer->cloneContainer();
48  return this;
49 }
50 
52 {
53  EventPtr newEvent = new Event(*this);
54  return newEvent;
55 }
56 
58 {
59  EventPtr newEvent = new Event(*this);
60  newEvent->properties.clear();
61 
62  for (StringVariantContainerBaseMap::const_iterator it = properties.begin(); it != properties.end(); it++)
63  {
64  newEvent->properties[it->first] = it->second->cloneContainer();
65  }
66 
67  return newEvent;
68 }
69 
70 
72 {
73  eventReceiverName = "";
74  eventName = "";
75 }
armarx::Variant
The Variant class is described here: Variants.
Definition: Variant.h:224
armarx::Event::clone
virtual EventPtr clone() const
Definition: Event.cpp:57
IceInternal::Handle< Event >
armarx::Event
An Event is used to communicate between e.g. condition handlers and statecharts.
Definition: Event.h:52
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:926
armarx::SingleVariant
The SingleVariant class is required to store single Variant instances in VariantContainer subclasses.
Definition: VariantContainer.h:109
Event.h
VariantListParameter.h
Parameter.h
VariantParameter.h
armarx::Event::Event
Event()
Definition: Event.cpp:71
armarx::Event::add
EventPtr add(const std::string key, const Variant &value)
Definition: Event.cpp:39
armarx::Event::ice_clone
Ice::ObjectPtr ice_clone() const override
Definition: Event.cpp:51
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36