package.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009, Willow Garage, Inc.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  * * Redistributions of source code must retain the above copyright notice,
7  * this list of conditions and the following disclaimer.
8  * * Redistributions in binary form must reproduce the above copyright
9  * notice, this list of conditions and the following disclaimer in the
10  * documentation and/or other materials provided with the distribution.
11  * * Neither the names of Stanford University or Willow Garage, Inc. nor the names of its
12  * contributors may be used to endorse or promote products derived from
13  * this software without specific prior written permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25  * POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #ifndef ROSLIB_PACKAGE_H
29 #define ROSLIB_PACKAGE_H
30 
31 #include <string>
32 #include <utility>
33 #include <vector>
34 #include <map>
35 
36 #if defined(__GNUC__)
37 # define ROS_DEPRECATED __attribute__((deprecated))
38 # define ROS_FORCE_INLINE __attribute__((always_inline))
39 #elif defined(_MSC_VER)
40 # define ROS_DEPRECATED
41 # define ROS_FORCE_INLINE __forceinline
42 #else
43 # define ROS_DEPRECATED
44 # define ROS_FORCE_INLINE inline
45 #endif
46 
47 /*
48  Windows import/export and gnu http://gcc.gnu.org/wiki/Visibility
49  macros.
50  */
51 
52 #if defined(_MSC_VER)
53 # define ROS_HELPER_IMPORT __declspec(dllimport)
54 # define ROS_HELPER_EXPORT __declspec(dllexport)
55 #elif __GNUC__ >= 4
56 # define ROS_HELPER_IMPORT __attribute__ ((visibility("default")))
57 # define ROS_HELPER_EXPORT __attribute__ ((visibility("default")))
58 #else
59 # define ROS_HELPER_IMPORT
60 # define ROS_HELPER_EXPORT
61 #endif
62 
63 // Ignore warnings about import/exports when deriving from std classes.
64 #ifdef _MSC_VER
65 # pragma warning(disable: 4251)
66 # pragma warning(disable: 4275)
67 #endif
68 
69 #ifdef ROS_BUILD_SHARED_LIBS // ros is being built around shared libraries
70 # ifdef roslib_EXPORTS // we are building a shared lib/dll
71 # define ROSLIB_DECL ROS_HELPER_EXPORT
72 # else // we are using shared lib/dll
73 # define ROSLIB_DECL ROS_HELPER_IMPORT
74 # endif
75 #else // ros is being built around static libraries
76 # define ROSLIB_DECL
77 #endif
78 
79 namespace ros
80 {
81 namespace package
82 {
83 
84 typedef std::vector<std::string> V_string;
85 typedef std::map<std::string, std::string> M_string;
86 
90 ROSLIB_DECL std::string command(const std::string& cmd);
91 
95 ROSLIB_DECL void command(const std::string& cmd, V_string& output);
99 ROSLIB_DECL std::string getPath(const std::string& package_name);
103 ROSLIB_DECL bool getAll(V_string& packages);
104 
109 ROSLIB_DECL void getPlugins(const std::string& package, const std::string& attribute, V_string& plugins, bool force_recrawl=false);
110 
133  const std::string& name,
134  const std::string& attribute,
135  std::vector<std::pair<std::string, std::string> >& exports,
136  bool force_recrawl=false
137 );
138 
147 ROS_DEPRECATED ROSLIB_DECL void getPlugins(const std::string& package, const std::string& attribute, M_string& plugins, bool force_recrawl=false);
148 
149 } // namespace package
150 } // namespace ros
151 
152 #endif
std::map< std::string, std::string > M_string
Definition: package.h:85
ROSLIB_DECL bool getAll(V_string &packages)
Gets a list of all packages. Returns false if it could not run the command.
std::vector< std::string > V_string
Definition: package.h:84
string package
ROSLIB_DECL std::string command(const std::string &cmd)
Runs a rospack command of the form &#39;rospack <cmd>&#39;, returning the output as a single string...
Definition: src/package.cpp:47
#define ROS_DEPRECATED
Definition: package.h:43
Definition: package.h:79
ROSLIB_DECL std::string getPath(const std::string &package_name)
Returns the fully-qualified path to a package, or an empty string if the package is not found...
Definition: src/package.cpp:89
ROSLIB_DECL void getPlugins(const std::string &package, const std::string &attribute, V_string &plugins, bool force_recrawl=false)
Call the "rospack plugins" command, eg. "rospack plugins --attrib=<attribute> <package>". Returns a vector of strings which are export values.
#define ROSLIB_DECL
Definition: package.h:76


roslib
Author(s): Ken Conley , Morgan Quigley , Josh Faust
autogenerated on Thu Apr 30 2020 06:30:15