sessiond: express field references as locations instead of names
[lttng-tools.git] / src / bin / lttng-sessiond / field.hpp
index 79017416617efb22a168633cd1dec65a34559132..2a1bcf35bf8002d5eec1a447fbe48b611d8eb345 100644 (file)
@@ -8,8 +8,6 @@
 #ifndef LTTNG_FIELD_H
 #define LTTNG_FIELD_H
 
-#include "trace-class.hpp"
-
 #include <memory>
 #include <string>
 #include <type_traits>
@@ -24,6 +22,31 @@ namespace trace {
 class field_visitor;
 class type_visitor;
 
+enum class byte_order {
+       BIG_ENDIAN_,
+       LITTLE_ENDIAN_,
+};
+
+class field_location {
+public:
+       enum class root {
+               PACKET_HEADER,
+               PACKET_CONTEXT,
+               EVENT_RECORD_HEADER,
+               EVENT_RECORD_COMMON_CONTEXT,
+               EVENT_RECORD_SPECIFIC_CONTEXT,
+               EVENT_RECORD_PAYLOAD,
+       };
+
+       using elements = std::vector<std::string>;
+
+       field_location(root lookup_root, elements elements);
+       bool operator==(const field_location& other) const noexcept;
+
+       const root root_;
+       const elements elements_;
+};
+
 /*
  * Field, and the various field types, represents fields as exposed by the
  * LTTng tracers. These classes do not attempt to describe the complete spectrum of the CTF
@@ -274,11 +297,11 @@ class dynamic_length_array_type : public array_type {
 public:
        dynamic_length_array_type(unsigned int alignment,
                        type::cuptr element_type,
-                       std::string length_field_name);
+                       field_location length_field_location);
 
        virtual void accept(type_visitor& visitor) const override final;
 
-       const std::string length_field_name;
+       const field_location length_field_location;
 
 private:
        virtual bool _is_equal(const type& base_other) const noexcept override final;
@@ -306,11 +329,11 @@ private:
 
 class dynamic_length_blob_type : public type {
 public:
-       dynamic_length_blob_type(unsigned int alignment, std::string length_field_name);
+       dynamic_length_blob_type(unsigned int alignment, field_location length_field_location);
 
        virtual void accept(type_visitor& visitor) const override final;
 
-       const std::string length_field_name;
+       const field_location length_field_location;
 
 private:
        virtual bool _is_equal(const type& base_other) const noexcept override final;
@@ -352,10 +375,10 @@ class dynamic_length_string_type : public string_type {
 public:
        dynamic_length_string_type(unsigned int alignment,
                        enum encoding in_encoding,
-                       std::string length_field_name);
+                       field_location length_field_location);
        virtual void accept(type_visitor& visitor) const override final;
 
-       const std::string length_field_name;
+       const field_location length_field_location;
 
 private:
        virtual bool _is_equal(const type& base_other) const noexcept override final;
@@ -385,12 +408,15 @@ class variant_type : public type {
 public:
        using choices = std::vector<field::cuptr>;
 
-       variant_type(unsigned int alignment, std::string tag_name, choices in_choices);
+       variant_type(unsigned int alignment,
+                       field_location selector_field_location,
+                       choices in_choices);
 
        virtual void accept(type_visitor& visitor) const override final;
 
-       const std::string tag_name;
+       const field_location selector_field_location;
        const choices _choices;
+;
 
 private:
        virtual bool _is_equal(const type& base_other) const noexcept override final;
This page took 0.024879 seconds and 4 git commands to generate.