Default numbering scheme. More...
#include <DDNumberingScheme.h>
Public Types | |
typedef DDNumberingScheme::nav_type | nav_type |
Public Member Functions | |
DDDefaultNumberingScheme (const DDExpandedView &e) | |
DDDefaultNumberingScheme (const DDFilteredView &f) | |
virtual int | id (const DDExpandedView &) const |
calculate the id of a given node | |
virtual int | id (const DDNumberingScheme::nav_type &) const |
calculate the id of a given node | |
virtual int | id (const DDFilteredView &) const |
calculate the id of a given node | |
virtual bool | node (int id, DDFilteredView &view) const |
calculate the node given an id | |
virtual bool | node (int id, DDExpandedView &view) const |
calculate the node given an id | |
virtual | ~DDDefaultNumberingScheme () |
Protected Member Functions | |
DDNumberingScheme::nav_type | idToNavType (int id) const |
Protected Attributes | |
std::vector< std::map < nav_type, int >::iterator > | id2path_ |
std::map< nav_type, int > | path2id_ |
Default numbering scheme.
implements a default - numbering scheme throws an DDException when it fails ...
Definition at line 54 of file DDNumberingScheme.h.
Reimplemented from DDNumberingScheme.
Definition at line 57 of file DDNumberingScheme.h.
DDDefaultNumberingScheme::DDDefaultNumberingScheme | ( | const DDExpandedView & | e | ) |
Definition at line 11 of file DDNumberingScheme.cc.
References prof2calltree::count, alignCSCRings::e, id2path_, DDExpandedView::navPos(), DDExpandedView::next(), path2id_, and DDExpandedView::reset().
{ // extremely memory consuming & slow. /* - assign a node-number (from 0, ...) to every node in the view - save the node-number in a map, key is the stack of sibling-numbers of the node -> enables node to id calculation (slow O(log(max. node-number))). - save in a std::vector the stack of sibling-numbers; index in the std::vector is the assigned node number -> enables id to node calculation (fast) */ typedef std::map<nav_type,int>::iterator m_it; DDExpandedView e = ex; e.reset(); bool go = true; int count = 0; while (go) { std::pair<m_it,bool> res = path2id_.insert(std::make_pair(e.navPos(),count)); id2path_.push_back(res.first); ++count; go = e.next(); } }
DDDefaultNumberingScheme::DDDefaultNumberingScheme | ( | const DDFilteredView & | f | ) |
Definition at line 36 of file DDNumberingScheme.cc.
References prof2calltree::count, f, id2path_, DDFilteredView::navPos(), DDFilteredView::next(), path2id_, and DDFilteredView::reset().
{ // very memory consuming & slow, depending on the amount of nodes // selected by the FilteredView; same algorithm then in ctor above typedef std::map<nav_type,int>::iterator m_it; DDFilteredView f = fv; f.reset(); bool go = true; int count = 0; while (go) { std::pair<m_it,bool> res = path2id_.insert(std::make_pair(f.navPos(),count)); id2path_.push_back(res.first); ++count; go = f.next(); } }
DDDefaultNumberingScheme::~DDDefaultNumberingScheme | ( | ) | [virtual] |
Definition at line 55 of file DDNumberingScheme.cc.
{ }
int DDDefaultNumberingScheme::id | ( | const DDExpandedView & | e | ) | const [virtual] |
calculate the id of a given node
Implements DDNumberingScheme.
Definition at line 59 of file DDNumberingScheme.cc.
References DDExpandedView::navPos().
Referenced by id(), and idToNavType().
int DDDefaultNumberingScheme::id | ( | const DDNumberingScheme::nav_type & | n | ) | const [virtual] |
calculate the id of a given node
Implements DDNumberingScheme.
Definition at line 71 of file DDNumberingScheme.cc.
References path2id_, and query::result.
int DDDefaultNumberingScheme::id | ( | const DDFilteredView & | f | ) | const [virtual] |
calculate the id of a given node
Implements DDNumberingScheme.
Definition at line 65 of file DDNumberingScheme.cc.
References id(), and DDFilteredView::navPos().
DDNumberingScheme::nav_type DDDefaultNumberingScheme::idToNavType | ( | int | id | ) | const [protected] |
Definition at line 95 of file DDNumberingScheme.cc.
References id(), id2path_, pos, and query::result.
Referenced by node().
bool DDDefaultNumberingScheme::node | ( | int | id, |
DDFilteredView & | view | ||
) | const [virtual] |
calculate the node given an id
returns true, if a node was found. view then corresponds to this node.
Implements DDNumberingScheme.
Definition at line 87 of file DDNumberingScheme.cc.
References DDFilteredView::goTo(), and idToNavType().
{ edm::LogError("DDNumberingScheme") << "DDDefaultNumberingScheme::node(int,DDFilteredView&) NOT IMPLEMENTED!" << std::endl; return view.goTo(idToNavType(id)); }
bool DDDefaultNumberingScheme::node | ( | int | id, |
DDExpandedView & | view | ||
) | const [virtual] |
calculate the node given an id
returns true, if a node was found. view then corresponds to this node.
Implements DDNumberingScheme.
Definition at line 81 of file DDNumberingScheme.cc.
References DDExpandedView::goTo(), and idToNavType().
{ return view.goTo(idToNavType(id)); }
std::vector<std::map<nav_type,int>::iterator> DDDefaultNumberingScheme::id2path_ [protected] |
Definition at line 88 of file DDNumberingScheme.h.
Referenced by DDDefaultNumberingScheme(), and idToNavType().
std::map<nav_type,int> DDDefaultNumberingScheme::path2id_ [protected] |
Definition at line 87 of file DDNumberingScheme.h.
Referenced by DDDefaultNumberingScheme(), and id().