Logo ROOT  
Reference Guide
RObjectDrawable.cxx
Go to the documentation of this file.
1/*************************************************************************
2 * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers. *
3 * All rights reserved. *
4 * *
5 * For the licensing terms see $ROOTSYS/LICENSE. *
6 * For the list of contributors see $ROOTSYS/README/CREDITS. *
7 *************************************************************************/
8
10
11#include <ROOT/RDisplayItem.hxx>
12#include <ROOT/RLogger.hxx>
13#include <ROOT/RMenuItems.hxx>
14
15#include "TROOT.h"
16
17#include <exception>
18#include <sstream>
19#include <iostream>
20
21
22using namespace ROOT::Experimental;
23
24std::unique_ptr<RDisplayItem> RObjectDrawable::Display(const RDisplayContext &ctxt)
25{
26 if (GetVersion() > ctxt.GetLastVersion())
27 return std::make_unique<RObjectDisplayItem>(fObj.get(), fOpts);
28 return nullptr;
29}
30
32{
33 // fill context menu items for the ROOT class
34 items.PopulateObjectMenu(fObj.get(), fObj.get()->IsA());
35}
36
37void RObjectDrawable::Execute(const std::string &exec)
38{
39 TObject *obj = fObj.get();
40
41 std::stringstream cmd;
42 cmd << "((" << obj->ClassName() << "* ) " << std::hex << std::showbase << (size_t)obj << ")->" << exec << ";";
43 std::cout << "RObjectDrawable::Execute Obj " << obj->GetName() << "Cmd " << cmd.str() << std::endl;
44 gROOT->ProcessLine(cmd.str().c_str());
45}
#define gROOT
Definition: TROOT.h:406
Version_t GetVersion() const
Definition: RDrawable.hxx:185
List of items for object context menu.
Definition: RMenuItems.hxx:153
void PopulateObjectMenu(void *obj, TClass *cl)
Fill menu for provided object, using MENU as indicator in method comments.
Definition: RMenuItems.cxx:31
std::string fOpts
drawing options
Internal::RIOShared< TObject > fObj
The object to be painted.
void PopulateMenu(RMenuItems &) final
void Execute(const std::string &) final
Mother of all ROOT objects.
Definition: TObject.h:37
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:357
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:128