1 / 19

Proxy Mechanism of BESF

Proxy Mechanism of BESF. Zhangxy Huangxt Dec 17 ,2003. Content. Introduction. Implementation. Processing. Example. Summary. Introduction. Proxy is another way of data management system in our BesIII framework(BESF), learned from B A B AR .

mary
Download Presentation

Proxy Mechanism of BESF

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Proxy Mechanism of BESF ZhangxyHuangxt Dec 17 ,2003

  2. Content • Introduction. • Implementation. • Processing. • Example. • Summary

  3. Introduction • Proxy is another way of data management system in our • BesIII framework(BESF), learned from BABAR. • The separation of Transient Event and Persistent Event is • commonly used in other frameworks. • If the object associated with the Transient Event exists, Clients can get it directly from proxy.

  4. Introduction • If the object does’t exist, Proxy can create and then return it to Clients by calling its member function : virtual T*  faultHandler ( IfdProxyDict *, const IfdKey & ); • Proxy can put and get objects from the Transient Event in a type_safe fashion by virtue of template , hash table and wrap mechanism.

  5. Implementation • Transient Object • Proxy Interface • Proxy Dictionary • Keys • Accessor

  6. Implementation • Transient Object • Single instance • The class must inherit from BesDataObject. • Multi-instances • The class must inherit from BesContainedObject. m_parent BesObjectContainedBase BesObjectList<T> BesObjectVector<T>

  7. Implementation • Proxy Interface • Single object proxy T *ifdl = new T; IfdDataProxy<T> *proxy = new IfdDataProxy<T>( ifdl );

  8. Implementation • List object proxy BesObjectList<T> *ifdl = new BesObjectList<T>; BesObjectListProxy<T> *proxy = new BesObjectListProxy<T>( ifdl );

  9. Implementation • Above action has been done automatically by • BesEvent member function.Clients only need to • define the argument of the template functions. bool put( const IfdDictKey* key, IfdProxyIFace* proxy); template<class T> void  GetObjList (BesObjectVector< T > *&list); template<class T> void  GetObjList (BesObjectVector< T > *&list, const IfdKey &k); template<class T> void  GetObjList (BesObjectList< T > *&list); template<class T> void  GetObjList (BesObjectList< T > *&list, const IfdKey &k); template<class T> void  GetObj (T *&obj); template<class T> void  GetObj (T *&obj, const IfdKey &k); void clear();

  10. Implementation • Proxy Dictionary • The transient event store is implemented with Proxy Dictionary. • The Proxy Dictionary is implemented with a hash table and singly linked list. 1031

  11. Implementation • Access “object” from Dictionary • according to the hash value or • recursive comparison. • The hash value is given by the keys • BesEvent is a instance of the Dictionary.

  12. Implementation • Keys • In order to select the wanted object when • multiple instances of objects from the same • class “stored” in BesEvent or Proxy Dictionary. • Collision • Composite Key + Move Bit + Mod()

  13. The integer keys and string keys are interested for • clients, while other keys are used automatically.

  14. Implementation • Accessor • Ifd<T> class provides only and • type-safe access to the objects or • lists within BesEvent. • Identified by a key or characters to differentiate • them from other instances of the same class.

  15. Processing BesEventHeader* header = new BesaEventHeader(); first typekey proxy IfdDataProxy<BesEventHeader> *proxy = new IfdDataProxy<BesEventHeader>( header ); dictkey true Find() false next put

  16. Processing 1. Get the object from Transient event identified with string. T* Ifd<T>::Get(IfdProxyDict * Dict, const char* str) 2. Create valid Key. IfdstrKey k(str); 3. Call another member funtion. T* Ifd<T>::Get(IfdProxyDict* Dict, const IfdKey &K); 4. Create TypeKey and composite Key,that’s , Dictionary Key. static IfdTypeKey<Ifd<T> > tk; static IfdDictKey* dictkey=IfdProxyDictFrontEnd::newDictKey( tk); dictKey -> add( K); 5. Get the object according dictkey. (T*) Dict -> get( dictKey ) 6. Find the Proxy IfdProxyIface *p = Dict -> find( dictkey);

  17. Processing 7. Find the ProxyEntry. IfdSimpleProxyDictEntry *e = Dict -> findEntry( dictkey ); 8. Recursive Comparison. IfSimpleProxyDictEntry* e = _myData[dictkey._hashVal]; if ( 0==e) { return 0;} else if ( *e->key == dictkey ) { return e; } else while ( 0 != (e=e->next ) ) { if (*e->key == k) { return e;} } 9 Return object wanted return p->_myt; return T* t=p->defaulthandler(Dict, dictKey);

  18. Example • BESF makes the transient event available to BesMoudles • as an argument to the following member function: • virtual BesStatusExecute ( BesEvent *evt, Int_t *status) • virtual void  event ( BesEvent *evt, Int_t *status) • Clients can conveniently get objects from BesEvent. void NDSTunpackModule::event ( BesEvent * anEvent, int * status ) { NDSTtrack * aTrack ; NDSTEventHeader *eventPtr ; BesObjectVector<NDSTtrack>* trklist; anEvent->GetObjList( trklist ); anEvent->GetObj( eventPtr ); …… }

  19. Summary • Simple and type safe. • Easier to use than others.

More Related