Gazebo Sim

API Reference

7.7.0
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_SIM_TESTFIXTURE_HH_
18 #define GZ_SIM_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 gz
29 {
30 namespace sim
31 {
32 // Inline bracket to help doxygen filtering.
33 inline namespace GZ_SIM_VERSION_NAMESPACE {
34 //
35 class GZ_SIM_HIDDEN TestFixturePrivate;
57 class GZ_SIM_VISIBLE TestFixture
58 {
61  public: explicit TestFixture(const std::string &_path);
62 
65  public: explicit TestFixture(const ServerConfig &_config);
66 
68  public: virtual ~TestFixture();
69 
74  public: TestFixture &OnConfigure(std::function<void(
75  const Entity &_entity,
78  EventManager &_eventMgr)> _cb);
79 
83  public: TestFixture &OnPreUpdate(std::function<void(
84  const UpdateInfo &, EntityComponentManager &)> _cb);
85 
89  public: TestFixture &OnUpdate(std::function<void(
90  const UpdateInfo &, EntityComponentManager &)> _cb);
91 
95  public: TestFixture &OnPostUpdate(std::function<void(
96  const UpdateInfo &, const EntityComponentManager &)> _cb);
97 
102  public: TestFixture &Finalize();
103 
105  public: std::shared_ptr<sim::Server> Server() const;
106 
109  // TODO(chapulina) Use GZ_UTILS_UNIQUE_IMPL_PTR(dataPtr) when porting to v6
110  private: TestFixturePrivate *dataPtr;
111 };
112 }
113 }
114 }
115 #endif