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 armarx::Event::add(const std::string key, const armarx::Variant& value)
41 {
42  properties[key] = new SingleVariant(value);
43  return this;
44 }
45 
47 armarx::Event::add(const std::string key, const armarx::VariantContainerBasePtr& valueContainer)
48 {
49  properties[key] = valueContainer->cloneContainer();
50  return this;
51 }
52 
55 {
56  EventPtr newEvent = new Event(*this);
57  return newEvent;
58 }
59 
62 {
63  EventPtr newEvent = new Event(*this);
64  newEvent->properties.clear();
65 
66  for (StringVariantContainerBaseMap::const_iterator it = properties.begin();
67  it != properties.end();
68  it++)
69  {
70  newEvent->properties[it->first] = it->second->cloneContainer();
71  }
72 
73  return newEvent;
74 }
75 
77 {
78  eventReceiverName = "";
79  eventName = "";
80 }
armarx::Variant
The Variant class is described here: Variants.
Definition: Variant.h:223
armarx::Event::clone
virtual EventPtr clone() const
Definition: Event.cpp:61
IceInternal::Handle< Event >
armarx::Event
An Event is used to communicate between e.g. condition handlers and statecharts.
Definition: Event.h:50
cxxopts::value
std::shared_ptr< Value > value()
Definition: cxxopts.hpp:855
armarx::SingleVariant
The SingleVariant class is required to store single Variant instances in VariantContainer subclasses.
Definition: VariantContainer.h:107
Event.h
VariantListParameter.h
Parameter.h
VariantParameter.h
armarx::Event::Event
Event()
Definition: Event.cpp:76
armarx::Event::add
EventPtr add(const std::string key, const Variant &value)
Definition: Event.cpp:40
armarx::Event::ice_clone
Ice::ObjectPtr ice_clone() const override
Definition: Event.cpp:54
armarx::aron::type::ObjectPtr
std::shared_ptr< Object > ObjectPtr
Definition: Object.h:36