-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is an internal-only refactoring that changes the mechanics of how the sdf/** file data is embedded into the library. For one, it solves the "static initialization order fiasco" for the embedded data. The data is only loaded into memory upon first use, instead of as the library is being loaded. It also simplifies the ruby embedding code, making it more concise. I hope this is easier to maintain, but it also helps me when sharing Drake with consumers that always build from source, but will not install ruby as a compile-time prerequisite The EmbeddedSdf codegen now emits the cc file with the data; the header is stored in git. This provides an easier way to use a function to retrieve the embedded strings as static locals. The embedded SDF data is now combined into a single map. Embedding files should be boring, ala the WIP std::embed specification. It should not include application-layer logic encoding upgrade paths. This will also make it easier to avoid the "static destruction fiasco" in future commits, due to fewer functions to repair. Signed-off-by: Jeremy Nimmer <jeremy.nimmer@tri.global>
- Loading branch information
1 parent
9eb6b99
commit 3bbd303
Showing
6 changed files
with
109 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2020 Open Source Robotics Foundation | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
*/ | ||
|
||
#ifndef SDF_EMBEDDEDSDF_HH_ | ||
#define SDF_EMBEDDEDSDF_HH_ | ||
|
||
#include <map> | ||
#include <string> | ||
|
||
#include "sdf/Types.hh" | ||
|
||
namespace sdf | ||
{ | ||
// Inline bracket to help doxygen filtering. | ||
inline namespace SDF_VERSION_NAMESPACE { | ||
// | ||
|
||
/// \internal | ||
|
||
/// A map where the keys are a source-relative pathnames within the "sdf" | ||
/// directory such as "1.8/root.sdf", and the values are the contents of | ||
/// that source file. | ||
const std::map<std::string, std::string> &GetEmbeddedSdf(); | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters