Server.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2016 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 _SERVER_HH_
18 #define _SERVER_HH_
19 
20 #include <string>
21 #include <list>
22 
23 #include <sdf/sdf.hh>
24 
25 #include "gazebo/msgs/msgs.hh"
28 #include "gazebo/util/system.hh"
29 
30 
31 namespace gazebo
32 {
33  class Master;
34 
35  // forward declaration of private class
36  struct ServerPrivate;
37 
42  {
44  public: Server();
45 
47  public: virtual ~Server();
48 
50  public: void PrintUsage();
51 
56  public: bool ParseArgs(int _argc, char **_argv);
57 
60  public: bool PreLoad();
61 
66  public: bool LoadFile(const std::string &_filename="worlds/empty.world",
67  const std::string &_physics="");
68 
72  public: bool LoadString(const std::string &_sdfString);
73 
75  public: void Run();
76 
78  public: void Stop();
79 
81  public: void Fini();
82 
85  public: void SetParams(const common::StrStr_M &_params);
86 
89  public: bool GetInitialized() const;
90 
94  private: bool LoadImpl(sdf::ElementPtr _elem,
95  const std::string &_physics="");
96 
99  private: static void SigInt(int _v);
100 
102  private: void ProcessParams();
103 
106  private: void OnControl(ConstServerControlPtr &_msg);
107 
111  private: bool OpenWorld(const std::string &_filename);
112 
114  private: void ProcessControlMsgs();
115 
118  private: std::unique_ptr<ServerPrivate> dataPtr;
119  };
120 }
121 
122 #endif
Forward declarations for transport.
Definition: Server.hh:41
std::map< std::string, std::string > StrStr_M
Definition: CommonTypes.hh:120
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:59