#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>
struct cmd_struct;
+namespace lttng {
+namespace cli {
+
struct session_spec {
- enum type {
+ enum class type {
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;
};
*/
class session_list {
template <typename ContainerType, typename DereferenceReturnType>
- class _iterator
- : 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:
- explicit _iterator(ContainerType& list, std::size_t k) :
- _list(list), _index(k)
+ explicit _iterator(ContainerType& list, std::size_t k) : _list(list), _index(k)
{
}
_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);
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 */