5 * Created by Bryan Donlan on The Apr 11 2005
6 * Copyright (c) 2005 Bryan Donlan. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
25 void AgentRef::checkLife() const {
26 assert(ref
.expired() || !(ref
.lock()->isDying()));
29 void AgentRef::set(Agent
*a
) {
30 if (a
&& !a
->isDying())
31 set(a
->shared_from_this());
36 void AgentRef::dump() const {
37 std::cerr
<< "AgentRef " << (void *)this << " pointing to " << (void *)ref
.lock().get() << std::endl
;
40 boost::shared_ptr
<Agent
> AgentRef::lock() const {
41 boost::shared_ptr
<Agent
> p
= ref
.lock();
42 if (p
&& p
->isDying())