Main Page · Modules · All Classes · Class Hierarchy
MSData.cpp
1 /*
2  * This file is part of the AiBO+ project
3  *
4  * Copyright (C) 2005-2016 Csaba Kertész (csaba.kertesz@gmail.com)
5  *
6  * AiBO+ is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * AiBO+ is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
19  *
20  */
21 
22 #include "MSData.hpp"
23 
24 #include <MCLog.hpp>
25 
26 MSData::MSData(const QString& type_name) : TypeName(type_name)
27 {
28  if (TypeName.isEmpty())
29  {
30  MC_ERROR("Type name is not defined at the initialization list of the inherited class ctor.");
31  }
32 }
33 
34 
35 MSData::MSData(const MSData& other)
36 {
37  VariableMap = other.VariableMap;
38  TypeName = other.TypeName;
39 }
40 
41 
42 QString MSData::GetTypeName() const
43 {
44  return TypeName;
45 }
46 
47 
48 void* MSData::operator[](const QString& variable) const
49 {
50  return VariableMap[variable];
51 }
52 
53 
54 const QMap<QString, void*>& MSData::GetVariableMap() const
55 {
56  return VariableMap;
57 }
58 
59 
61 {
62  Q_UNUSED(data)
63  return *this;
64 }
65 
66 
68 {
69  Q_UNUSED(data)
70  return *this;
71 }
virtual MSData & operator=(MSData &data)
Copy assignment operator.
Definition: MSData.cpp:60
QMap< QString, void * > VariableMap
Variable map.
Definition: MSData.hpp:151
#define MC_ERROR(...)
Error macro.
Definition: MCLog.hpp:45
const QMap< QString, void * > & GetVariableMap() const
Get the variable map.
Definition: MSData.cpp:54
Base class for the data exchange of the elements.
Definition: MSData.hpp:54
MSData(const QString &type_name)
Class constructor.
Definition: MSData.cpp:26
QString TypeName
Type name.
Definition: MSData.hpp:153
QString GetTypeName() const
Get the type name.
Definition: MSData.cpp:42
void * operator[](const QString &variable) const
operator[] to resolve variable pointers
Definition: MSData.cpp:48