Skip to content

Commit 32baa39

Browse files
committed
add microros precompiled libs
1 parent 048b481 commit 32baa39

129 files changed

Lines changed: 19295 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
987 KB
Binary file not shown.
984 KB
Binary file not shown.
989 KB
Binary file not shown.
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
// Copyright 2020 Open Source Robotics Foundation, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#ifndef RCL_LOGGING_INTERFACE__RCL_LOGGING_INTERFACE_H_
16+
#define RCL_LOGGING_INTERFACE__RCL_LOGGING_INTERFACE_H_
17+
18+
#include "rcl_logging_interface/visibility_control.h"
19+
#include "rcutils/allocator.h"
20+
21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif
24+
25+
typedef enum
26+
{
27+
RCL_LOGGING_RET_OK = 0,
28+
RCL_LOGGING_RET_ERROR = 2,
29+
RCL_LOGGING_RET_INVALID_ARGUMENT = 11,
30+
RCL_LOGGING_RET_CONFIG_FILE_DOESNT_EXIST = 21,
31+
RCL_LOGGING_RET_CONFIG_FILE_INVALID = 22,
32+
} rcl_logging_ret_t;
33+
34+
/// Initialize the external logging library.
35+
/**
36+
* \param[in] config_file The location of a config file that the external
37+
* logging library should use to configure itself.
38+
* If provided, it must be a null terminated C string.
39+
* If set to NULL or the empty string, the logging library will use defaults.
40+
* \param[in] allocator The allocator to use for memory allocation. This is
41+
* an rcutils_allocator_t rather than an rcl_allocator_t to ensure that the
42+
* rcl_logging_* packages don't have a circular dependency back to rcl.
43+
* \return RCL_LOGGING_RET_OK if initialized successfully.
44+
* \return RCL_LOGGING_RET_ERROR if an unspecified error occurs.
45+
* \return RCL_LOGGING_RET_CONFIG_FILE_DOESNT_EXIST if a config_file is provided
46+
* but the file doesn't exist.
47+
* \return RCL_LOGGING_RET_CONFIG_FILE_INVALID if a config_file is provided but
48+
* the logging backend doesn't understand it.
49+
*/
50+
RCL_LOGGING_INTERFACE_PUBLIC
51+
RCUTILS_WARN_UNUSED
52+
rcl_logging_ret_t
53+
rcl_logging_external_initialize(const char * config_file, rcutils_allocator_t allocator);
54+
55+
/// Free the resources allocated for the external logging system.
56+
/**
57+
* This puts the system into a state equivalent to being uninitialized.
58+
*
59+
* \return RCL_LOGGING_RET_OK if successfully shutdown, or
60+
* \return RCL_LOGGING_RET_ERROR if an unspecified error occurs.
61+
*/
62+
RCL_LOGGING_INTERFACE_PUBLIC
63+
RCUTILS_WARN_UNUSED
64+
rcl_logging_ret_t
65+
rcl_logging_external_shutdown();
66+
67+
/// Log a message.
68+
/**
69+
* \param[in] severity The severity level of the message being logged.
70+
* \param[in] name The name of the logger, must either be a null terminated
71+
* C string or NULL.
72+
* If NULL or empty the root logger will be used.
73+
* \param[in] msg The message to be logged. Must be a null terminated C string.
74+
*/
75+
RCL_LOGGING_INTERFACE_PUBLIC
76+
void
77+
rcl_logging_external_log(int severity, const char * name, const char * msg);
78+
79+
/// Set the severity level for a logger.
80+
/**
81+
* This function sets the severity level for the specified logger.
82+
* If the name provided is an empty string or NULL it will change the level of
83+
* the root logger.
84+
*
85+
* \param[in] name The name of the logger.
86+
* Must be a null terminated C string or NULL.
87+
* \param[in] level The severity level to be used for the specified logger.
88+
* \return RCL_LOGGING_RET_OK if set successfully, or
89+
* \return RCL_LOGGING_RET_ERROR if an unspecified error occurs.
90+
*/
91+
RCL_LOGGING_INTERFACE_PUBLIC
92+
RCUTILS_WARN_UNUSED
93+
rcl_logging_ret_t rcl_logging_external_set_logger_level(const char * name, int level);
94+
95+
/// Get the logging directory.
96+
/**
97+
* Uses various environment variables to construct a logging directory path.
98+
*
99+
* Use $ROS_LOG_DIR if ROS_LOG_DIR is set and not empty.
100+
* Otherwise, use $ROS_HOME/log, using ~/.ros for ROS_HOME if not set or if empty.
101+
*
102+
* It also expands an initial '~' to the current user's home directory,
103+
* and converts the path separator if necessary.
104+
*
105+
* If successful, the directory C string should be deallocated using the given allocator when it is
106+
* no longer needed.
107+
*
108+
* \param[in] allocator The allocator to use for memory allocation.
109+
* \param[out] directory The C string pointer at which to write the directory path.
110+
* Only meaningful if the call is successful. Must not be nullptr and must point to nullptr.
111+
* \return RCL_LOGGING_RET_OK if successful, or
112+
* \return RCL_LOGGING_RET_INVALID_ARGUMENT if any arguments are invalid, or
113+
* \return RCL_LOGGING_RET_ERROR if an unspecified error occurs.
114+
*/
115+
RCL_LOGGING_INTERFACE_PUBLIC
116+
rcl_logging_ret_t
117+
rcl_logging_get_logging_directory(rcutils_allocator_t allocator, char ** directory);
118+
119+
#ifdef __cplusplus
120+
}
121+
#endif
122+
123+
#endif // RCL_LOGGING_INTERFACE__RCL_LOGGING_INTERFACE_H_
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
// Copyright 2020 Open Source Robotics Foundation, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#ifndef RCL_LOGGING_INTERFACE__VISIBILITY_CONTROL_H_
16+
#define RCL_LOGGING_INTERFACE__VISIBILITY_CONTROL_H_
17+
18+
#ifdef __cplusplus
19+
extern "C" {
20+
#endif
21+
22+
// This logic was borrowed (then namespaced) from the examples on the gcc wiki:
23+
// https://gcc.gnu.org/wiki/Visibility
24+
25+
#if defined _WIN32 || defined __CYGWIN__
26+
#ifdef __GNUC__
27+
#define RCL_LOGGING_INTERFACE_EXPORT __attribute__ ((dllexport))
28+
#define RCL_LOGGING_INTERFACE_IMPORT __attribute__ ((dllimport))
29+
#else
30+
#define RCL_LOGGING_INTERFACE_EXPORT __declspec(dllexport)
31+
#define RCL_LOGGING_INTERFACE_IMPORT __declspec(dllimport)
32+
#endif
33+
#ifdef RCL_LOGGING_INTERFACE_BUILDING_DLL
34+
#define RCL_LOGGING_INTERFACE_PUBLIC RCL_LOGGING_INTERFACE_EXPORT
35+
#else
36+
#define RCL_LOGGING_INTERFACE_PUBLIC RCL_LOGGING_INTERFACE_IMPORT
37+
#endif
38+
#define RCL_LOGGING_INTERFACE_PUBLIC_TYPE RCL_LOGGING_INTERFACE_PUBLIC
39+
#define RCL_LOGGING_INTERFACE_LOCAL
40+
#else
41+
#define RCL_LOGGING_INTERFACE_EXPORT __attribute__ ((visibility("default")))
42+
#define RCL_LOGGING_INTERFACE_IMPORT
43+
#if __GNUC__ >= 4
44+
#define RCL_LOGGING_INTERFACE_PUBLIC __attribute__ ((visibility("default")))
45+
#define RCL_LOGGING_INTERFACE_LOCAL __attribute__ ((visibility("hidden")))
46+
#else
47+
#define RCL_LOGGING_INTERFACE_PUBLIC
48+
#define RCL_LOGGING_INTERFACE_LOCAL
49+
#endif
50+
#define RCL_LOGGING_INTERFACE_PUBLIC_TYPE
51+
#endif
52+
53+
#ifdef __cplusplus
54+
}
55+
#endif
56+
57+
#endif // RCL_LOGGING_INTERFACE__VISIBILITY_CONTROL_H_
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
// Copyright 2015 Open Source Robotics Foundation, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
/// \file
16+
17+
#ifndef RCUTILS__ALLOCATOR_H_
18+
#define RCUTILS__ALLOCATOR_H_
19+
20+
#ifdef __cplusplus
21+
extern "C"
22+
{
23+
#endif
24+
25+
#include <stdbool.h>
26+
#include <stddef.h>
27+
28+
#include "rcutils/macros.h"
29+
#include "rcutils/types/rcutils_ret.h"
30+
#include "rcutils/visibility_control.h"
31+
32+
/// Encapsulation of an allocator.
33+
/**
34+
* The default allocator uses malloc(), free(), calloc(), and realloc().
35+
* It can be obtained using rcutils_get_default_allocator().
36+
*
37+
* The allocator should be trivially copyable.
38+
* Meaning that the struct should continue to work after being assignment
39+
* copied into a new struct.
40+
* Specifically the object pointed to by the state pointer should remain valid
41+
* until all uses of the allocator have been made.
42+
* Particular care should be taken when giving an allocator to functions like
43+
* rcutils_*_init() where it is stored within another object and used later.
44+
* Developers should note that, while the fields of a const-qualified allocator
45+
* struct cannot be modified, the state of the allocator can be modified.
46+
*/
47+
typedef struct rcutils_allocator_s
48+
{
49+
/// Allocate memory, given a size and the `state` pointer.
50+
/** An error should be indicated by returning `NULL`. */
51+
void * (*allocate)(size_t size, void * state);
52+
/// Deallocate previously allocated memory, mimicking free().
53+
/** Also takes the `state` pointer. */
54+
void (* deallocate)(void * pointer, void * state);
55+
/// Reallocate if possible, otherwise it deallocates and allocates.
56+
/**
57+
* Also takes the `state` pointer.
58+
*
59+
* If unsupported then do deallocate and then allocate.
60+
* This should behave as realloc() does, as opposed to posix's
61+
* [reallocf](https://linux.die.net/man/3/reallocf), i.e. the memory given
62+
* by pointer will not be free'd automatically if realloc() fails.
63+
* For reallocf-like behavior use rcutils_reallocf().
64+
* This function must be able to take an input pointer of `NULL` and succeed.
65+
*/
66+
void * (*reallocate)(void * pointer, size_t size, void * state);
67+
/// Allocate memory with all elements set to zero, given a number of elements and their size.
68+
/** An error should be indicated by returning `NULL`. */
69+
void * (*zero_allocate)(size_t number_of_elements, size_t size_of_element, void * state);
70+
/// Implementation defined state storage.
71+
/**
72+
* This is passed as the final parameter to other allocator functions.
73+
* Note that the contents of the state can be modified even in const-qualified
74+
* allocator objects.
75+
*/
76+
void * state;
77+
} rcutils_allocator_t;
78+
79+
/// Return a zero initialized allocator.
80+
/**
81+
* Note that this is an invalid allocator and should only be used as a placeholder.
82+
*/
83+
RCUTILS_PUBLIC
84+
RCUTILS_WARN_UNUSED
85+
rcutils_allocator_t
86+
rcutils_get_zero_initialized_allocator(void);
87+
88+
/// Set rcutils default allocators.
89+
/**
90+
* <hr>
91+
* Attribute | Adherence
92+
* ------------------ | -------------
93+
* Allocates Memory | No
94+
* Thread-Safe | Yes
95+
* Uses Atomics | No
96+
* Lock-Free | Yes
97+
*/
98+
RCUTILS_PUBLIC
99+
RCUTILS_WARN_UNUSED
100+
bool
101+
rcutils_set_default_allocator(rcutils_allocator_t * allocator);
102+
103+
/// Return a properly initialized rcutils_allocator_t with default values.
104+
/**
105+
* This defaults to:
106+
*
107+
* - allocate = wraps malloc()
108+
* - deallocate = wraps free()
109+
* - reallocate = wraps realloc()
110+
* - zero_allocate = wraps calloc()
111+
* - state = `NULL`
112+
*
113+
* <hr>
114+
* Attribute | Adherence
115+
* ------------------ | -------------
116+
* Allocates Memory | No
117+
* Thread-Safe | Yes
118+
* Uses Atomics | No
119+
* Lock-Free | Yes
120+
*/
121+
RCUTILS_PUBLIC
122+
RCUTILS_WARN_UNUSED
123+
rcutils_allocator_t
124+
rcutils_get_default_allocator(void);
125+
126+
/// Return true if the given allocator has non-null function pointers.
127+
/**
128+
* \param[in] allocator to be checked by the function
129+
* \return `true` if the allocator is valid, `false` otherwise.
130+
*/
131+
RCUTILS_PUBLIC
132+
RCUTILS_WARN_UNUSED
133+
bool
134+
rcutils_allocator_is_valid(const rcutils_allocator_t * allocator);
135+
136+
/// Check the given allocator and run fail_statement if it is not valid.
137+
#define RCUTILS_CHECK_ALLOCATOR(allocator, fail_statement) \
138+
if (!rcutils_allocator_is_valid(allocator)) { \
139+
fail_statement; \
140+
}
141+
142+
/// Check the given allocator, and set the message in msg and run fail_statement if it is not valid.
143+
#define RCUTILS_CHECK_ALLOCATOR_WITH_MSG(allocator, msg, fail_statement) \
144+
if (!rcutils_allocator_is_valid(allocator)) { \
145+
RCUTILS_SET_ERROR_MSG(msg); \
146+
fail_statement; \
147+
}
148+
149+
/// Emulate the behavior of [reallocf](https://linux.die.net/man/3/reallocf).
150+
/**
151+
* This function will return `NULL` if the allocator is `NULL` or has `NULL` for
152+
* function pointer fields.
153+
* \param[inout] pointer to the memory which will be reallocated
154+
* \param[in] size in bytes
155+
* \param[in] allocator to be used to allocate and deallocate memory
156+
*/
157+
RCUTILS_PUBLIC
158+
RCUTILS_WARN_UNUSED
159+
void *
160+
rcutils_reallocf(void * pointer, size_t size, rcutils_allocator_t * allocator);
161+
162+
#ifdef __cplusplus
163+
}
164+
#endif
165+
166+
#endif // RCUTILS__ALLOCATOR_H_

0 commit comments

Comments
 (0)