/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield 
 *
 * This library is open source and may be redistributed and/or modified under  
 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 
 * (at your option) any later version.  The full license is in LICENSE file
 * included with this distribution, and on the openscenegraph.org website.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 * OpenSceneGraph Public License for more details.
*/

#ifndef OSG_COPYOP
#define OSG_COPYOP 1

#include <osg/Export>

namespace osg {

class Referenced;
class Object;
class Image;
//class Texture;
class Texture;
class StateSet;
class StateAttribute;
class Node;
class Drawable;
class Array;
class PrimitiveSet;
class Shape;

/** Copy Op(erator) used to control the whether shallow or deep copy is used
  * during copy construction and clone operation.*/
class SG_EXPORT CopyOp
{

    public:
    
        enum Options
        {
            SHALLOW_COPY    	    	= 0,
            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_ARRAYS 	    	= 128,
            DEEP_COPY_PRIMITIVES    	= 256,
            DEEP_COPY_SHAPES 	    	= 512,
            DEEP_COPY_ALL   	    	= 0xffffffff
        };

        typedef unsigned int CopyFlags;

        inline CopyOp(CopyFlags flags=SHALLOW_COPY):_flags(flags) {}
        virtual ~CopyOp() {}

        virtual Referenced*     operator() (const Referenced* ref) const;
        virtual Object*         operator() (const Object* obj) const;
        virtual Node*           operator() (const Node* node) const;
        virtual Drawable*       operator() (const Drawable* drawable) const;
        virtual StateSet*       operator() (const StateSet* stateset) const;
        virtual StateAttribute* operator() (const StateAttribute* attr) const;
        virtual Texture*        operator() (const Texture* text) const;
        virtual Image*          operator() (const Image* image) const;
        virtual Array*          operator() (const Array* array) const;
        virtual PrimitiveSet*   operator() (const PrimitiveSet* primitives) const;
        virtual Shape*      	operator() (const Shape* shape) const;

    protected:
    
        CopyFlags _flags;
};

}

#endif
