From f061999b22ffe17928272ffd63b29abd11c98b4f Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 29 Jan 2002 14:20:29 +0000 Subject: [PATCH] Removed the now rendundent DeepCopy and ShallowCopy files. --- include/osg/DeepCopy | 58 ----------------------------------------- include/osg/ShallowCopy | 41 ----------------------------- 2 files changed, 99 deletions(-) delete mode 100644 include/osg/DeepCopy delete mode 100644 include/osg/ShallowCopy diff --git a/include/osg/DeepCopy b/include/osg/DeepCopy deleted file mode 100644 index a5532bc33..000000000 --- a/include/osg/DeepCopy +++ /dev/null @@ -1,58 +0,0 @@ -//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_DEEPWCOPY -#define OSG_DEEPWCOPY 1 - -#include -#include -#include - -namespace osg { - - -/** 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 DeepCopy : public CopyOp -{ - - enum CopyOptions - { - DEEP_COPY_OBJECTS = 1, - DEEP_COPY_NODES = 2, - DEEP_COPY_DRAWABLES = 4, - DEEP_COPY_STATESETS = 8, - DEEP_COPY_STATEATTRIBUTES = 16, - DEEP_COPY_TEXTURES = 32, - DEEP_COPY_IMAGES = 64, - DEEP_COPY_ALL = 0xffffffff - }; - - typedef unsigned int CopyFlags; - - DeepCopy(CopyFlags flags=DEEP_COPY_NODES):_flags(flags) {} - - virtual ~DeepCopy() {}; - - // note can't clone a refernced object since it doens't have clone - // method so we have to assume shallow copy and pass back the pointer. - virtual Referenced* operator() (const Referenced* ref) const { return const_cast(ref); } - - virtual Object* operator() (const Object* obj) const { if (obj && _flags&DEEP_COPY_OBJECTS) return obj->clone(*this); else return const_cast(obj); } - virtual Node* operator() (const Node* node) const { if (node && _flags&DEEP_COPY_NODES) return dynamic_cast(node->clone(*this)); else return const_cast(node); } - virtual Drawable* operator() (const Drawable* drawable) const { if (drawable && _flags&DEEP_COPY_DRAWABLES) return dynamic_cast(drawable->clone(*this)); else return const_cast(drawable); } - virtual StateSet* operator() (const StateSet* stateset) const { if (stateset && _flags&DEEP_COPY_STATESETS) return dynamic_cast(stateset->clone(*this)); else return const_cast(stateset); } - virtual StateAttribute* operator() (const StateAttribute* attr) const { if (attr && _flags&DEEP_COPY_STATEATTRIBUTES) return dynamic_cast(attr->clone(*this)); else return const_cast(attr); } - virtual Texture* operator() (const Texture* text) const { if (text && _flags&DEEP_COPY_TEXTURES) return dynamic_cast(text->clone(*this)); else return const_cast(text); } - virtual Image* operator() (const Image* image) const { if (image && _flags&DEEP_COPY_IMAGES) return dynamic_cast(image->clone(*this)); else return const_cast(image); } - - protected: - - CopyFlags _flags; -}; - -}; - -#endif diff --git a/include/osg/ShallowCopy b/include/osg/ShallowCopy deleted file mode 100644 index df8856675..000000000 --- a/include/osg/ShallowCopy +++ /dev/null @@ -1,41 +0,0 @@ -//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(ref); } - virtual Object* operator() (const Object* obj) const { return const_cast(obj); } - virtual Node* operator() (const Node* node) const { return const_cast(node); } - virtual Drawable* operator() (const Drawable* drawable) const { return const_cast(drawable); } - virtual StateSet* operator() (const StateSet* stateset) const { return const_cast(stateset); } - virtual StateAttribute* operator() (const StateAttribute* attr) const { return const_cast(attr); } - virtual Texture* operator() (const Texture* text) const { return const_cast(text); } - virtual Image* operator() (const Image* image) const { return const_cast(image); } -}; - -/** Convenience typedef so that users can use the more logical ShallowCopy in their own code.*/ -typedef CopyOp ShallowCopy; - -}; - -#endif