| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

Filter< Object > Class Template Reference

#include <Filter.h>

Collaboration diagram for Filter< Object >:

[legend]
List of all members.

Public Types

typedef KeyedContainer< Object,
Containers::HashMap
container

Public Member Functions

 Filter (IUserInterfaceSvc &aUISvc, MsgStream &aLog)
containercollect (container &aVector, const std::string &aWhat, const std::string &aCuts)
void dump (container &aVector, const std::string &aWhat)

Private Member Functions

bool setup (const std::string &aWhat, container &aVector)

Private Attributes

IUserInterfaceSvcfUISvc
MsgStreamfLog
Slash::Data::IProcessor * fTypeManager
Slash::Data::IAccessor * fType
Slash::Data::IIterator * fIterator

Detailed Description

template<class Object>
class Filter< Object >

Definition at line 15 of file Filter.h.


Member Typedef Documentation

template<class Object>
typedef KeyedContainer<Object, Containers::HashMap> Filter< Object >::container

Definition at line 17 of file Filter.h.


Constructor & Destructor Documentation

template<class Object>
Filter< Object >::Filter ( IUserInterfaceSvc aUISvc,
MsgStream aLog 
) [inline]

Definition at line 18 of file Filter.h.

00019   :fUISvc(aUISvc),fLog(aLog)
00020   ,fTypeManager(0),fType(0),fIterator(0)
00021   {
00022     fTypeManager = fUISvc.typeManager();
00023   }


Member Function Documentation

template<class Object>
container* Filter< Object >::collect ( container aVector,
const std::string &  aWhat,
const std::string &  aCuts 
) [inline]

Definition at line 24 of file Filter.h.

00026                                               {
00027     int number = aVector.size();
00028     if(number<=0) return 0;
00029     if(!setup(aWhat,aVector)) return 0;
00030     std::vector<std::string> args;
00031     args.push_back(aWhat);
00032     args.push_back(aCuts);
00033     fTypeManager->execute("collect",args);
00034     container* v = new container;
00035     if(v) {
00036       Slash::Data::IHandlersIterator* hit = fTypeManager->handlersIterator();
00037       for(;const Slash::Data::IHandler* h = hit->handler();hit->next()) {
00038         v->add((Object*)h->object());
00039       }
00040       delete hit;
00041     }
00042     fTypeManager->eraseHandlers();
00043     // fIterator deleted by the collect.
00044     fType->setIterator(0);
00045     return v;
00046   }

template<class Object>
void Filter< Object >::dump ( container aVector,
const std::string &  aWhat 
) [inline]

Definition at line 47 of file Filter.h.

00047                                                        {
00048     int number = aVector.size();
00049     if(number<=0) return;
00050     if(!setup(aWhat,aVector)) return;
00051     std::vector<std::string> args;
00052     args.push_back(aWhat);
00053     args.push_back("");
00054     fTypeManager->execute("collect",args);
00055     args.clear();
00056     args.push_back("table");
00057     //args.push_back("raw");
00058     fTypeManager->execute("dump",args);
00059     fTypeManager->eraseHandlers();
00060     // fIterator deleted by the collect.
00061     fType->setIterator(0);
00062   }

template<class Object>
bool Filter< Object >::setup ( const std::string &  aWhat,
container aVector 
) [inline, private]

Definition at line 64 of file Filter.h.

00064                                                         {
00065     fType = 0;
00066     fIterator = 0;
00067     if(!fTypeManager) return false;
00068     Slash::Data::IAccessor* type = fTypeManager->findAccessor(aWhat);
00069     if(!type) { 
00070       // Not found in OnX dictionary. Try the Gaudi dico.
00071       type = fUISvc.metaType();
00072       if(type && type->setName(aWhat)) { 
00073         // Found in Gaudi dictionary.
00074       } else {
00075         fLog << MSG::INFO << " type \"" << aWhat << "\" not found." << endreq;
00076         return false;
00077       }
00078     }
00079 
00080     class Iterator : public Slash::Data::IIterator {
00081     public: //Slash::Data::IIterator
00082       virtual void* object() {
00083         if(fIterator==fVector.end()) return 0;
00084         return *fIterator;
00085       }
00086       virtual void next() { ++fIterator;}
00087       virtual void* tag() {return 0;}
00088     public:
00089       Iterator(container& aVector):fIndex(0),fVector(aVector) {
00090         fIterator = fVector.begin();
00091       }
00092     private:
00093       unsigned int fIndex;
00094       container& fVector;
00095       typename container::iterator fIterator;
00096     };
00097 
00098     fType = type;
00099     fIterator = new Iterator(aVector);
00100     fType->setIterator(fIterator);
00101     return true;
00102   }


Member Data Documentation

template<class Object>
IUserInterfaceSvc& Filter< Object >::fUISvc [private]

Definition at line 104 of file Filter.h.

template<class Object>
MsgStream& Filter< Object >::fLog [private]

Definition at line 105 of file Filter.h.

template<class Object>
Slash::Data::IProcessor* Filter< Object >::fTypeManager [private]

Definition at line 106 of file Filter.h.

template<class Object>
Slash::Data::IAccessor* Filter< Object >::fType [private]

Definition at line 107 of file Filter.h.

template<class Object>
Slash::Data::IIterator* Filter< Object >::fIterator [private]

Definition at line 108 of file Filter.h.


The documentation for this class was generated from the following file:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:02:01 2011 for OnXSvc by doxygen 1.4.7