constants.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * ArmarX is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation.
7  *
8  * ArmarX is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * @package VisionX::ArmarXObjects::armem_images
17  * @author Rainer Kartmann ( rainer dot kartmann at kit dot edu )
18  * @date 2021
19  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20  * GNU General Public License
21  */
22 
23 #pragma once
24 
25 // STD/STL
26 #include <map>
27 #include <string>
28 
29 // Simox
30 #include <SimoxUtility/algorithm/string.h>
31 
32 // RobotAPI
34 
35 // PCL
36 #include <pcl/point_types.h>
37 
38 // VisionX
39 #include <VisionX/interface/core/DataTypes.h>
40 
41 // Aron
42 #include <VisionX/libraries/armem/vision/pointcloud/core/aron/PointCloudXYZ.aron.generated.h>
43 #include <VisionX/libraries/armem/vision/pointcloud/core/aron/PointCloudXYZL.aron.generated.h>
44 #include <VisionX/libraries/armem/vision/pointcloud/core/aron/PointCloudXYZRGBA.aron.generated.h>
45 #include <VisionX/libraries/armem/vision/pointcloud/core/aron/PointCloudXYZRGBL.aron.generated.h>
46 
48 {
49  namespace util
50  {
51  template <class T1, class T2>
52  std::map<T2, T1>
53  InvertMap(const std::map<T1, T2>& m)
54  {
55  std::map<T2, T1> ret;
56  for (const auto& [key, val] : m)
57  {
58  ret.emplace(val, key);
59  }
60  return ret;
61  }
62 
63  template <class T>
64  std::map<T, std::string>
65  InvertMap(const std::map<std::string, T>& m)
66  {
67  return InvertMap<std::string, T>(m);
68  }
69 
70  template <class T>
71  std::map<std::string, T>
72  InvertMap(const std::map<T, std::string>& m)
73  {
74  return InvertMap<T, std::string>(m);
75  }
76  } // namespace util
77 
78  enum class PointType
79  {
80  PointXYZ,
81  PointXYZL,
84  };
85 
86  const constexpr char* POINT_XYZ_SLUG = "PointXYZ";
87  const constexpr char* POINT_XYZL_SLUG = "PointXYZL";
88  const constexpr char* POINT_XYZRGBA_SLUG = "PointXYZRGBA";
89  const constexpr char* POINT_XYZRGBL_SLUG = "PointXYZRGBL";
90 
91  std::map<PointType, std::string> PointType2String = {
92  {PointType::PointXYZ, simox::alg::to_lower(std::string(POINT_XYZ_SLUG))},
93  {PointType::PointXYZL, simox::alg::to_lower(std::string(POINT_XYZL_SLUG))},
94  {PointType::PointXYZRGBA, simox::alg::to_lower(std::string(POINT_XYZRGBA_SLUG))},
95  {PointType::PointXYZRGBL, simox::alg::to_lower(std::string(POINT_XYZRGBL_SLUG))}};
96 
97  std::map<std::string, PointType> String2PointType = util::InvertMap(PointType2String);
98 
99 
100 } // namespace visionx::armem::pointcloud
visionx::armem::pointcloud::String2PointType
std::map< std::string, PointType > String2PointType
Definition: constants.h:97
armarx::aron::ret
ReaderT::InputType T & ret
Definition: rw.h:21
visionx::armem::pointcloud::POINT_XYZ_SLUG
const constexpr char * POINT_XYZ_SLUG
Definition: constants.h:86
visionx::armem::pointcloud::PointType
PointType
Definition: constants.h:78
visionx::armem::pointcloud::util::InvertMap
std::map< T2, T1 > InvertMap(const std::map< T1, T2 > &m)
Definition: constants.h:53
visionx::armem::pointcloud::PointType2String
std::map< PointType, std::string > PointType2String
Definition: constants.h:91
forward_declarations.h
visionx::armem::pointcloud::PointType::PointXYZL
@ PointXYZL
visionx::armem::pointcloud
Definition: constants.cpp:3
visionx::armem::pointcloud::POINT_XYZRGBL_SLUG
const constexpr char * POINT_XYZRGBL_SLUG
Definition: constants.h:89
visionx::armem::pointcloud::PointType::PointXYZ
@ PointXYZ
visionx::armem::pointcloud::POINT_XYZL_SLUG
const constexpr char * POINT_XYZL_SLUG
Definition: constants.h:87
visionx::armem::pointcloud::PointType::PointXYZRGBL
@ PointXYZRGBL
visionx::armem::pointcloud::PointType::PointXYZRGBA
@ PointXYZRGBA
visionx::armem::pointcloud::POINT_XYZRGBA_SLUG
const constexpr char * POINT_XYZRGBA_SLUG
Definition: constants.h:88