Skip to content

Commit

Permalink
Minor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
liambenson committed Dec 3, 2021
1 parent f33221b commit e331552
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/message_parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const RosValue::RosValuePointer MessageParser::parse() {
ros_values_->emplace_back(msg_def_.fieldIndexes());
ros_values_offset_ = 1;
initObject(0, msg_def_);
return RosValue::RosValuePointer(ros_values_, 0);
return RosValue::RosValuePointer(ros_values_);
}

void MessageParser::initObject(size_t object_offset, const RosMsgTypes::BaseMsgDef &object_definition) {
Expand Down
7 changes: 6 additions & 1 deletion lib/ros_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ class RosValue {
{
}

RosValuePointer(std::weak_ptr<std::vector<RosValue>> base, size_t index)
RosValuePointer(const std::weak_ptr<std::vector<RosValue>>& base)
: RosValuePointer(base, 0)
{
}

RosValuePointer(const std::weak_ptr<std::vector<RosValue>>& base, size_t index)
: VectorItemPointer<RosValue>(base.lock(), index)
{
}
Expand Down
4 changes: 2 additions & 2 deletions lib/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ class VectorItemPointer {
size_t index;

public:
VectorItemPointer(std::shared_ptr<std::vector<T>> base, size_t index)
VectorItemPointer(const std::shared_ptr<std::vector<T>>& base, size_t index)
: base(base)
, index(index)
{
}

VectorItemPointer(std::weak_ptr<std::vector<T>> base, size_t index)
VectorItemPointer(const std::weak_ptr<std::vector<T>>& base, size_t index)
: VectorItemPointer(base.lock(), index)
{
}
Expand Down

0 comments on commit e331552

Please sign in to comment.