File indexing completed on 2025-01-30 10:22:28
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #ifndef ROOT7_REveDataTable
0014 #define ROOT7_REveDataTable
0015
0016 #include <ROOT/REveElement.hxx>
0017
0018 namespace ROOT {
0019 namespace Experimental {
0020
0021 class REveDataCollection;
0022
0023 class REveDataTable : public REveElement
0024 {
0025 protected:
0026 const REveDataCollection *fCollection{nullptr};
0027
0028 public:
0029 REveDataTable(const std::string& n = "REveDataTable", const std::string& t = "");
0030 ~REveDataTable() override {}
0031
0032 void SetCollection(const REveDataCollection *col) { fCollection = col; }
0033 const REveDataCollection *GetCollection() const { return fCollection; }
0034
0035 void PrintTable();
0036 Int_t WriteCoreJson(nlohmann::json &cj, Int_t rnr_offset) override;
0037
0038 void AddNewColumn(const std::string& expr, const std::string& title, int prec = 2);
0039 };
0040
0041
0042
0043 class REveDataColumn : public REveElement
0044 {
0045 public:
0046 enum FieldType_e { FT_Double = 0, FT_Bool, FT_String };
0047
0048 protected:
0049 public:
0050 TString fExpression;
0051 FieldType_e fType;
0052 Int_t fPrecision{2};
0053 TClass* fClassType{nullptr};
0054
0055 std::string fTrue{"*"};
0056 std::string fFalse{" "};
0057
0058 std::function<double(void *)> fDoubleFoo;
0059 std::function<bool(void *)> fBoolFoo;
0060 std::function<std::string(void *)> fStringFoo;
0061
0062
0063 public:
0064 REveDataColumn(const std::string& n = "REveDataColumn", const std::string& t = "");
0065 ~REveDataColumn() override {}
0066
0067 void SetExpressionAndType(const std::string &expr, FieldType_e type);
0068 void SetExpressionAndType(const std::string &expr, FieldType_e type, TClass* c);
0069 std::string GetFunctionExpressionString() const;
0070 void SetPrecision(Int_t prec);
0071
0072 std::string EvalExpr(void *iptr) const;
0073 bool hasValidExpression() const;
0074 };
0075
0076
0077 }
0078 }
0079 #endif