CMS 3D CMS Logo

Public Member Functions | Public Attributes

FWGeoMaterialValidator Class Reference

Inheritance diagram for FWGeoMaterialValidator:
FWValidatorBase

List of all members.

Public Member Functions

virtual void addDaughtersRec (TGeoVolume *v) const
virtual void fillOptions (const char *iBegin, const char *iEnd, std::vector< std::pair< boost::shared_ptr< std::string >, std::string > > &oOptions) const
 FWGeoMaterialValidator (FWGeometryTableView *v)
bool isStringValid (std::string &exp)
virtual ~FWGeoMaterialValidator ()

Public Attributes

FWGeometryTableViewm_browser
std::vector< const char * > m_list

Detailed Description

Definition at line 57 of file FWGeometryTableView.cc.


Constructor & Destructor Documentation

FWGeoMaterialValidator::FWGeoMaterialValidator ( FWGeometryTableView v) [inline]

Definition at line 63 of file FWGeometryTableView.cc.

References m_browser, and v.

{ m_browser = v;}
virtual FWGeoMaterialValidator::~FWGeoMaterialValidator ( ) [inline, virtual]

Definition at line 64 of file FWGeometryTableView.cc.

{}

Member Function Documentation

virtual void FWGeoMaterialValidator::addDaughtersRec ( TGeoVolume *  v) const [inline, virtual]

Definition at line 66 of file FWGeometryTableView.cc.

References dtNoiseDBValidation_cfg::cerr, FWGeometryTableView::getFilterType(), i, FWGeometryTableView::kFilterMaterialName, FWGeometryTableView::kFilterMaterialTitle, FWGeometryTableView::kFilterShapeClassName, FWGeometryTableView::kFilterShapeName, m_browser, and m_list.

Referenced by fillOptions().

  {
    switch (m_browser->getFilterType())
    {
      case FWGeometryTableView::kFilterMaterialName:
        m_list.push_back(v->GetMaterial()->GetName());
        break;
      case FWGeometryTableView::kFilterMaterialTitle:
        m_list.push_back(v->GetMaterial()->GetTitle());
        break;
      case FWGeometryTableView::kFilterShapeName:
        m_list.push_back(v->GetShape()->GetName());
        break;
      case FWGeometryTableView::kFilterShapeClassName:
        m_list.push_back(v->GetShape()->ClassName());
        break;
      default:
        std::cerr << "FWGeoMaterialValidator unhandeled case. \n";
    }

    for (int i = 0; i < v->GetNdaughters(); ++i)
      addDaughtersRec(v->GetNode(i)->GetVolume());      

  }
virtual void FWGeoMaterialValidator::fillOptions ( const char *  iBegin,
const char *  iEnd,
std::vector< std::pair< boost::shared_ptr< std::string >, std::string > > &  oOptions 
) const [inline, virtual]

Implements FWValidatorBase.

Definition at line 91 of file FWGeometryTableView.cc.

References addDaughtersRec(), FWGeometryTableViewManager::getGeoMangeur(), FWGeometryTableView::getTableManager(), FWGeometryTableViewBase::getTopNodeIdx(), h, i, m_browser, m_list, FWGeometryTableManagerBase::refEntries(), python::multivaluedict::sort(), and interactiveExample::ui.

   {
      oOptions.clear();
      m_list.clear();

    FWGeometryTableManagerBase::Entries_i tnit = m_browser->getTableManager()->refEntries().begin();
    std::advance(tnit, m_browser->getTopNodeIdx());
    FWGeometryTableViewManager::getGeoMangeur();
    addDaughtersRec(tnit->m_node->GetVolume());

    std::sort(m_list.begin(), m_list.end());
    std::vector<const char*>::iterator ui = std::unique(m_list.begin(), m_list.end());
    m_list.resize(ui - m_list.begin());

    std::string part(iBegin,iEnd);
    unsigned int part_size = part.size();
      std::string h = "";
  // int cnt = 0;  
    oOptions.push_back(std::make_pair(boost::shared_ptr<std::string>(new std::string(*m_list.begin())), h));
    std::vector<const char*>::iterator startIt = m_list.begin();  startIt++;
    for (std::vector<const char*>::iterator i = startIt; i!=m_list.end(); ++i)
      {
    //      std::cout << *i << " " << cnt++ << std::endl;
      if ((strlen(*i) >= part_size) && strncmp(*i, part.c_str(), part_size ) == 0)
         {
        oOptions.push_back(std::make_pair(boost::shared_ptr<std::string>(new std::string((*i))),&((*i)[part_size]) ));
         }
      }
   }
bool FWGeoMaterialValidator::isStringValid ( std::string &  exp) [inline]

Definition at line 121 of file FWGeometryTableView.cc.

References dtNoiseDBValidation_cfg::cerr.

   {
    std::cerr << "validation not used \n";
      return false;
   }

Member Data Documentation

Definition at line 61 of file FWGeometryTableView.cc.

Referenced by addDaughtersRec(), fillOptions(), and FWGeoMaterialValidator().

std::vector<const char*> FWGeoMaterialValidator::m_list [mutable]

Definition at line 62 of file FWGeometryTableView.cc.

Referenced by addDaughtersRec(), and fillOptions().