diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 000000000..9a874b576 Binary files /dev/null and b/.DS_Store differ diff --git a/format_schema.py b/format_schema.py new file mode 100644 index 000000000..1a6e415fe --- /dev/null +++ b/format_schema.py @@ -0,0 +1,72 @@ +import os + +lines = os.listdir('./sdf/1.11/') +# Only keep the files that end with .sdf +lines = [line for line in lines if line.endswith('.sdf')] + +for line in lines: + # Remove .sdf extension + snake_case = line.strip().split('.')[0] + + # Convert from snake_case to CamelCase + camel_case = ''.join([word.capitalize() for word in snake_case.split('_')]) + + addHeader = """ + /// \\brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + """ + + addImpl = f""" +///////////////////////////////////////////////// +const std::string& {camel_case}::SchemaFile() +{{ + static const std::string* kSchemaFile = new std::string("{line}"); + return *kSchemaFile; +}}""" + + addTest = f"""EXPECT_EQ({camel_case}::SchemaFile(), "{line}");""" + + # Debug print statements + # print(addHeader) + # print(addImpl) + # print(addTest) + # print("\n") + + # Edit './include/sdf/{camel_case}.hh' + # Find the line with 'class SDFFORMAT_VISIBLE {camel_case}` + try: + f = open('./include/sdf/' + camel_case + '.hh', 'r') + lines = f.readlines() + f.close() + line_number = 0 + for i, line in enumerate(lines): + if line == " class SDFORMAT_VISIBLE " + camel_case + '\n': + line_number = i+3 # After the class line there is `\n{\n` and then the constructor + break + if line_number == 0: + print("Error: Could not find class declaration in " + camel_case + ".hh") + exit(1) + + try: + with open('./include/sdf/' + camel_case + '.hh', 'w') as file: + for i, line in enumerate(lines): + file.write(line) + if i == line_number: + file.write(addHeader) + except: + print("Unexpected error while writing to: " + camel_case + ".hh.") + except: + print("Error while writing to: " + camel_case + ".hh." + " Check if file exists.") + + # Edit './src/{camel_case}.cc' if it exists + # Add implementation to end of document + if os.path.exists('./src/' + camel_case + '.cc'): + with open('./src/' + camel_case + '.cc', 'a') as file: + file.write(addImpl) + else: + print("Error: Could not find " + camel_case + ".cc") + + print("Changes written to source successfully") + + # TODO: Add tests + # Edit './test/{camel_case}_TEST.cc' diff --git a/include/sdf/Actor.hh b/include/sdf/Actor.hh index 509ae58a9..239c20ce8 100644 --- a/include/sdf/Actor.hh +++ b/include/sdf/Actor.hh @@ -193,6 +193,9 @@ namespace sdf /// \brief Default constructor public: Actor(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the actor based on a element pointer. This is *not* the /// usual entry point. Typical usage of the SDF DOM is through the Root /// object. diff --git a/include/sdf/AirPressure.hh b/include/sdf/AirPressure.hh index 798474dd5..85e6b7f29 100644 --- a/include/sdf/AirPressure.hh +++ b/include/sdf/AirPressure.hh @@ -36,6 +36,9 @@ namespace sdf /// \brief Default constructor public: AirPressure(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the airPressure based on an element pointer. /// This is *not* the usual entry point. Typical usage of the SDF DOM is /// through the Root object. diff --git a/include/sdf/AirSpeed.hh b/include/sdf/AirSpeed.hh index 90a1be025..93f51ca69 100644 --- a/include/sdf/AirSpeed.hh +++ b/include/sdf/AirSpeed.hh @@ -36,6 +36,9 @@ namespace sdf /// \brief Default constructor public: AirSpeed(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the air speed based on an element pointer. /// This is *not* the usual entry point. Typical usage of the SDF DOM is /// through the Root object. diff --git a/include/sdf/Altimeter.hh b/include/sdf/Altimeter.hh index c27a6daf1..047d51d1f 100644 --- a/include/sdf/Altimeter.hh +++ b/include/sdf/Altimeter.hh @@ -35,6 +35,9 @@ namespace sdf /// \brief Default constructor public: Altimeter(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the altimeter based on an element pointer. This is *not* /// the usual entry point. Typical usage of the SDF DOM is through the Root /// object. diff --git a/include/sdf/Atmosphere.hh b/include/sdf/Atmosphere.hh index ed4042128..83e102215 100644 --- a/include/sdf/Atmosphere.hh +++ b/include/sdf/Atmosphere.hh @@ -47,6 +47,9 @@ namespace sdf /// \brief Default constructor public: Atmosphere(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the atmosphere based on a element pointer. This is *not* the /// usual entry point. Typical usage of the SDF DOM is through the Root /// object. diff --git a/include/sdf/Camera.hh b/include/sdf/Camera.hh index 5c46827c8..14eb59260 100644 --- a/include/sdf/Camera.hh +++ b/include/sdf/Camera.hh @@ -62,6 +62,9 @@ namespace sdf /// \brief Constructor public: Camera(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Return true if both Camera objects contain the same values. /// \param[_in] _alt Camera value to compare. /// \returen True if 'this' == _alt. diff --git a/include/sdf/Collision.hh b/include/sdf/Collision.hh index 2ab4114ce..1c6186e47 100644 --- a/include/sdf/Collision.hh +++ b/include/sdf/Collision.hh @@ -52,6 +52,9 @@ namespace sdf /// \brief Default constructor public: Collision(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the collision based on a element pointer. This is *not* the /// usual entry point. Typical usage of the SDF DOM is through the Root /// object. diff --git a/include/sdf/ForceTorque.hh b/include/sdf/ForceTorque.hh index 2a9a693ed..5b9493972 100644 --- a/include/sdf/ForceTorque.hh +++ b/include/sdf/ForceTorque.hh @@ -66,6 +66,9 @@ namespace sdf /// \brief Default constructor public: ForceTorque(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the force torque sensor based on an element pointer. This is /// *not* the usual entry point. Typical usage of the SDF DOM is through the /// Root object. diff --git a/include/sdf/Frame.hh b/include/sdf/Frame.hh index cecb63ea9..e8cd9cc8a 100644 --- a/include/sdf/Frame.hh +++ b/include/sdf/Frame.hh @@ -44,6 +44,9 @@ namespace sdf /// \brief Default constructor public: Frame(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the frame based on a element pointer. This is *not* the /// usual entry point. Typical usage of the SDF DOM is through the Root /// object. diff --git a/include/sdf/Geometry.hh b/include/sdf/Geometry.hh index 35fd1e1cd..9cd3156a8 100644 --- a/include/sdf/Geometry.hh +++ b/include/sdf/Geometry.hh @@ -90,6 +90,9 @@ namespace sdf /// \brief Default constructor public: Geometry(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the geometry based on a element pointer. This is *not* the /// usual entry point. Typical usage of the SDF DOM is through the Root /// object. diff --git a/include/sdf/Gui.hh b/include/sdf/Gui.hh index 67435fdb0..a8c487c78 100644 --- a/include/sdf/Gui.hh +++ b/include/sdf/Gui.hh @@ -33,6 +33,9 @@ namespace sdf /// \brief Default constructor public: Gui(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the gui based on a element pointer. This is *not* the /// usual entry point. Typical usage of the SDF DOM is through the Root /// object. diff --git a/include/sdf/Imu.hh b/include/sdf/Imu.hh index e3ced1181..4def15fab 100644 --- a/include/sdf/Imu.hh +++ b/include/sdf/Imu.hh @@ -35,6 +35,9 @@ namespace sdf /// \brief Default constructor public: Imu(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the IMU based on an element pointer. This is *not* /// the usual entry point. Typical usage of the SDF DOM is through the Root /// object. diff --git a/include/sdf/Joint.hh b/include/sdf/Joint.hh index 26c4b226f..4f859fb63 100644 --- a/include/sdf/Joint.hh +++ b/include/sdf/Joint.hh @@ -87,6 +87,9 @@ namespace sdf /// \brief Default constructor public: Joint(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the joint based on a element pointer. This is *not* the /// usual entry point. Typical usage of the SDF DOM is through the Root /// object. diff --git a/include/sdf/Lidar.hh b/include/sdf/Lidar.hh index 89cfa612b..253f66a8b 100644 --- a/include/sdf/Lidar.hh +++ b/include/sdf/Lidar.hh @@ -107,6 +107,9 @@ namespace sdf /// \brief Default constructor public: Lidar(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the lidar based on an element pointer. This is *not* /// the usual entry point. Typical usage of the SDF DOM is through the Root /// object. diff --git a/include/sdf/Light.hh b/include/sdf/Light.hh index fc19e02f1..1f97c9a97 100644 --- a/include/sdf/Light.hh +++ b/include/sdf/Light.hh @@ -65,6 +65,9 @@ namespace sdf /// \brief Default constructor public: Light(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the light based on a element pointer. This is *not* the /// usual entry point. Typical usage of the SDF DOM is through the Root /// object. diff --git a/include/sdf/Link.hh b/include/sdf/Link.hh index 3e5260e73..714a8a39c 100644 --- a/include/sdf/Link.hh +++ b/include/sdf/Link.hh @@ -53,6 +53,9 @@ namespace sdf /// \brief Default constructor public: Link(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the link based on a element pointer. This is *not* the /// usual entry point. Typical usage of the SDF DOM is through the Root /// object. diff --git a/include/sdf/Magnetometer.hh b/include/sdf/Magnetometer.hh index 3f6d9ae74..88b9676e9 100644 --- a/include/sdf/Magnetometer.hh +++ b/include/sdf/Magnetometer.hh @@ -36,6 +36,9 @@ namespace sdf /// \brief Default constructor public: Magnetometer(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the magnetometer based on an element pointer. This is *not* /// the usual entry point. Typical usage of the SDF DOM is through the Root /// object. diff --git a/include/sdf/Material.hh b/include/sdf/Material.hh index 6891a8899..c2a5c069a 100644 --- a/include/sdf/Material.hh +++ b/include/sdf/Material.hh @@ -48,6 +48,9 @@ namespace sdf /// \brief Default constructor public: Material(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the material based on a element pointer. This is *not* the /// usual entry point. Typical usage of the SDF DOM is through the Root /// object. diff --git a/include/sdf/Model.hh b/include/sdf/Model.hh index 86cc3d422..3923467d8 100644 --- a/include/sdf/Model.hh +++ b/include/sdf/Model.hh @@ -56,6 +56,9 @@ namespace sdf /// \brief Default constructor public: Model(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the model based on a element pointer. This is *not* the /// usual entry point. Typical usage of the SDF DOM is through the Root /// object. diff --git a/include/sdf/NavSat.hh b/include/sdf/NavSat.hh index 9b1677d77..8b69becfc 100644 --- a/include/sdf/NavSat.hh +++ b/include/sdf/NavSat.hh @@ -76,7 +76,10 @@ namespace sdf { /// \brief Default constructor public: NavSat(); - /// \brief Load the navsat based on an element pointer. This is *not* + + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the navsat based on an element pointer. This is *not* /// the usual entry point. Typical usage of the SDF DOM is through the Root /// object. /// \param[in] _sdf The SDF Element pointer diff --git a/include/sdf/Noise.hh b/include/sdf/Noise.hh index 361e12f7e..a1a3b72fb 100644 --- a/include/sdf/Noise.hh +++ b/include/sdf/Noise.hh @@ -49,6 +49,9 @@ namespace sdf /// \brief Default constructor public: Noise(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Return true if both Noise objects contain the same values. /// \param[_in] _noise Noise value to compare. /// \return True if 'this' == _noise. diff --git a/include/sdf/ParticleEmitter.hh b/include/sdf/ParticleEmitter.hh index bf592de24..23ff8a0f4 100644 --- a/include/sdf/ParticleEmitter.hh +++ b/include/sdf/ParticleEmitter.hh @@ -62,6 +62,9 @@ namespace sdf /// \brief Default constructor public: ParticleEmitter(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the particle emitter based on an element pointer. This is /// *not* the usual entry point. Typical usage of the SDF DOM is through /// the Root object. diff --git a/include/sdf/Physics.hh b/include/sdf/Physics.hh index 0fa5ea5ef..078282c5f 100644 --- a/include/sdf/Physics.hh +++ b/include/sdf/Physics.hh @@ -38,6 +38,9 @@ namespace sdf /// \brief Default constructor public: Physics(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the physics based on an element pointer. This is *not* the /// usual entry point. Typical usage of the SDF DOM is through the Root /// object. diff --git a/include/sdf/Plugin.hh b/include/sdf/Plugin.hh index def211593..1efe7fc9f 100644 --- a/include/sdf/Plugin.hh +++ b/include/sdf/Plugin.hh @@ -47,6 +47,9 @@ namespace sdf /// \brief Default constructor public: Plugin(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Default destructor public: ~Plugin(); diff --git a/include/sdf/Projector.hh b/include/sdf/Projector.hh index b13fd8797..befe7c834 100644 --- a/include/sdf/Projector.hh +++ b/include/sdf/Projector.hh @@ -45,6 +45,9 @@ namespace sdf /// \brief Default constructor public: Projector(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the projector based on an element pointer. This is /// *not* the usual entry point. Typical usage of the SDF DOM is through /// the Root object. diff --git a/include/sdf/Root.hh b/include/sdf/Root.hh index 9ad5f1632..2e342163e 100644 --- a/include/sdf/Root.hh +++ b/include/sdf/Root.hh @@ -59,6 +59,9 @@ namespace sdf /// \brief Default constructor public: Root(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Get the name of the world without loading the entire world /// Users shouldn't normally need to use this API. /// This doesn't load the world, it might return the world name even if the diff --git a/include/sdf/Scene.hh b/include/sdf/Scene.hh index e11f51596..4760a9f5d 100644 --- a/include/sdf/Scene.hh +++ b/include/sdf/Scene.hh @@ -35,6 +35,9 @@ namespace sdf /// \brief Default constructor public: Scene(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the scene based on a element pointer. This is *not* the /// usual entry point. Typical usage of the SDF DOM is through the Root /// object. diff --git a/include/sdf/Sensor.hh b/include/sdf/Sensor.hh index 7b62572ec..479b8a31f 100644 --- a/include/sdf/Sensor.hh +++ b/include/sdf/Sensor.hh @@ -142,6 +142,9 @@ namespace sdf /// \brief Default constructor public: Sensor(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the sensor based on a element pointer. This is *not* the /// usual entry point. Typical usage of the SDF DOM is through the Root /// object. diff --git a/include/sdf/Surface.hh b/include/sdf/Surface.hh index 02fd98be5..4afdcf684 100644 --- a/include/sdf/Surface.hh +++ b/include/sdf/Surface.hh @@ -161,6 +161,9 @@ namespace sdf /// \brief Default constructor public: Surface(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the surface based on a element pointer. This is *not* the /// usual entry point. Typical usage of the SDF DOM is through the Root /// object. diff --git a/include/sdf/Visual.hh b/include/sdf/Visual.hh index ff9da957f..7ac38dadb 100644 --- a/include/sdf/Visual.hh +++ b/include/sdf/Visual.hh @@ -50,6 +50,9 @@ namespace sdf /// \brief Default constructor public: Visual(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the visual based on a element pointer. This is *not* the /// usual entry point. Typical usage of the SDF DOM is through the Root /// object. diff --git a/include/sdf/World.hh b/include/sdf/World.hh index 7e449abab..144bb48ac 100644 --- a/include/sdf/World.hh +++ b/include/sdf/World.hh @@ -60,6 +60,9 @@ namespace sdf /// \brief Default constructor public: World(); + /// \brief Get the schema file name accessor + public: static const std::string& SchemaFile(); + /// \brief Load the world based on a element pointer. This is *not* the /// usual entry point. Typical usage of the SDF DOM is through the Root /// object. diff --git a/sdf/1.11/forcetorque.sdf b/sdf/1.11/force_torque.sdf similarity index 100% rename from sdf/1.11/forcetorque.sdf rename to sdf/1.11/force_torque.sdf diff --git a/sdf/1.11/navsat.sdf b/sdf/1.11/nav_sat.sdf similarity index 100% rename from sdf/1.11/navsat.sdf rename to sdf/1.11/nav_sat.sdf diff --git a/src/Actor.cc b/src/Actor.cc index 0a0eebb93..3bdb37ca5 100644 --- a/src/Actor.cc +++ b/src/Actor.cc @@ -819,3 +819,10 @@ void Actor::AddPlugin(const Plugin &_plugin) { this->dataPtr->plugins.push_back(_plugin); } + +///////////////////////////////////////////////// +const std::string& Actor::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("actor.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/AirPressure.cc b/src/AirPressure.cc index 9cc58a8a0..e2de6e8da 100644 --- a/src/AirPressure.cc +++ b/src/AirPressure.cc @@ -139,3 +139,10 @@ sdf::ElementPtr AirPressure::ToElement(sdf::Errors &_errors) const return elem; } + +///////////////////////////////////////////////// +const std::string& AirPressure::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("air_pressure.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/AirSpeed.cc b/src/AirSpeed.cc index 2ca0e16c9..27d5e2e33 100644 --- a/src/AirSpeed.cc +++ b/src/AirSpeed.cc @@ -106,3 +106,10 @@ sdf::ElementPtr AirSpeed::ToElement() const return elem; } + +///////////////////////////////////////////////// +const std::string& AirSpeed::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("air_speed.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Altimeter.cc b/src/Altimeter.cc index 83fcad037..d445a9587 100644 --- a/src/Altimeter.cc +++ b/src/Altimeter.cc @@ -169,3 +169,10 @@ sdf::ElementPtr Altimeter::ToElement(sdf::Errors &_errors) const return elem; } + +///////////////////////////////////////////////// +const std::string& Altimeter::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("altimeter.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Atmosphere.cc b/src/Atmosphere.cc index 597504658..34517c77b 100644 --- a/src/Atmosphere.cc +++ b/src/Atmosphere.cc @@ -172,3 +172,10 @@ sdf::ElementPtr Atmosphere::ToElement(sdf::Errors &_errors) const return elem; } + +///////////////////////////////////////////////// +const std::string& Atmosphere::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("atmosphere.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Camera.cc b/src/Camera.cc index 2f2ea7a2b..a1af42571 100644 --- a/src/Camera.cc +++ b/src/Camera.cc @@ -1337,3 +1337,10 @@ sdf::ElementPtr Camera::ToElement() const return elem; } + +///////////////////////////////////////////////// +const std::string& Camera::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("camera.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Collision.cc b/src/Collision.cc index ca944712d..56b01942e 100644 --- a/src/Collision.cc +++ b/src/Collision.cc @@ -392,3 +392,10 @@ sdf::ElementPtr Collision::ToElement(sdf::Errors &_errors) const return elem; } + +///////////////////////////////////////////////// +const std::string& Collision::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("collision.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/ForceTorque.cc b/src/ForceTorque.cc index 4386629c1..d39f759e8 100644 --- a/src/ForceTorque.cc +++ b/src/ForceTorque.cc @@ -367,3 +367,10 @@ sdf::ElementPtr ForceTorque::ToElement(sdf::Errors &_errors) const return elem; } + +///////////////////////////////////////////////// +const std::string& ForceTorque::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("force_torque.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Frame.cc b/src/Frame.cc index de9870915..db59a5cd8 100644 --- a/src/Frame.cc +++ b/src/Frame.cc @@ -250,3 +250,10 @@ sdf::ElementPtr Frame::ToElement(sdf::Errors &_errors) const return elem; } + +///////////////////////////////////////////////// +const std::string& Frame::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("frame.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Geometry.cc b/src/Geometry.cc index 9afb20212..a513a1478 100644 --- a/src/Geometry.cc +++ b/src/Geometry.cc @@ -421,3 +421,10 @@ sdf::ElementPtr Geometry::ToElement(sdf::Errors &_errors) const return elem; } + +///////////////////////////////////////////////// +const std::string& Geometry::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("geometry.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Gui.cc b/src/Gui.cc index f64fd61ca..d84ee0be2 100644 --- a/src/Gui.cc +++ b/src/Gui.cc @@ -147,3 +147,10 @@ sdf::Plugins &Gui::Plugins() } + +///////////////////////////////////////////////// +const std::string& Gui::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("gui.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Imu.cc b/src/Imu.cc index 65ea2e6e6..7bd1a4c1e 100644 --- a/src/Imu.cc +++ b/src/Imu.cc @@ -454,3 +454,10 @@ sdf::ElementPtr Imu::ToElement(sdf::Errors &_errors) const return elem; } + +///////////////////////////////////////////////// +const std::string& Imu::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("imu.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Joint.cc b/src/Joint.cc index 2b8fd8282..6b8c74078 100644 --- a/src/Joint.cc +++ b/src/Joint.cc @@ -630,3 +630,10 @@ void Joint::ClearSensors() { this->dataPtr->sensors.clear(); } + +///////////////////////////////////////////////// +const std::string& Joint::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("joint.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Lidar.cc b/src/Lidar.cc index 56803c695..fa513ec0f 100644 --- a/src/Lidar.cc +++ b/src/Lidar.cc @@ -450,3 +450,10 @@ sdf::ElementPtr Lidar::ToElement() const return elem; } + +///////////////////////////////////////////////// +const std::string& Lidar::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("lidar.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Light.cc b/src/Light.cc index 02fb48001..9d363b0b9 100644 --- a/src/Light.cc +++ b/src/Light.cc @@ -556,3 +556,10 @@ sdf::ElementPtr Light::ToElement(sdf::Errors &_errors) const _errors, this->SpotFalloff()); return elem; } + +///////////////////////////////////////////////// +const std::string& Light::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("light.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Link.cc b/src/Link.cc index 085feab93..0b24fdd9f 100644 --- a/src/Link.cc +++ b/src/Link.cc @@ -1060,3 +1060,10 @@ sdf::ElementPtr Link::ToElement() const return elem; } + +///////////////////////////////////////////////// +const std::string& Link::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("link.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Magnetometer.cc b/src/Magnetometer.cc index 80498158d..f9c8e40d3 100644 --- a/src/Magnetometer.cc +++ b/src/Magnetometer.cc @@ -155,3 +155,10 @@ sdf::ElementPtr Magnetometer::ToElement() const return elem; } + +///////////////////////////////////////////////// +const std::string& Magnetometer::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("magnetometer.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Material.cc b/src/Material.cc index 6a0456686..c6ebb18c4 100644 --- a/src/Material.cc +++ b/src/Material.cc @@ -528,3 +528,10 @@ sdf::ElementPtr Material::ToElement(sdf::Errors &_errors) const return elem; } + +///////////////////////////////////////////////// +const std::string& Material::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("material.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Model.cc b/src/Model.cc index 944e50b87..6655e94de 100644 --- a/src/Model.cc +++ b/src/Model.cc @@ -1414,3 +1414,10 @@ sdf::Frame Model::PrepareForMerge(sdf::Errors &_errors, return proxyFrame; } + +///////////////////////////////////////////////// +const std::string& Model::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("model.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/NavSat.cc b/src/NavSat.cc index 8ab7d7e64..e62784266 100644 --- a/src/NavSat.cc +++ b/src/NavSat.cc @@ -191,3 +191,10 @@ bool NavSat::operator!=(const NavSat &_navsat) const { return !(*this == _navsat); } + +///////////////////////////////////////////////// +const std::string& NavSat::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("nav_sat.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Noise.cc b/src/Noise.cc index b4507e957..9f20c318e 100644 --- a/src/Noise.cc +++ b/src/Noise.cc @@ -300,3 +300,10 @@ sdf::ElementPtr Noise::ToElement(sdf::Errors &_errors) const return elem; } + +///////////////////////////////////////////////// +const std::string& Noise::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("noise.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/ParticleEmitter.cc b/src/ParticleEmitter.cc index 605b58812..bc9812695 100644 --- a/src/ParticleEmitter.cc +++ b/src/ParticleEmitter.cc @@ -573,3 +573,10 @@ sdf::ElementPtr ParticleEmitter::ToElement(sdf::Errors &_errors) const } + +///////////////////////////////////////////////// +const std::string& ParticleEmitter::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("particle_emitter.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Physics.cc b/src/Physics.cc index b9dd69317..8b7caac5e 100644 --- a/src/Physics.cc +++ b/src/Physics.cc @@ -232,3 +232,10 @@ sdf::ElementPtr Physics::ToElement(sdf::Errors &_errors) const return elem; } + +///////////////////////////////////////////////// +const std::string& Physics::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("physics.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Plugin.cc b/src/Plugin.cc index c85563519..dc46327ba 100644 --- a/src/Plugin.cc +++ b/src/Plugin.cc @@ -311,3 +311,10 @@ bool Plugin::operator!=(const Plugin &_plugin) const { return !(*this == _plugin); } + +///////////////////////////////////////////////// +const std::string& Plugin::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("plugin.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Projector.cc b/src/Projector.cc index b8c1f7b98..dd7e2d331 100644 --- a/src/Projector.cc +++ b/src/Projector.cc @@ -331,3 +331,10 @@ sdf::ElementPtr Projector::ToElement() const return elem; } + +///////////////////////////////////////////////// +const std::string& Projector::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("projector.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Root.cc b/src/Root.cc index 03349d2af..7a5972e01 100644 --- a/src/Root.cc +++ b/src/Root.cc @@ -644,3 +644,10 @@ sdf::ElementPtr Root::ToElement(const OutputConfig &_config) const return elem; } + +///////////////////////////////////////////////// +const std::string& Root::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("root.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Scene.cc b/src/Scene.cc index 429d16aee..304e359ef 100644 --- a/src/Scene.cc +++ b/src/Scene.cc @@ -212,3 +212,10 @@ sdf::ElementPtr Scene::ToElement(sdf::Errors &_errors) const return elem; } + +///////////////////////////////////////////////// +const std::string& Scene::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("scene.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Sensor.cc b/src/Sensor.cc index 78ac7087b..37decf82e 100644 --- a/src/Sensor.cc +++ b/src/Sensor.cc @@ -848,3 +848,10 @@ void Sensor::AddPlugin(const Plugin &_plugin) { this->dataPtr->plugins.push_back(_plugin); } + +///////////////////////////////////////////////// +const std::string& Sensor::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("sensor.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Surface.cc b/src/Surface.cc index 5bc84970d..5c7afe03f 100644 --- a/src/Surface.cc +++ b/src/Surface.cc @@ -431,3 +431,10 @@ sdf::ElementPtr Surface::ToElement(sdf::Errors &_errors) const return elem; } + +///////////////////////////////////////////////// +const std::string& Surface::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("surface.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/Visual.cc b/src/Visual.cc index 5ffdf3d33..b64146223 100644 --- a/src/Visual.cc +++ b/src/Visual.cc @@ -378,3 +378,10 @@ void Visual::AddPlugin(const Plugin &_plugin) { this->dataPtr->plugins.push_back(_plugin); } + +///////////////////////////////////////////////// +const std::string& Visual::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("visual.sdf"); + return *kSchemaFile; +} \ No newline at end of file diff --git a/src/World.cc b/src/World.cc index d94ff685a..0f1eea436 100644 --- a/src/World.cc +++ b/src/World.cc @@ -1271,3 +1271,10 @@ void World::AddPlugin(const Plugin &_plugin) { this->dataPtr->plugins.push_back(_plugin); } + +///////////////////////////////////////////////// +const std::string& World::SchemaFile() +{ + static const std::string* kSchemaFile = new std::string("world.sdf"); + return *kSchemaFile; +} \ No newline at end of file