Skip to content

Commit de6da01

Browse files
committed
create draft of ReferenceModels component
Signed-off-by: Ashton Larkin <[email protected]>
1 parent 0802698 commit de6da01

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* Copyright (C) 2021 Open Source Robotics Foundation
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
#ifndef IGNITION_GAZEBO_COMPONENTS_REFERENCEMODELS_HH_
18+
#define IGNITION_GAZEBO_COMPONENTS_REFERENCEMODELS_HH_
19+
20+
// TODO(adlarkin) add missing #include headers
21+
22+
namespace ignition
23+
{
24+
namespace gazebo
25+
{
26+
// Inline bracket to help doxygen filtering.
27+
inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
28+
namespace components
29+
{
30+
/// \brief Data structure that holds information about which models for
31+
/// a given link view this link as the model's canonical link
32+
struct ReferenceModelsInfo
33+
{
34+
/// \brief The models which this link serves as a canonical link for
35+
std::set<Entity> models;
36+
37+
// TODO(adlarkin) fill in methods below
38+
39+
// this should be called when a model is assigned to a canonical link
40+
public: bool AddModel(const Entity &_model);
41+
42+
// this should be called when a model is entity is removed/deleted
43+
public: bool RemoveModel(const Entity &_model);
44+
45+
public: bool operator==(const ReferenceModelsInfo &_info) const;
46+
47+
public: bool operator!=(const ReferenceModelsInfo &_info) const;
48+
};
49+
}
50+
51+
namespace serializers
52+
{
53+
/// \brief Serializer for ReferenceModelsInfo object
54+
class ReferenceModelsInfoSerializer
55+
{
56+
// TODO(adlarkin) write serialization methods
57+
};
58+
}
59+
60+
namespace components
61+
{
62+
/// \brief A component that gives a mapping between a link and all of the
63+
/// models this link serves as a canonical link for. This component should
64+
/// only be applied to links.
65+
using ReferenceModels =
66+
Component<ReferenceModelsInfo, class ReferenceModelsTag,
67+
serializers::ReferenceModelsInfoSerializer>;
68+
IGN_GAZEBO_REGISTER_COMPONENT("ign_gazebo_components.ReferenceModels",
69+
ReferenceModels)
70+
}
71+
}
72+
}
73+
}
74+
75+
#endif

0 commit comments

Comments
 (0)