-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
dds_stream now inherits from dds_stream_base #11036
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f88a7a7
fix throws; in locked_transfer::send_receive
maloel 1eae9e1
dds_stream now inherits from dds_stream_base
maloel 5ab1f58
fix bug in dds_stream_uid initialization
maloel 8e167ad
replace pyrealdds.device.foreach_stream() with .stream()
maloel f1bd18e
add stream checking to test-device-init
maloel 3a28c04
fix issue with union init in Linux (so pedantic...)
maloel e519dff
fix test-rgb-options-metadata-consistency check_equals types
maloel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ namespace realdds { | |
|
||
union dds_stream_uid | ||
{ | ||
uint32_t whole; | ||
uint32_t whole = 0; | ||
struct | ||
{ | ||
int16_t sid; // Stream ID; assigned by the server, but may not be unique because of index | ||
|
@@ -32,9 +32,11 @@ union dds_stream_uid | |
} | ||
|
||
dds_stream_uid( int sid_, int index_ ) | ||
: sid( static_cast< int16_t >( sid_ )) | ||
, index( static_cast< int8_t >( index_ )) | ||
{} | ||
{ | ||
whole = 0; // it covers an extra byte, which needs to be 0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to change in default constructor as well? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, the default uses the |
||
sid = static_cast<int16_t>( sid_ ); | ||
index = static_cast<int8_t>( index_ ); | ||
} | ||
|
||
std::string to_string() const; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,61 @@ | ||
// License: Apache 2.0. See LICENSE file in root directory. | ||
// Copyright(c) 2022 Intel Corporation. All Rights Reserved. | ||
|
||
#pragma once | ||
|
||
#include "dds-stream-profile.h" | ||
|
||
#include <functional> | ||
#include <memory> | ||
#include <string> | ||
|
||
namespace realdds { | ||
|
||
|
||
// Represents a stream of information (images, motion data, etc..) from a single source received via the DDS system. | ||
// A stream can have several profiles, i.e different data frequency, image resolution, etc.. | ||
class dds_stream | ||
{ | ||
public: | ||
virtual const std::string & get_group_name() const = 0; | ||
|
||
virtual size_t foreach_profile( std::function< void( const dds_stream_profile & prof, bool def_prof ) > fn ) const = 0; | ||
|
||
virtual ~dds_stream() = default; | ||
}; | ||
|
||
class dds_video_stream : public dds_stream | ||
{ | ||
public: | ||
dds_video_stream( const std::string & group_name ); | ||
|
||
const std::string & get_group_name() const override; | ||
|
||
void add_profile( dds_video_stream_profile && prof, bool default_profile ); | ||
size_t foreach_profile( std::function< void( const dds_stream_profile & prof, bool def_prof ) > fn ) const override; | ||
|
||
private: | ||
class impl; | ||
std::shared_ptr< impl > _impl; | ||
}; | ||
|
||
class dds_motion_stream : public dds_stream | ||
{ | ||
public: | ||
dds_motion_stream( const std::string & group_name ); | ||
|
||
const std::string & get_group_name() const override; | ||
|
||
void add_profile( dds_motion_stream_profile && prof, bool default_profile ); | ||
size_t foreach_profile( std::function< void( const dds_stream_profile & prof, bool def_prof ) > fn ) const override; | ||
|
||
private: | ||
class impl; | ||
std::shared_ptr< impl > _impl; | ||
}; | ||
|
||
|
||
} // namespace realdds | ||
// License: Apache 2.0. See LICENSE file in root directory. | ||
// Copyright(c) 2022 Intel Corporation. All Rights Reserved. | ||
|
||
#pragma once | ||
|
||
#include "dds-stream-base.h" | ||
#include "dds-stream-profile.h" | ||
|
||
#include <functional> | ||
#include <memory> | ||
#include <string> | ||
|
||
namespace realdds { | ||
|
||
|
||
// Represents a stream of information (images, motion data, etc..) from a single source received via the DDS system. | ||
// A stream can have several profiles, i.e different data frequency, image resolution, etc.. | ||
// | ||
// This is a base class: you need to specify the type of stream via the instantiation of a video_stream, etc. | ||
// | ||
class dds_stream : public dds_stream_base | ||
{ | ||
typedef dds_stream_base super; | ||
|
||
protected: | ||
dds_stream( std::string const & stream_name, std::string const & sensor_name ); | ||
|
||
// dds_stream_base | ||
public: | ||
bool is_open() const override; | ||
bool is_streaming() const override; | ||
|
||
std::shared_ptr< dds_topic > const & get_topic() const override; | ||
}; | ||
|
||
class dds_video_stream : public dds_stream | ||
{ | ||
typedef dds_stream super; | ||
|
||
public: | ||
dds_video_stream( std::string const & stream_name, std::string const & sensor_name ); | ||
|
||
private: | ||
class impl; | ||
std::shared_ptr< impl > _impl; | ||
}; | ||
|
||
class dds_motion_stream : public dds_stream | ||
{ | ||
typedef dds_stream super; | ||
|
||
public: | ||
dds_motion_stream( std::string const & stream_name, std::string const & sensor_name ); | ||
|
||
private: | ||
class impl; | ||
std::shared_ptr< impl > _impl; | ||
}; | ||
|
||
|
||
} // namespace realdds |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant
If a non-static data member has a default member initializer and also appears in a member initializer list, then the member initializer is used and the default member initializer is ignored
cppreference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hehe
And the default ctor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. It was hidden in a collapsed part of the code.
But seeing the two added initializations made me wonder which initialization prevails :-)