Use of copy-constructors

explicitly initialize the base class in a copy-constructor instead
of implicitly calling the default constructor.
This commit is contained in:
Torsten Dreyer 2011-12-25 20:11:06 +01:00
parent 4ae7c90d49
commit aef8f13290
6 changed files with 8 additions and 4 deletions

View File

@ -664,7 +664,8 @@ SGPropertyNode::SGPropertyNode ()
* Copy constructor. * Copy constructor.
*/ */
SGPropertyNode::SGPropertyNode (const SGPropertyNode &node) SGPropertyNode::SGPropertyNode (const SGPropertyNode &node)
: _index(node._index), : SGReferenced(node),
_index(node._index),
_name(node._name), _name(node._name),
_parent(0), // don't copy the parent _parent(0), // don't copy the parent
_type(node._type), _type(node._type),

View File

@ -90,7 +90,7 @@ Effect::Effect()
} }
Effect::Effect(const Effect& rhs, const CopyOp& copyop) Effect::Effect(const Effect& rhs, const CopyOp& copyop)
: root(rhs.root), parametersProp(rhs.parametersProp), _cache(0), : osg::Object(rhs,copyop), root(rhs.root), parametersProp(rhs.parametersProp), _cache(0),
_isRealized(rhs._isRealized) _isRealized(rhs._isRealized)
{ {
typedef vector<ref_ptr<Technique> > TechniqueList; typedef vector<ref_ptr<Technique> > TechniqueList;

View File

@ -36,6 +36,7 @@ EffectCullVisitor::EffectCullVisitor()
} }
EffectCullVisitor::EffectCullVisitor(const EffectCullVisitor& rhs) : EffectCullVisitor::EffectCullVisitor(const EffectCullVisitor& rhs) :
osg::Referenced(rhs),
CullVisitor(rhs) CullVisitor(rhs)
{ {
} }

View File

@ -58,6 +58,7 @@ Technique::Technique(bool alwaysValid)
} }
Technique::Technique(const Technique& rhs, const osg::CopyOp& copyop) : Technique::Technique(const Technique& rhs, const osg::CopyOp& copyop) :
osg::Object(rhs,copyop),
_contextMap(rhs._contextMap), _alwaysValid(rhs._alwaysValid), _contextMap(rhs._contextMap), _alwaysValid(rhs._alwaysValid),
_shadowingStateSet(copyop(rhs._shadowingStateSet.get())), _shadowingStateSet(copyop(rhs._shadowingStateSet.get())),
_validExpression(rhs._validExpression), _validExpression(rhs._validExpression),

View File

@ -103,7 +103,7 @@ protected:
struct ContextInfo : public osg::Referenced struct ContextInfo : public osg::Referenced
{ {
ContextInfo() : valid(UNKNOWN) {} ContextInfo() : valid(UNKNOWN) {}
ContextInfo(const ContextInfo& rhs) : valid(rhs.valid()) {} ContextInfo(const ContextInfo& rhs) : osg::Referenced(rhs), valid(rhs.valid()) {}
ContextInfo& operator=(const ContextInfo& rhs) ContextInfo& operator=(const ContextInfo& rhs)
{ {
valid = rhs.valid; valid = rhs.valid;

View File

@ -34,7 +34,8 @@ public:
SGSceneUserData() {} SGSceneUserData() {}
SGSceneUserData(const SGSceneUserData& rhs, SGSceneUserData(const SGSceneUserData& rhs,
const osg::CopyOp& copyOp = osg::CopyOp::SHALLOW_COPY) const osg::CopyOp& copyOp = osg::CopyOp::SHALLOW_COPY)
: _bvhNode(rhs._bvhNode), _velocity(rhs._velocity), : osg::Object(rhs,copyOp),
_bvhNode(rhs._bvhNode), _velocity(rhs._velocity),
_pickCallbacks(rhs._pickCallbacks) _pickCallbacks(rhs._pickCallbacks)
{ {
} }