Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Functors.h

Go to the documentation of this file.
00001 
00002 // $Id: Functors.h,v 1.1 2007/02/09 04:44:13 fmwk Exp $
00003 //
00004 // Define a set of useful functions for managing lists of drawable
00005 // objects
00006 //
00007 // messier@indiana.edu
00009 #ifndef EVDFUNCTORS_H
00010 #define EVDFUNCTORS_H
00011 #include "TObject.h"
00012 #include "TMarker.h"
00013 #include "TPolyMarker.h"
00014 #include "TLine.h"
00015 #include "TPolyLine.h"
00016 #include "TArc.h"
00017 #include "TBox.h"
00018 #include "TMarker3DBox.h"
00019 #include "TPolyMarker3D.h"
00020 #include "TPolyLine3D.h"
00021 #include "TText.h"
00022 
00023 #include <iostream>
00024 
00025 struct draw_tobject      {
00026   void operator()(TObject* x) {
00027     // Do not draw poly lines if they have no points. Otherwise ROOT crashes
00028     if (dynamic_cast<TPolyLine*>(x)) {
00029       if (dynamic_cast<TPolyLine*>(x)->GetN() < 2) return;
00030     }
00031     else if (dynamic_cast<TPolyLine3D*>(x)) {
00032       if (dynamic_cast<TPolyLine3D*>(x)->GetN() < 2) return;
00033     }
00034 
00035     x->Draw();
00036   }
00037 };
00038 
00039 struct delete_marker     {void operator()(TMarker* x)     { delete x; }};
00040 struct delete_polymarker {void operator()(TPolyMarker* x) { delete x; }};
00041 struct delete_line       {void operator()(TLine* x)       { delete x; }};
00042 struct delete_polyline   {void operator()(TPolyLine* x)   { delete x; }};
00043 struct delete_arc        {void operator()(TArc* x)        { delete x; }};
00044 struct delete_box        {void operator()(TBox* x)        { delete x; }};
00045 struct delete_text       {void operator()(TText* x)       { delete x; }};
00046 
00047 struct delete_marker3dbox {void operator()(TMarker3DBox* x) {delete x;}};
00048 struct delete_polymarker3d{void operator()(TPolyMarker3D* x){delete x;}};
00049 struct delete_polyline3d  {void operator()(TPolyLine3D* x)  {delete x;}};
00050 
00051 #endif
00052 

Generated on Sat Oct 11 02:35:27 2008 for NOvA Offline by  doxygen 1.3.9.1