+/*
+ * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
#ifndef SQUID_ADAPTATION__SERVICE_GROUPS_H
#define SQUID_ADAPTATION__SERVICE_GROUPS_H
-#include "SquidString.h"
-#include "Array.h"
-#include "RefCount.h"
#include "adaptation/Elements.h"
#include "adaptation/forward.h"
+#include "base/RefCount.h"
+#include "SquidString.h"
+
+#include <vector>
namespace Adaptation
{
public:
typedef RefCount<ServiceGroup> Pointer;
- typedef Vector<String> Store;
+ typedef std::vector<String> Store;
typedef String Id;
- typedef unsigned int Pos; // Vector<>::poistion_type
+ typedef unsigned int Pos; // vector<>::position_type
friend class ServicePlan;
public:
String kind;
Id id;
Store services;
+ Store removedServices;///< the disabled services in the case ecap or icap is disabled
Method method; /// based on the first added service
VectPoint point; /// based on the first added service
protected:
virtual bool replace(Pos &pos) const { return has(++pos); }
- virtual bool advance(Pos &pos) const { return false; }
+ virtual bool advance(Pos &) const { return false; }
};
// corner case: a group consisting of one service
SingleService(const String &aServiceKey);
protected:
- virtual bool replace(Pos &pos) const { return false; }
- virtual bool advance(Pos &pos) const { return false; }
+ virtual bool replace(Pos &) const { return false; }
+ virtual bool advance(Pos &) const { return false; }
};
/// a group of services that must be used one after another
ServiceChain();
protected:
- virtual bool replace(Pos &pos) const { return false; }
+ virtual bool replace(Pos &) const { return false; }
virtual bool advance(Pos &pos) const { return has(++pos); }
};
class DynamicServiceChain: public ServiceChain
{
public:
- DynamicServiceChain(const String &srvcs, const ServiceGroupPointer prev);
-};
+ DynamicServiceChain(const DynamicGroupCfg &cfg, const ServiceFilter &f);
+ /// separates dynamic services matching current location from future ones
+ static void Split(const ServiceFilter &filter, const String &ids,
+ DynamicGroupCfg ¤t, DynamicGroupCfg &future);
+};
/** iterates services stored in a group; iteration is not linear because we
need to both replace failed services and advance to the next chain link */
class ServicePlan
{
public:
- typedef unsigned int Pos; // Vector<>::poistion_type
+ typedef unsigned int Pos; // vector<>::position_type
public:
ServicePlan();
return p.print(os);
}
-typedef Vector<ServiceGroupPointer> Groups;
-extern Groups &AllGroups();
-extern ServiceGroupPointer FindGroup(const ServiceGroup::Id &id);
-
+typedef std::vector<ServiceGroupPointer> Groups;
+Groups &AllGroups();
+ServiceGroupPointer FindGroup(const ServiceGroup::Id &id);
} // namespace Adaptation