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
31template class ::IceInternal::Handle<::armarx::Event>;
32
33armarx::Event::Event(std::string eventReceiverName, std::string eventName)
34{
35 this->eventReceiverName = eventReceiverName;
36 this->eventName = eventName;
37}
38
40armarx::Event::add(const std::string key, const armarx::Variant& value)
41{
42 properties[key] = new SingleVariant(value);
43 return this;
44}
45
47armarx::Event::add(const std::string key, const armarx::VariantContainerBasePtr& valueContainer)
48{
49 properties[key] = valueContainer->cloneContainer();
50 return this;
51}
52
53Ice::ObjectPtr
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}
EventPtr add(const std::string key, const Variant &value)
Definition Event.cpp:40
virtual EventPtr clone() const
Definition Event.cpp:61
Ice::ObjectPtr ice_clone() const override
Definition Event.cpp:54
The SingleVariant class is required to store single Variant instances in VariantContainer subclasses.
The Variant class is described here: Variants.
Definition Variant.h:224
IceInternal::Handle< Event > EventPtr
Typedef of EventPtr as IceInternal::Handle<Event> for convenience.
Definition Event.h:40