/*
- * Copyright 2001-2007 Internet2
+ * Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <saml/base.h>
+#include <vector>
+#include <xercesc/util/XMLString.hpp>
+
namespace opensaml {
namespace saml2md {
class EndpointManager
{
protected:
- typename const std::vector<_Tx*>& m_endpoints;
+ /** Reference to endpoint array. */
+ const typename std::vector<_Tx*>& m_endpoints;
public:
/**
*
* @param endpoints array of endpoints to manage
*/
- EndpointManager(typename const std::vector<_Tx*>& endpoints) : m_endpoints(endpoints) {
+ EndpointManager(const typename std::vector<_Tx*>& endpoints) : m_endpoints(endpoints) {
}
/**
* @return a supporting endpoint, favoring the default, or NULL
*/
const _Tx* getByBinding(const XMLCh* binding) const {
- for (std::vector<_Tx*>::const_iterator i = m_endpoints.begin(); i!=m_endpoints.end(); ++i) {
+ for (typename std::vector<_Tx*>::const_iterator i = m_endpoints.begin(); i!=m_endpoints.end(); ++i) {
if (xercesc::XMLString::equals(binding,(*i)->getBinding()))
return *i;
}
template <class _Tx>
class IndexedEndpointManager : public EndpointManager<_Tx>
{
- typename const _Tx* m_default;
+ const _Tx* m_default;
public:
/**
*
* @param endpoints array of endpoints to manage
*/
- IndexedEndpointManager(typename const std::vector<_Tx*>& endpoints) : EndpointManager(endpoints), m_default(NULL) {
+ IndexedEndpointManager(const typename std::vector<_Tx*>& endpoints) : EndpointManager<_Tx>(endpoints), m_default(NULL) {
}
/**
const _Tx* getDefault() const {
if (m_default)
return m_default;
- for (std::vector<_Tx*>::const_iterator i = m_endpoints.begin(); i!=m_endpoints.end(); ++i) {
+ for (typename std::vector<_Tx*>::const_iterator i = EndpointManager<_Tx>::m_endpoints.begin(); i!=EndpointManager<_Tx>::m_endpoints.end(); ++i) {
if ((*i)->isDefault())
return m_default=*i;
}
- return (m_endpoints.empty()) ? m_default=NULL : m_default=m_endpoints.front();
+ return (EndpointManager<_Tx>::m_endpoints.empty()) ? m_default=NULL : m_default=EndpointManager<_Tx>::m_endpoints.front();
}
/**
* @return matching endpoint, or NULL
*/
const _Tx* getByIndex(unsigned short index) const {
- for (std::vector<_Tx*>::const_iterator i = m_endpoints.begin(); i!=m_endpoints.end(); ++i) {
+ for (typename std::vector<_Tx*>::const_iterator i = EndpointManager<_Tx>::m_endpoints.begin(); i!=EndpointManager<_Tx>::m_endpoints.end(); ++i) {
std::pair<bool,int> comp = (*i)->getIndex();
if (comp.first && index == comp.second)
return *i;
const _Tx* getByBinding(const XMLCh* binding) const {
if (getDefault() && xercesc::XMLString::equals(binding,m_default->getBinding()))
return m_default;
- return EndpointManager::getByBinding(binding);
+ return EndpointManager<_Tx>::getByBinding(binding);
}
};
};