Skip to content

Commit

Permalink
add comments to classes API
Browse files Browse the repository at this point in the history
  • Loading branch information
Nir-Az committed Jul 22, 2021
1 parent d728ad9 commit bf3eb5f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/serialized-utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ device_info json_preset_reader::read_device_info() const
return info;
}

bool json_preset_reader::check_device_info( const device_interface & device ) const
void json_preset_reader::check_device_info( const device_interface & device ) const
{
// Looks for device information
if( ! _device_info.product_line.empty()
Expand Down Expand Up @@ -75,8 +75,6 @@ bool json_preset_reader::check_device_info( const device_interface & device ) co
throw librealsense::invalid_value_exception(
"preset device FW version is lower than the connected device FW version" );
}

return true;
}

json json_preset_reader::get_value(json j, const std::string& field_key) const
Expand Down
21 changes: 20 additions & 1 deletion src/serialized-utilities.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,25 @@ namespace librealsense

// C'tor may throw
json_preset_reader( const std::string &json_content );
bool check_device_info( const device_interface& device ) const;

// Compares the device info fields on the preset json against the connected device.
// if not match, it throws an informative exception
void check_device_info( const device_interface& device ) const;

// search for a key, if found it returns an iterator to it, works together with the end() function
// example of use:
// if (reader.find(key) != reader.end())
// {....}
json::const_iterator find(const std::string& key) const;
device_info get_device_info() const;

// Allow override device info to allow ignoring some fields when checking device comparability.
void override_device_info(const device_info& info);

// for use together with find() function, same use as on STL containers.
json::const_iterator end() const;

// return only the parameters section
json get_params() const { return *_parameters; };

protected:
Expand All @@ -51,8 +65,13 @@ namespace librealsense
public:
json_preset_writer();

// sets and add a "device" section with the device information
void set_device_info(const device_interface& device);

// return only the parameters section
json get_params() const { return *_parameters; };

// return the root section (used to write all json to file)
json get_root() const { return _root; };

template < typename T >
Expand Down

0 comments on commit bf3eb5f

Please sign in to comment.