CopyOp 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
  2. *
  3. * This library is open source and may be redistributed and/or modified under
  4. * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
  5. * (at your option) any later version. The full license is in LICENSE file
  6. * included with this distribution, and on the openscenegraph.org website.
  7. *
  8. * This library is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * OpenSceneGraph Public License for more details.
  12. */
  13. #ifndef OSG_COPYOP
  14. #define OSG_COPYOP 1
  15. #include <osg/Export>
  16. namespace osg {
  17. class Referenced;
  18. class Object;
  19. class Image;
  20. class Texture;
  21. class StateSet;
  22. class StateAttribute;
  23. class StateAttributeCallback;
  24. class Uniform;
  25. class UniformCallback;
  26. class Node;
  27. class Drawable;
  28. class Array;
  29. class PrimitiveSet;
  30. class Shape;
  31. class Callback;
  32. /** Copy Op(erator) used to control whether shallow or deep copy is used
  33. * during copy construction and clone operation.*/
  34. class OSG_EXPORT CopyOp
  35. {
  36. public:
  37. enum Options
  38. {
  39. SHALLOW_COPY = 0,
  40. DEEP_COPY_OBJECTS = 1<<0,
  41. DEEP_COPY_NODES = 1<<1,
  42. DEEP_COPY_DRAWABLES = 1<<2,
  43. DEEP_COPY_STATESETS = 1<<3,
  44. DEEP_COPY_STATEATTRIBUTES = 1<<4,
  45. DEEP_COPY_TEXTURES = 1<<5,
  46. DEEP_COPY_IMAGES = 1<<6,
  47. DEEP_COPY_ARRAYS = 1<<7,
  48. DEEP_COPY_PRIMITIVES = 1<<8,
  49. DEEP_COPY_SHAPES = 1<<9,
  50. DEEP_COPY_UNIFORMS = 1<<10,
  51. DEEP_COPY_CALLBACKS = 1<<11,
  52. DEEP_COPY_USERDATA = 1<<12,
  53. DEEP_COPY_ALL = 0x7FFFFFFF
  54. };
  55. typedef unsigned int CopyFlags;
  56. inline CopyOp(CopyFlags flags=SHALLOW_COPY):_flags(flags) {}
  57. virtual ~CopyOp() {}
  58. void setCopyFlags(CopyFlags flags) { _flags = flags; }
  59. CopyFlags getCopyFlags() const { return _flags; }
  60. virtual Referenced* operator() (const Referenced* ref) const;
  61. virtual Object* operator() (const Object* obj) const;
  62. virtual Node* operator() (const Node* node) const;
  63. virtual Drawable* operator() (const Drawable* drawable) const;
  64. virtual StateSet* operator() (const StateSet* stateset) const;
  65. virtual StateAttribute* operator() (const StateAttribute* attr) const;
  66. virtual Texture* operator() (const Texture* text) const;
  67. virtual Image* operator() (const Image* image) const;
  68. virtual Array* operator() (const Array* array) const;
  69. virtual PrimitiveSet* operator() (const PrimitiveSet* primitives) const;
  70. virtual Shape* operator() (const Shape* shape) const;
  71. virtual Uniform* operator() (const Uniform* shape) const;
  72. virtual Callback* operator() (const Callback* nodecallback) const;
  73. virtual StateAttributeCallback* operator() (const StateAttributeCallback* stateattributecallback) const;
  74. virtual UniformCallback* operator() (const UniformCallback* uniformcallback) const;
  75. protected:
  76. CopyFlags _flags;
  77. };
  78. }
  79. #endif