1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef _PERSISTENT_SPAWNABLE_
20 #define _PERSISTENT_SPAWNABLE_
25 public NLMISC::CDbgRefCount
< CSpawnable
<T
> >,
26 public NLMISC::CRefCount
29 CSpawnable(T
& owner
) : _Owner(owner
)
36 inline T
& getPersistent () const
54 virtual ~CPersistent ( )
59 bool isSpawned () const
61 return !_Spawnable
.isNull();
63 void setSpawn (const NLMISC::CSmartPtr
<T
> &spawnable
)
67 nlassert((!spawnable
) || (static_cast<CPersistent
<T
>*>(&spawnable
->getPersistent())==static_cast<CPersistent
<T
>*>(this)));
71 inline T
*getSpawnObj() const // you must overload this access to cast the objet with a custom more proper type. ( you know what i mean ? )
78 // virtual bool spawn () = 0;
79 // virtual void despawn () = 0;
82 NLMISC::CSmartPtr
<T
> _Spawnable
;