Skip to content

Added support for executors #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Sep 4, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 0 additions & 66 deletions rclcpp/include/rclcpp/Node.h

This file was deleted.

30 changes: 0 additions & 30 deletions rclcpp/include/rclcpp/Publisher.h

This file was deleted.

75 changes: 0 additions & 75 deletions rclcpp/include/rclcpp/Subscriber.h

This file was deleted.

75 changes: 75 additions & 0 deletions rclcpp/include/rclcpp/callback_group.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/* Copyright 2014 Open Source Robotics Foundation, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef RCLCPP_RCLCPP_CALLBACK_GROUP_HPP_
#define RCLCPP_RCLCPP_CALLBACK_GROUP_HPP_

#include <atomic>
#include <string>
#include <vector>

#include <rclcpp/subscription.hpp>
#include <rclcpp/timer.hpp>

namespace rclcpp
{

// Forward declarations for friend statement in class CallbackGroup
namespace node {class Node;}
namespace executor {class Executor;}

namespace callback_group
{

enum class CallbackGroupType {MutuallyExclusive, Reentrant};

class CallbackGroup
{
friend class rclcpp::node::Node;
friend class rclcpp::executor::Executor;
public:
RCLCPP_MAKE_SHARED_DEFINITIONS(CallbackGroup);

CallbackGroup(CallbackGroupType group_type)
: type_(group_type), can_be_taken_from_(true)
{}

private:
RCLCPP_DISABLE_COPY(CallbackGroup);

void
add_subscription(
const subscription::SubscriptionBase::SharedPtr &subscription_ptr)
{
subscription_ptrs_.push_back(subscription_ptr);
}

void
add_timer(const timer::TimerBase::SharedPtr &timer_ptr)
{
timer_ptrs_.push_back(timer_ptr);
}

CallbackGroupType type_;
std::vector<subscription::SubscriptionBase::SharedPtr> subscription_ptrs_;
std::vector<timer::TimerBase::SharedPtr> timer_ptrs_;
std::atomic_bool can_be_taken_from_;

};

} /* namespace callback_group */
} /* namespace rclcpp */

#endif /* RCLCPP_RCLCPP_CALLBACK_GROUP_HPP_ */
44 changes: 44 additions & 0 deletions rclcpp/include/rclcpp/context.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/* Copyright 2014 Open Source Robotics Foundation, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef RCLCPP_RCLCPP_CONTEXT_HPP_
#define RCLCPP_RCLCPP_CONTEXT_HPP_

#include <memory>

#include <rclcpp/macros.hpp>

namespace rclcpp
{
namespace context
{

/* ROS Context */
class Context
{
public:
RCLCPP_MAKE_SHARED_DEFINITIONS(Context);

Context() {}

private:
RCLCPP_DISABLE_COPY(Context);

};

} /* namespace context */
} /* namespace rclcpp */

#endif /* RCLCPP_RCLCPP_CONTEXT_HPP_ */
41 changes: 41 additions & 0 deletions rclcpp/include/rclcpp/contexts/default_context.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* Copyright 2014 Open Source Robotics Foundation, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef RCLCPP_RCLCPP_CONTEXTS_DEFAULT_CONTEXT_HPP_
#define RCLCPP_RCLCPP_CONTEXTS_DEFAULT_CONTEXT_HPP_

#include <rclcpp/context.hpp>

namespace rclcpp
{
namespace contexts
{
namespace default_context
{

class DefaultContext : public rclcpp::context::Context
{
public:
RCLCPP_MAKE_SHARED_DEFINITIONS(DefaultContext);

DefaultContext() {}

};

}
}
}

#endif /* RCLCPP_RCLCPP_CONTEXTS_DEFAULT_CONTEXT_HPP_ */
Loading