42 lines
1.6 KiB
Plaintext
42 lines
1.6 KiB
Plaintext
//C++ header - Open Scene Graph - Copyright (C) 1998-2001 Robert Osfield
|
|
//Distributed under the terms of the GNU Library General Public License (LGPL)
|
|
//as published by the Free Software Foundation.
|
|
|
|
#ifndef OSG_SHALLOWCOPY
|
|
#define OSG_SHALLOWCOPY 1
|
|
|
|
namespace osg {
|
|
|
|
class Referenced;
|
|
class Object;
|
|
class Image;
|
|
class Texture;
|
|
class StateSet;
|
|
class StateAttribute;
|
|
class Node;
|
|
class Drawable;
|
|
|
|
/** CopyOp Functor used to control the whether shallow or deep copy is used
|
|
* during copy construction and clone operation. The base CopyOp acts as
|
|
* a shallow copy simply passing back the same pointer as passed in.*/
|
|
struct CopyOp
|
|
{
|
|
virtual ~CopyOp() {}
|
|
|
|
virtual Referenced* operator() (const Referenced* ref) const { return const_cast<Referenced*>(ref); }
|
|
virtual Object* operator() (const Object* obj) const { return const_cast<Object*>(obj); }
|
|
virtual Node* operator() (const Node* node) const { return const_cast<Node*>(node); }
|
|
virtual Drawable* operator() (const Drawable* drawable) const { return const_cast<Drawable*>(drawable); }
|
|
virtual StateSet* operator() (const StateSet* stateset) const { return const_cast<StateSet*>(stateset); }
|
|
virtual StateAttribute* operator() (const StateAttribute* attr) const { return const_cast<StateAttribute*>(attr); }
|
|
virtual Texture* operator() (const Texture* text) const { return const_cast<Texture*>(text); }
|
|
virtual Image* operator() (const Image* image) const { return const_cast<Image*>(image); }
|
|
};
|
|
|
|
/** Convenience typedef so that users can use the more logical ShallowCopy in their own code.*/
|
|
typedef CopyOp ShallowCopy;
|
|
|
|
};
|
|
|
|
#endif
|