projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lttng: move session_list to the lttng::cli namespace
[lttng-tools.git]
/
src
/
bin
/
lttng
/
utils.hpp
diff --git
a/src/bin/lttng/utils.hpp
b/src/bin/lttng/utils.hpp
index 61fb6f6ffbbf9a1d8003a757b1e242e3f1e97f4a..dfbbc25b28056e71bbbeab4b7d44c6cbb46679d7 100644
(file)
--- a/
src/bin/lttng/utils.hpp
+++ b/
src/bin/lttng/utils.hpp
@@
-9,6
+9,7
@@
#define _LTTNG_UTILS_H
#include <common/argpar/argpar.h>
#define _LTTNG_UTILS_H
#include <common/argpar/argpar.h>
+#include <common/container-wrapper.hpp>
#include <common/dynamic-array.hpp>
#include <common/make-unique-wrapper.hpp>
#include <common/dynamic-array.hpp>
#include <common/make-unique-wrapper.hpp>
@@
-25,14
+26,23
@@
extern pid_t sessiond_pid;
struct cmd_struct;
struct cmd_struct;
+namespace lttng {
+namespace cli {
+
struct session_spec {
struct session_spec {
- enum type {
+ enum
class
type {
NAME,
GLOB_PATTERN,
ALL,
};
NAME,
GLOB_PATTERN,
ALL,
};
- type type;
+ explicit session_spec(type spec_type, const char *name_or_pattern = nullptr) noexcept :
+ type_(spec_type), value(name_or_pattern)
+ {
+ }
+
+ /* Disambiguate type enum from the member for buggy g++ versions. */
+ type type_;
const char *value;
};
const char *value;
};
@@
-41,42
+51,42
@@
struct session_spec {
*/
class session_list {
template <typename ContainerType, typename DereferenceReturnType>
*/
class session_list {
template <typename ContainerType, typename DereferenceReturnType>
- class
iterator_template
: public std::iterator<std::random_access_iterator_tag, std::size_t> {
+ class
_iterator
: public std::iterator<std::random_access_iterator_tag, std::size_t> {
public:
public:
- explicit
iterator_template
(ContainerType& list, std::size_t k) : _list(list), _index(k)
+ explicit
_iterator
(ContainerType& list, std::size_t k) : _list(list), _index(k)
{
}
{
}
-
iterator_template
& operator++() noexcept
+
_iterator
& operator++() noexcept
{
++_index;
return *this;
}
{
++_index;
return *this;
}
-
iterator_template
& operator--() noexcept
+
_iterator
& operator--() noexcept
{
--_index;
return *this;
}
{
--_index;
return *this;
}
-
iterator_template
& operator++(int) noexcept
+
_iterator
& operator++(int) noexcept
{
_index++;
return *this;
}
{
_index++;
return *this;
}
-
iterator_template
& operator--(int) noexcept
+
_iterator
& operator--(int) noexcept
{
_index--;
return *this;
}
{
_index--;
return *this;
}
- bool operator==(
iterator_template
other) const noexcept
+ bool operator==(
_iterator
other) const noexcept
{
return _index == other._index;
}
{
return _index == other._index;
}
- bool operator!=(
iterator_template
other) const noexcept
+ bool operator!=(
_iterator
other) const noexcept
{
return !(*this == other);
}
{
return !(*this == other);
}
@@
-91,8
+101,8
@@
class session_list {
std::size_t _index;
};
std::size_t _index;
};
- using iterator =
iterator_template
<session_list, lttng_session>;
- using const_iterator =
iterator_template
<const session_list, const lttng_session>;
+ using iterator =
_iterator
<session_list, lttng_session>;
+ using const_iterator =
_iterator
<const session_list, const lttng_session>;
public:
session_list() : _sessions_count(0), _sessions(nullptr)
public:
session_list() : _sessions_count(0), _sessions(nullptr)
@@
-160,6
+170,10
@@
private:
_sessions;
};
_sessions;
};
+lttng::cli::session_list list_sessions(const struct session_spec& spec);
+} /* namespace cli */
+} /* namespace lttng */
+
char *get_session_name(void);
char *get_session_name_quiet(void);
void list_commands(struct cmd_struct *commands, FILE *ofp);
char *get_session_name(void);
char *get_session_name_quiet(void);
void list_commands(struct cmd_struct *commands, FILE *ofp);
@@
-200,6
+214,4
@@
int print_trace_archive_location(const struct lttng_trace_archive_location *loca
int validate_exclusion_list(const char *event_name,
const struct lttng_dynamic_pointer_array *exclusions);
int validate_exclusion_list(const char *event_name,
const struct lttng_dynamic_pointer_array *exclusions);
-session_list list_sessions(const struct session_spec& spec);
-
#endif /* _LTTNG_UTILS_H */
#endif /* _LTTNG_UTILS_H */
This page took
0.025654 seconds
and
4
git commands to generate.