/** * Copyright - See the COPYRIGHT that is included with this distribution. * pvAccessCPP is distributed subject to a Software License Agreement found * in file LICENSE that is included with this distribution. */ #ifndef TRANSPORTREGISTRY_H #define TRANSPORTREGISTRY_H #include #include #include #include #include #include #include #include #include #include namespace epics { namespace pvAccess { class TransportRegistry { public: typedef std::tr1::shared_ptr shared_pointer; typedef std::tr1::shared_ptr const_shared_pointer; typedef std::vector transportVector_t; TransportRegistry(); virtual ~TransportRegistry(); void put(Transport::shared_pointer const & transport); Transport::shared_pointer get(epics::pvData::String const & type, const osiSockAddr* address, const epics::pvData::int16 priority); std::auto_ptr get(epics::pvData::String const & type, const osiSockAddr* address); Transport::shared_pointer remove(Transport::shared_pointer const & transport); void clear(); epics::pvData::int32 numberOfActiveTransports(); // TODO note type not supported std::auto_ptr toArray(epics::pvData::String const & type); std::auto_ptr toArray(); // optimized to avoid reallocation, adds to array void toArray(transportVector_t & transportArray); private: //TODO if unordered map is used instead of map we can use sockAddrAreIdentical routine from osiSock.h // NOTE: pointers are used to osiSockAddr (to save memory), since it guaranteed that their reference is valid as long as Transport typedef std::map prioritiesMap_t; typedef std::tr1::shared_ptr prioritiesMapSharedPtr_t; typedef std::map transportsMap_t; transportsMap_t _transports; epics::pvData::int32 _transportCount; epics::pvData::Mutex _mutex; }; }} #endif /* INTROSPECTIONREGISTRY_H */