Skip to content

Commit

Permalink
remove typedef from
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanhhughes committed Jul 19, 2024
1 parent 93c1d6a commit e9f639d
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions include/spark_dsg/serialization/file_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void saveDsgJson(const DynamicSceneGraph& graph,
* @param filepath The filepath including extension to load from.
* @return A pointer to the loaded graph or nullptr if loading failed.
*/
DynamicSceneGraphPtr loadDsgJson(const std::string& filepath);
std::shared_ptr<DynamicSceneGraph> loadDsgJson(const std::string& filepath);

/**
* @brief Save a DynamicSceneGraph to a file in binary serialization.
Expand All @@ -96,6 +96,6 @@ void saveDsgBinary(const DynamicSceneGraph& graph,
* @param filepath The filepath including extension to load from.
* @return A pointer to the loaded graph or nullptr if loading failed.
*/
DynamicSceneGraphPtr loadDsgBinary(const std::string& filepath);
std::shared_ptr<DynamicSceneGraph> loadDsgBinary(const std::string& filepath);

} // namespace spark_dsg::io
8 changes: 5 additions & 3 deletions include/spark_dsg/serialization/graph_binary_serialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,20 @@
* -------------------------------------------------------------------------- */
#pragma once

#include "spark_dsg/spark_dsg_fwd.h"
#include "spark_dsg/serialization/versioning.h"
#include "spark_dsg/spark_dsg_fwd.h"

namespace spark_dsg::io::binary {

void writeGraph(const DynamicSceneGraph& graph,
std::vector<uint8_t>& buffer,
bool include_mesh = false);

DynamicSceneGraphPtr readGraph(const uint8_t* const buffer, size_t length);
std::shared_ptr<DynamicSceneGraph> readGraph(const uint8_t* const buffer,
size_t length);

inline DynamicSceneGraphPtr readGraph(const std::vector<uint8_t>& buffer) {
inline std::shared_ptr<DynamicSceneGraph> readGraph(
const std::vector<uint8_t>& buffer) {
return readGraph(buffer.data(), buffer.size());
}

Expand Down
2 changes: 1 addition & 1 deletion include/spark_dsg/serialization/graph_json_serialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ std::string writeGraph(const DynamicSceneGraph& graph, bool include_mesh = false
* @param contents JSON string to parse
* @returns Resulting parsed scene graph
*/
DynamicSceneGraphPtr readGraph(const std::string& contents);
std::shared_ptr<DynamicSceneGraph> readGraph(const std::string& contents);

} // namespace spark_dsg::io::json
1 change: 0 additions & 1 deletion include/spark_dsg/spark_dsg_fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ struct EdgeContainer;

class SceneGraphLayer;
class DynamicSceneGraph;
using DynamicSceneGraphPtr = std::shared_ptr<DynamicSceneGraph>;

} // namespace spark_dsg
4 changes: 2 additions & 2 deletions include/spark_dsg/zmq_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class ZmqReceiver {

bool recv(size_t timeout_ms, bool recv_all = false);

DynamicSceneGraphPtr graph() const;
std::shared_ptr<DynamicSceneGraph> graph() const;

private:
struct Detail;
Expand All @@ -74,7 +74,7 @@ class ZmqGraph {
~ZmqGraph();

bool hasChange() const;
DynamicSceneGraphPtr graph() const;
std::shared_ptr<DynamicSceneGraph> graph() const;

private:
struct Detail;
Expand Down
4 changes: 2 additions & 2 deletions src/serialization/file_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void saveDsgBinary(const DynamicSceneGraph& graph,
out.write(reinterpret_cast<const char*>(graph_buffer.data()), graph_buffer.size());
}

DynamicSceneGraphPtr loadDsgBinary(const std::string& filepath) {
std::shared_ptr<DynamicSceneGraph> loadDsgBinary(const std::string& filepath) {
// Read the file into a buffer.
std::ifstream infile(filepath, std::ios::in | std::ios::binary);
std::vector<uint8_t> buffer((std::istreambuf_iterator<char>(infile)),
Expand All @@ -121,7 +121,7 @@ void saveDsgJson(const DynamicSceneGraph& graph,
outfile << json::writeGraph(graph, include_mesh);
}

DynamicSceneGraphPtr loadDsgJson(const std::string& filepath) {
std::shared_ptr<DynamicSceneGraph> loadDsgJson(const std::string& filepath) {
std::ifstream infile(filepath);
std::stringstream ss;
ss << infile.rdbuf();
Expand Down

0 comments on commit e9f639d

Please sign in to comment.