Skip to content
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
1,155 changes: 576 additions & 579 deletions include/gz/transport/detail/Node.hh

Large diffs are not rendered by default.

120 changes: 57 additions & 63 deletions log/include/gz/transport/log/Batch.hh
Original file line number Diff line number Diff line change
Expand Up @@ -24,82 +24,76 @@
#include <gz/transport/log/Export.hh>
#include <gz/transport/log/MsgIter.hh>

namespace gz
namespace gz::transport::log
{
namespace transport
// Inline bracket to help doxygen filtering.
inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {
//
/// \brief Forward declaration
class BatchPrivate;
class Log;

/// \brief Holds the result of a query for messages
class GZ_TRANSPORT_LOG_VISIBLE Batch
{
namespace log
{
// Inline bracket to help doxygen filtering.
inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {
//
/// \brief Forward declaration
class BatchPrivate;
class Log;

/// \brief Holds the result of a query for messages
class GZ_TRANSPORT_LOG_VISIBLE Batch
{
/// \brief Default constructor
public: Batch();

/// \brief move constructor
/// \param[in] _old the instance being moved into this one
public: Batch(Batch &&_old); // NOLINT

/// \brief Move assignment operator
/// \param[in] _other the new Batch replacing the current one
/// \return The updated Batch instance.
public: Batch& operator=(Batch &&_other); // NOLINT

/// \brief No copy constructor.
public: Batch(const Batch& other) = delete;

/// \brief No copy-assignment operator.
public: Batch& operator=(const Batch& other) = delete;

/// \brief destructor
public: ~Batch();

/// \brief typedef for prettiness
public: using iterator = MsgIter;

/// \brief Iterator to first message in batch
/// \remarks the lowercase function name is required to support
/// range-based for loops
/// \return an iterator to the start of the messages
public: iterator begin();

/// \brief Iterator to one past the last message in a batch
/// \remarks the lowercase function name is required to support
/// range-based for loops
/// \return an iterator that is not equal to any iterator that points
/// to a valid message
public: iterator end();
/// \brief Default constructor
public: Batch();

/// \brief move constructor
/// \param[in] _old the instance being moved into this one
public: Batch(Batch &&_old); // NOLINT

/// \brief Move assignment operator
/// \param[in] _other the new Batch replacing the current one
/// \return The updated Batch instance.
public: Batch& operator=(Batch &&_other); // NOLINT

/// \brief No copy constructor.
public: Batch(const Batch& other) = delete;

/// \brief No copy-assignment operator.
public: Batch& operator=(const Batch& other) = delete;

/// \brief destructor
public: ~Batch();

/// \brief typedef for prettiness
public: using iterator = MsgIter;

/// \brief Iterator to first message in batch
/// \remarks the lowercase function name is required to support
/// range-based for loops
/// \return an iterator to the start of the messages
public: iterator begin();

/// \brief Iterator to one past the last message in a batch
/// \remarks the lowercase function name is required to support
/// range-based for loops
/// \return an iterator that is not equal to any iterator that points
/// to a valid message
public: iterator end();

#ifdef _WIN32
// Disable warning C4251 which is triggered by
// std::*
#pragma warning(push)
#pragma warning(disable: 4251)
#endif
/// \brief Private implementation
private: std::unique_ptr<BatchPrivate> dataPtr;
/// \brief Private implementation
private: std::unique_ptr<BatchPrivate> dataPtr;
#ifdef _WIN32
#pragma warning(pop)
#endif

/// \brief Construct with private implementation
/// \param[in] _pimpl a private implementation pointer
/// \internal
private: Batch(
std::unique_ptr<BatchPrivate> &&_pimpl); // NOLINT(build/c++11)

/// \brief Log can use private constructor
friend class Log;
};
}
}
/// \brief Construct with private implementation
/// \param[in] _pimpl a private implementation pointer
/// \internal
private: Batch(
std::unique_ptr<BatchPrivate> &&_pimpl); // NOLINT(build/c++11)

/// \brief Log can use private constructor
friend class Log;
};
}
}
#endif
133 changes: 63 additions & 70 deletions log/include/gz/transport/log/Descriptor.hh
Original file line number Diff line number Diff line change
Expand Up @@ -26,88 +26,81 @@
#include <gz/transport/config.hh>
#include <gz/transport/log/Export.hh>

namespace gz
namespace gz::transport::log
{
namespace transport
// Inline bracket to help doxygen filtering.
inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {
//
// Forward declaration
class Log;

//////////////////////////////////////////////////
/// \brief The Descriptor class provides meta-information about what a log
/// contains. This may be useful for determining QueryOptions or for
/// generating a high-level overview of a Log's contents.
class GZ_TRANSPORT_LOG_VISIBLE Descriptor
{
namespace log
{
// Inline bracket to help doxygen filtering.
inline namespace GZ_TRANSPORT_VERSION_NAMESPACE {
//
// Forward declaration
class Log;

//////////////////////////////////////////////////
/// \brief The Descriptor class provides meta-information about what a log
/// contains. This may be useful for determining QueryOptions or for
/// generating a high-level overview of a Log's contents.
class GZ_TRANSPORT_LOG_VISIBLE Descriptor
{
/// \brief A map from a name (e.g. topic name or message type name) to
/// the id of a row in one of the database tables. (name -> id)
public: using NameToId = std::map<std::string, int64_t>;

/// \brief A map from a name to a map from a name to a row ID.
/// (name -> name -> id)
public: using NameToMap = std::map<std::string, NameToId>;

/// \brief A topic in the database is uniquely identified by a pair of
/// (topic name, message type).
/// This function allows you to find the id of a topic by searching
/// (topic name -> message type name -> ID).
/// \return A map from topic names to a map of message types to row ids.
/// \sa MsgTypesToTopicsToId()
public: const NameToMap &TopicsToMsgTypesToId() const;

/// \brief A topic in the database is uniquely identified by a pair of
/// (topic name, message type).
/// This function allows you to find the id of a topic by searching
/// (message type name -> topic name -> ID).
/// \return A map from message types to a map of topic names to row ids.
/// \sa TopicsToMsgTypesToId()
public: const NameToMap &MsgTypesToTopicsToId() const;

/// \brief Convenience method to get an id given a topic name and type
/// \param[in] _topicName Name of the topic that you are interested in.
/// \param[in] _msgType Name of the message type that you are interested
/// in.
/// \return an id of a row in the topics table, or -1 none exists
public: int64_t TopicId(
const std::string &_topicName,
const std::string &_msgType) const;

// The Log class is a friend so that it can construct a Descriptor
friend class Log;

/// \brief Destructor
public: ~Descriptor();

/// \brief The Descriptor class must only be created by calling
/// \sa Log::Descriptor().
private: Descriptor();

/// \brief Move constructor, not used by most
/// \internal
public: Descriptor(Descriptor &&_orig); // NOLINT

/// \internal Implementation for this class
class Implementation;
/// \brief A map from a name (e.g. topic name or message type name) to
/// the id of a row in one of the database tables. (name -> id)
public: using NameToId = std::map<std::string, int64_t>;

/// \brief A map from a name to a map from a name to a row ID.
/// (name -> name -> id)
public: using NameToMap = std::map<std::string, NameToId>;

/// \brief A topic in the database is uniquely identified by a pair of
/// (topic name, message type).
/// This function allows you to find the id of a topic by searching
/// (topic name -> message type name -> ID).
/// \return A map from topic names to a map of message types to row ids.
/// \sa MsgTypesToTopicsToId()
public: const NameToMap &TopicsToMsgTypesToId() const;

/// \brief A topic in the database is uniquely identified by a pair of
/// (topic name, message type).
/// This function allows you to find the id of a topic by searching
/// (message type name -> topic name -> ID).
/// \return A map from message types to a map of topic names to row ids.
/// \sa TopicsToMsgTypesToId()
public: const NameToMap &MsgTypesToTopicsToId() const;

/// \brief Convenience method to get an id given a topic name and type
/// \param[in] _topicName Name of the topic that you are interested in.
/// \param[in] _msgType Name of the message type that you are interested in.
/// \return an id of a row in the topics table, or -1 none exists
public: int64_t TopicId(
const std::string &_topicName,
const std::string &_msgType) const;

// The Log class is a friend so that it can construct a Descriptor
friend class Log;

/// \brief Destructor
public: ~Descriptor();

/// \brief The Descriptor class must only be created by calling
/// \sa Log::Descriptor().
private: Descriptor();

/// \brief Move constructor, not used by most
/// \internal
public: Descriptor(Descriptor &&_orig); // NOLINT

/// \internal Implementation for this class
class Implementation;

#ifdef _WIN32
// Disable warning C4251 which is triggered by
// std::*
#pragma warning(push)
#pragma warning(disable: 4251)
#endif
/// \internal Pointer to implementation
private: std::unique_ptr<Implementation> dataPtr;
/// \internal Pointer to implementation
private: std::unique_ptr<Implementation> dataPtr;
#ifdef _WIN32
#pragma warning(pop)
#endif
};
}
}
};
}
}

Expand Down
Loading
Loading