Changeset 2473 for source/ariba/utility


Ignore:
Timestamp:
Feb 23, 2009, 2:21:49 PM (15 years ago)
Author:
Christoph Mayer
Message:

-einige fixes im ablauf des neuen interface
-einige fehlende funktionalität implementiert

Location:
source/ariba/utility
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • source/ariba/utility/misc/Demultiplexer.hpp

    r2472 r2473  
    4141
    4242#include <list>
     43#include <iostream>
    4344#include <map>
    4445#include <boost/thread/mutex.hpp>
     
    4647#include "ariba/utility/messages/Message.h"
    4748
     49using std::cout;
    4850using std::list;
    4951using std::map;
     
    7375        boost::mutex                                            mapMutex;
    7476
     77        void debugprint() {
     78                cout << "-------------start--------" << std::endl;
     79                {
     80                        LISTENER_SERVICE_MAP_CITERATOR i = mapListenerService.begin();
     81                        LISTENER_SERVICE_MAP_CITERATOR iend = mapListenerService.end();
     82                       
     83                        for( ; i != iend; i++ )
     84                                cout << "xxx" << i->first.toString() << " -> " << i->second << std::endl;
     85                }
     86                cout << "-----------------------" << std::endl;
     87                {
     88                        SERVICE_LISTENER_MAP_CITERATOR i = mapServiceListener.begin();
     89                        SERVICE_LISTENER_MAP_CITERATOR iend = mapServiceListener.end();
     90                       
     91                        for( ; i != iend; i++ )
     92                                cout << "xxx" << i->first << " -> " << i->second.toString() << std::endl;
     93                }
     94                cout << "-------------end---------" << std::endl;
     95        }
     96
    7597public:
    7698
     
    83105        void registerItem( S id, T listener ) {
    84106                boost::mutex::scoped_lock lock( mapMutex );
    85                 {
    86                         mapServiceListener.insert( SERVICE_LISTENER_PAIR( id, listener ) );
    87                         mapListenerService.insert( LISTENER_SERVICE_PAIR( listener, id ) );
    88                 }
     107
     108                mapServiceListener.insert( SERVICE_LISTENER_PAIR( id, listener ) );
     109                mapListenerService.insert( LISTENER_SERVICE_PAIR( listener, id ) );
    89110        }
    90111
    91         void unregisterItem( S id) {
     112        void unregisterItem( S id ) {
    92113                T listener = get( id );
    93 
    94                 boost::mutex::scoped_lock lock( mapMutex );
     114               
    95115                {
     116                        boost::mutex::scoped_lock lock( mapMutex );
    96117                        mapServiceListener.erase( id );
    97118                        mapListenerService.erase( listener );
     
    100121
    101122        void unregisterItem( T listener ) {
    102                 S id = get (listener);
     123                S id = get( listener );
    103124                unregisterItem( id );
    104125        }
     
    106127        S get( T listener ) {
    107128                boost::mutex::scoped_lock lock( mapMutex );
    108                 {
    109                         LISTENER_SERVICE_MAP_CITERATOR it = mapListenerService.find( listener );
    110                         return it->second;
    111                 }
     129
     130                LISTENER_SERVICE_MAP_CITERATOR it = mapListenerService.find( listener );
     131                return it->second;
    112132        }
    113133
    114134        T get( S id ) {
    115135                boost::mutex::scoped_lock lock( mapMutex );
    116                 {
    117                         SERVICE_LISTENER_MAP_CITERATOR it = mapServiceListener.find( id );
    118136
    119                         if( it == mapServiceListener.end() )    return NULL;
    120                         else                                    return it->second;
    121                 }
     137                SERVICE_LISTENER_MAP_CITERATOR it = mapServiceListener.find( id );
     138                if( it == mapServiceListener.end() )    return NULL;
     139                else                                    return it->second;
    122140        }
    123141
    124142        bool contains( T listener ) {
    125143                boost::mutex::scoped_lock lock( mapMutex );
    126                 {
    127                         LISTENER_SERVICE_MAP_CITERATOR it = mapListenerService.find( listener );
    128                         return ( it != mapListenerService.end() );
    129                 }
     144
     145                LISTENER_SERVICE_MAP_CITERATOR it = mapListenerService.find( listener );
     146                return ( it != mapListenerService.end() );
    130147        }
    131148
    132149        bool contains( S id ) {
    133150                boost::mutex::scoped_lock lock( mapMutex );
    134                 {
    135                         SERVICE_LISTENER_MAP_CITERATOR it = mapServiceListener.find( id );
    136                         return ( it != mapServiceListener.end() );
    137                 }
     151
     152                SERVICE_LISTENER_MAP_CITERATOR it = mapServiceListener.find( id );
     153                return ( it != mapServiceListener.end() );
    138154        }
    139155
     
    141157        typedef list<T> TwoList;
    142158
    143         OneList getOneList() const {
     159        OneList getOneList() {
     160                boost::mutex::scoped_lock lock( mapMutex );
    144161                OneList ret;
    145162
     
    151168        }
    152169
    153         TwoList getTwoList() const {
     170        TwoList getTwoList() {
     171                boost::mutex::scoped_lock lock( mapMutex );
    154172                TwoList ret;
    155173
  • source/ariba/utility/types/ServiceID.cpp

    r2472 r2473  
    2424// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE ARIBA PROJECT OR
    2525// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    26 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     26// EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    2727// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    2828// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     
    5050}
    5151
    52 ServiceID::ServiceID(unsigned int _id) : id( _id ){
     52ServiceID::ServiceID(uint32_t _id) : id( _id ){
    5353}
    5454
     
    5757
    5858ServiceID::~ServiceID() {
     59}
     60
     61ServiceID& ServiceID::operator=(const ServiceID &rh) {
     62        id = rh.id;
     63        return *this;
    5964}
    6065
  • source/ariba/utility/types/ServiceID.h

    r2472 r2473  
    7272        bool operator<(const ServiceID& rh) const;
    7373        bool operator!=(const ServiceID& rh) const;
     74        ServiceID& operator=(const ServiceID &rh);
    7475
    7576        inline bool isUnspecified() const {
Note: See TracChangeset for help on using the changeset viewer.