Gazebo Gazebo

API Reference

3.15.1
gz/sim/TestFixture.hh
Go to the documentation of this file.
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 GZ_GAZEBO_TESTFIXTURE_HH_
18 #define GZ_GAZEBO_TESTFIXTURE_HH_
19 
20 #include <memory>
21 #include <string>
22 
24 #include "gz/sim/Export.hh"
25 #include "gz/sim/Server.hh"
26 #include "gz/sim/ServerConfig.hh"
27 
28 namespace ignition
29 {
30 namespace gazebo
31 {
32 // Inline bracket to help doxygen filtering.
33 inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE {
34 //
35 class IGNITION_GAZEBO_HIDDEN TestFixturePrivate;
55 class IGNITION_GAZEBO_VISIBLE TestFixture
56 {
59  public: explicit TestFixture(const std::string &_path);
60 
63  public: explicit TestFixture(const ServerConfig &_config);
64 
66  public: virtual ~TestFixture();
67 
72  public: TestFixture &OnConfigure(std::function<void(
73  const Entity &_entity,
76  EventManager &_eventMgr)> _cb);
77 
81  public: TestFixture &OnPreUpdate(std::function<void(
82  const UpdateInfo &, EntityComponentManager &)> _cb);
83 
87  public: TestFixture &OnUpdate(std::function<void(
88  const UpdateInfo &, EntityComponentManager &)> _cb);
89 
93  public: TestFixture &OnPostUpdate(std::function<void(
94  const UpdateInfo &, const EntityComponentManager &)> _cb);
95 
100  public: TestFixture &Finalize();
101 
104 
107  // TODO(chapulina) Use IGN_UTILS_UNIQUE_IMPL_PTR(dataPtr) when porting to v6
108  private: TestFixturePrivate *dataPtr;
109 };
110 }
111 }
112 }
113 #endif
Configuration parameters for a Server. An instance of this object can be used to construct a Server w...
Definition: gz/sim/ServerConfig.hh:43
uint64_t Entity
An Entity identifies a single object in simulation such as a model, link, or light....
Definition: gz/sim/Entity.hh:59
This library is part of the Ignition Robotics project.
STL class.
The EntityComponentManager constructs, deletes, and returns components and entities....
Definition: gz/sim/EntityComponentManager.hh:65
STL class.
TestFixture & OnPostUpdate(std::function< void(const UpdateInfo &, const EntityComponentManager &)> _cb)
Wrapper around a system's post-update callback.
std::shared_ptr< gz::sim::Server > Server() const
Get pointer to underlying server.
virtual ~TestFixture()
Destructor.
The EventManager is used to send/receive notifications of simulator events.
Definition: gz/sim/EventManager.hh:50
Helper class to write automated tests. It provides a convenient API to load a world file,...
Definition: gz/sim/TestFixture.hh:55
Information passed to systems on the update callback.
Definition: include/gz/sim/Types.hh:37
TestFixture & Finalize()
Finalize all the functions and add fixture to server. Finalize must be called before running the serv...
TestFixture & OnPreUpdate(std::function< void(const UpdateInfo &, EntityComponentManager &)> _cb)
Wrapper around a system's pre-update callback.
class IGNITION_GAZEBO_HIDDEN TestFixturePrivate
Definition: gz/sim/TestFixture.hh:35
The server instantiates and controls simulation.
Definition: gz/sim/Server.hh:114
TestFixture & OnUpdate(std::function< void(const UpdateInfo &, EntityComponentManager &)> _cb)
Wrapper around a system's update callback.
TestFixture & OnConfigure(std::function< void(const Entity &_entity, const std::shared_ptr< const sdf::Element > &_sdf, EntityComponentManager &_ecm, EventManager &_eventMgr)> _cb)
Wrapper around a system's pre-update callback.
TestFixture(const std::string &_path)
Constructor.