Gazebo Physics

API Reference

2.6.2
gz/physics/CanWriteData.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 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 
18 #ifndef GZ_PHYSICS_CANWRITEDATA_HH_
19 #define GZ_PHYSICS_CANWRITEDATA_HH_
20 
22 
23 namespace ignition
24 {
25  namespace physics
26  {
31  struct IGNITION_PHYSICS_VISIBLE WriteOptions
32  {
37  public: bool skipMissingData;
38 
41  public: bool onlyWriteUnqueriedData;
42 
48  public: explicit WriteOptions(const bool _skipMissing = false,
49  const bool _onlyUnqueried = true);
50  };
51 
101  template <typename Derived, typename Specification>
103  {
107  public: CanWriteRequiredData();
108 
113  public: template <typename CompositeType>
114  void WriteRequiredData(
115  CompositeType &_data,
116  const WriteOptions &_options = WriteOptions()) const;
117  };
118 
122  template <typename Derived, typename Specification>
124  {
128  public: CanWriteExpectedData();
129 
138  public: template <typename CompositeType>
139  void WriteExpectedData(
140  CompositeType &_data,
141  const WriteOptions &_options = WriteOptions()) const;
142  };
143  }
144 }
145 
146 #include "gz/physics/detail/CanWriteData.hh"
147 
148 #endif
Definition: gz/physics/CanWriteData.hh:123
A struct that defines options for writing data to a CompositeData object.
Definition: gz/physics/CanWriteData.hh:31
WriteOptions(const bool _skipMissing=false, const bool _onlyUnqueried=true)
Default constructor.
void WriteExpectedData(CompositeType &_data, const WriteOptions &_options=WriteOptions()) const
void WriteRequiredData(CompositeType &_data, const WriteOptions &_options=WriteOptions()) const
Call this function to write all the types in _data that are listed as required in the Specification.
CanWriteRequiredData()
The ability to compile this constructor ensures that an inherited class has functions that can write ...
bool onlyWriteUnqueriedData
If a data type has already been queried, do not perform the write operation on it.
Definition: gz/physics/CanWriteData.hh:41
CanWriteRequiredData provides compile-time static analysis to ensure that the inheriting class provid...
Definition: gz/physics/CanWriteData.hh:102
bool skipMissingData
If a data type is not already part of the CompositeData, then skip it instead of writing to it when t...
Definition: gz/physics/CanWriteData.hh:37