Factory.cpp
Go to the documentation of this file.
1
/*
2
* This file is part of ArmarX.
3
*
4
* Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T),
5
* Karlsruhe Institute of Technology (KIT), all rights reserved.
6
*
7
* ArmarX is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License version 2 as
9
* published by the Free Software Foundation.
10
*
11
* ArmarX is distributed in the hope that it will be useful, but
12
* 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, see <http://www.gnu.org/licenses/>.
18
*
19
* @author Fabian Peller-Konrad (fabian dot peller-konrad at kit dot edu)
20
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
21
* GNU General Public License
22
*/
23
24
// STD/STL
25
26
// Header
27
#include "
Factory.h
"
28
29
// ArmarX
30
#include "
All.h
"
31
#include "enum/All.h"
32
33
namespace
armarx::aron::codegenerator::cpp
34
{
35
// Access method
36
std::unique_ptr<Generator>
GeneratorFactory::create
(
const
type::Variant
& n,
const
Path
& path)
const
37
{
38
auto
desc = n.
getDescriptor
();
39
switch
(desc)
40
{
41
case
type::Descriptor::LIST
:
return
std::make_unique<generator::List>(
dynamic_cast<
const
type::List
&
>
(n));
42
case
type::Descriptor::DICT
:
return
std::make_unique<generator::Dict>(
dynamic_cast<
const
type::Dict
&
>
(n));
43
case
type::Descriptor::OBJECT
:
return
std::make_unique<generator::Object>(
dynamic_cast<
const
type::Object
&
>
(n));
44
case
type::Descriptor::TUPLE
:
return
std::make_unique<generator::Tuple>(
dynamic_cast<
const
type::Tuple
&
>
(n));
45
case
type::Descriptor::PAIR
:
return
std::make_unique<generator::Pair>(
dynamic_cast<
const
type::Pair
&
>
(n));
46
case
type::Descriptor::NDARRAY
:
return
std::make_unique<generator::NDArray>(
dynamic_cast<
const
type::NDArray
&
>
(n));
47
case
type::Descriptor::MATRIX
:
return
std::make_unique<generator::Matrix>(
dynamic_cast<
const
type::Matrix
&
>
(n));
48
case
type::Descriptor::QUATERNION
:
return
std::make_unique<generator::Quaternion>(
dynamic_cast<
const
type::Quaternion
&
>
(n));
49
case
type::Descriptor::IMAGE
:
return
std::make_unique<generator::Image>(
dynamic_cast<
const
type::Image
&
>
(n));
50
case
type::Descriptor::POINTCLOUD
:
return
std::make_unique<generator::PointCloud>(
dynamic_cast<
const
type::PointCloud
&
>
(n));
51
case
type::Descriptor::INT_ENUM
:
return
std::make_unique<generator::IntEnum>(
dynamic_cast<
const
type::IntEnum
&
>
(n));
52
case
type::Descriptor::INT
:
return
std::make_unique<generator::Int>(
dynamic_cast<
const
type::Int
&
>
(n));
53
case
type::Descriptor::LONG
:
return
std::make_unique<generator::Long>(
dynamic_cast<
const
type::Long
&
>
(n));
54
case
type::Descriptor::FLOAT
:
return
std::make_unique<generator::Float>(
dynamic_cast<
const
type::Float
&
>
(n));
55
case
type::Descriptor::DOUBLE
:
return
std::make_unique<generator::Double>(
dynamic_cast<
const
type::Double
&
>
(n));
56
case
type::Descriptor::STRING
:
return
std::make_unique<generator::String>(
dynamic_cast<
const
type::String
&
>
(n));
57
case
type::Descriptor::BOOL
:
return
std::make_unique<generator::Bool>(
dynamic_cast<
const
type::Bool
&
>
(n));
58
case
type::Descriptor::ANY_OBJECT
:
return
std::make_unique<generator::AnyObject>(
dynamic_cast<
const
type::AnyObject
&
>
(n));
59
case
type::Descriptor::UNKNOWN
:
break
;
60
}
61
throw
error::AronEOFException
(__PRETTY_FUNCTION__);
62
}
63
64
}
armarx::aron::type::Descriptor::FLOAT
@ FLOAT
armarx::aron::type::AnyObject
The AnyObject class.
Definition:
AnyObject.h:37
armarx::aron::type::Descriptor::DOUBLE
@ DOUBLE
armarx::aron::codegenerator::cpp
Definition:
AnyObject.cpp:29
armarx::aron::type::Long
The Long class.
Definition:
Long.h:37
armarx::aron::type::Descriptor::IMAGE
@ IMAGE
armarx::aron::type::NDArray
The NDArray class.
Definition:
NDArray.h:38
armarx::aron::type::PointCloud
The PointCloud class.
Definition:
PointCloud.h:39
All.h
armarx::aron::type::List
The List class.
Definition:
List.h:39
armarx::aron::type::Int
The Int class.
Definition:
Int.h:37
armarx::aron::type::Descriptor::PAIR
@ PAIR
armarx::aron::type::Descriptor::LIST
@ LIST
armarx::aron::type::Object
The Object class.
Definition:
Object.h:42
armarx::aron::type::IntEnum
The IntEnum class.
Definition:
IntEnum.h:42
armarx::aron::type::Descriptor::NDARRAY
@ NDARRAY
armarx::aron::type::Tuple
The Tuple class.
Definition:
Tuple.h:39
armarx::aron::type::Quaternion
The Qaternion class.
Definition:
Quaternion.h:39
armarx::aron::Path
The Path class.
Definition:
Path.h:36
armarx::aron::type::Variant
The Variant class.
Definition:
Variant.h:59
armarx::aron::type::Descriptor::BOOL
@ BOOL
armarx::aron::error::AronEOFException
Definition:
Exception.h:72
armarx::aron::type::Dict
The Dict class.
Definition:
Dict.h:40
armarx::aron::type::Variant::getDescriptor
type::Descriptor getDescriptor() const
Definition:
Variant.h:93
armarx::aron::type::Descriptor::MATRIX
@ MATRIX
armarx::aron::type::Bool
The Bool class.
Definition:
Bool.h:37
armarx::aron::type::Descriptor::QUATERNION
@ QUATERNION
armarx::aron::codegenerator::cpp::GeneratorFactory::create
std::unique_ptr< Generator > create(const type::Variant &, const Path &) const
Definition:
Factory.cpp:36
armarx::aron::type::Pair
The Pair class.
Definition:
Pair.h:39
armarx::aron::type::Descriptor::STRING
@ STRING
armarx::aron::type::Descriptor::LONG
@ LONG
armarx::aron::type::Descriptor::INT
@ INT
armarx::aron::type::Descriptor::INT_ENUM
@ INT_ENUM
armarx::aron::type::Descriptor::OBJECT
@ OBJECT
armarx::aron::type::Descriptor::UNKNOWN
@ UNKNOWN
armarx::aron::type::Descriptor::DICT
@ DICT
armarx::aron::type::Descriptor::TUPLE
@ TUPLE
armarx::aron::type::Float
The Float class.
Definition:
Float.h:37
armarx::aron::type::Double
The Double class.
Definition:
Double.h:37
armarx::aron::type::Descriptor::POINTCLOUD
@ POINTCLOUD
armarx::aron::type::Image
The Image class.
Definition:
Image.h:39
Factory.h
armarx::aron::type::String
The String class.
Definition:
String.h:37
armarx::aron::type::Descriptor::ANY_OBJECT
@ ANY_OBJECT
armarx::aron::type::Matrix
The Matrix class.
Definition:
Matrix.h:39
RobotAPI
libraries
aron
codegeneration
codegenerator
codewriter
cpp
generator
Factory.cpp
Generated on Sat Oct 12 2024 09:14:09 for armarx_documentation by
1.8.17