advisor.hpp
Go to the documentation of this file.
/* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
* Main authors:
* Mikael Lagerkvist <lagerkvist@gecode.org>
* Christian Schulte <schulte@gecode.org>
*
* Copyright:
* Mikael Lagerkvist, 2006
* Christian Schulte, 2007
*
* This file is part of Gecode, the generic constraint
* development environment:
* http://www.gecode.org
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*/
namespace Gecode {
template<class View>
class ViewAdvisor : public Advisor {
protected:
View x;
public:
template<class A>
ViewAdvisor(Space& home, Propagator& p, Council<A>& c, View x0);
ViewAdvisor(Space& home, ViewAdvisor<View>& a);
View view(void) const;
void view(Space& home, View y);
template<class A>
void dispose(Space& home, Council<A>& c);
};
template<class View>
template<class A>
forceinline
ViewAdvisor<View>::ViewAdvisor(Space& home, Propagator& p,
Council<A>& c, View x0)
: Advisor(home,p,c), x(x0) {
x.subscribe(home,*this);
}
template<class View>
forceinline
ViewAdvisor<View>::ViewAdvisor(Space& home, ViewAdvisor<View>& a)
: Advisor(home,a) {
x.update(home,a.x);
}
template<class View>
forceinline View
ViewAdvisor<View>::view(void) const {
return x;
}
template<class View>
forceinline void
ViewAdvisor<View>::view(Space& home, View y) {
x.cancel(home,*this); x=y; x.subscribe(home,*this);
}
template<class View>
template<class A>
forceinline void
ViewAdvisor<View>::dispose(Space& home, Council<A>& c) {
x.cancel(home,*this);
Advisor::dispose(home,c);
}
}
// STATISTICS: kernel-other
Gecode::Advisor::Advisor
Advisor(Space &home, Propagator &p, Council< A > &c)
Constructor for creation.
Definition core.hpp:3831
Gecode::Advisor::dispose
void dispose(Space &home, Council< A > &c)
Dispose the advisor.
Definition core.hpp:3864
Gecode::Advisor::Council
friend class Council
Definition core.hpp:1294
Gecode::FloatVal::x
FloatValImpType x
Implementation of float value.
Definition float.hh:425
Gecode::Propagator
Base-class for propagators.
Definition core.hpp:1064
Gecode::Space
Computation spaces.
Definition core.hpp:1742
Gecode::View
Gecode::ViewAdvisor::ViewAdvisor
ViewAdvisor(Space &home, Propagator &p, Council< A > &c, View x0)
Constructor for creation.
Definition advisor.hpp:66
Gecode::ViewAdvisor::dispose
void dispose(Space &home, Council< A > &c)
Delete advisor.
Definition advisor.hpp:90
Gecode::ViewAdvisor::x
View x
The single view.
Definition advisor.hpp:46
Gecode::ViewAdvisor::view
View view(void) const
Access view.
Definition advisor.hpp:79
Gecode
Gecode toplevel namespace
forceinline
#define forceinline
Definition config.hpp:187