Skip to content

Commit

Permalink
Updated const correctness in all classes that rely on m_impl
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyselan committed Dec 27, 2010
1 parent 751e65b commit a0fb960
Show file tree
Hide file tree
Showing 15 changed files with 293 additions and 265 deletions.
18 changes: 14 additions & 4 deletions export/OpenColorIO/OpenColorIO.h
Expand Up @@ -344,6 +344,8 @@ OCIO_NAMESPACE_ENTER
class Impl;
friend class Impl;
Impl * m_impl;
Impl * getImpl() { return m_impl; }
const Impl * getImpl() const { return m_impl; }
};

extern OCIOEXPORT std::ostream& operator<< (std::ostream&, const Config&);
Expand Down Expand Up @@ -433,6 +435,8 @@ OCIO_NAMESPACE_ENTER
class Impl;
friend class Impl;
Impl * m_impl;
Impl * getImpl() { return m_impl; }
const Impl * getImpl() const { return m_impl; }
};

extern OCIOEXPORT std::ostream& operator<< (std::ostream&, const ColorSpace&);
Expand Down Expand Up @@ -556,6 +560,8 @@ OCIO_NAMESPACE_ENTER
class Impl;
friend class Impl;
Impl * m_impl;
Impl * getImpl() { return m_impl; }
const Impl * getImpl() const { return m_impl; }

PackedImageDesc(const PackedImageDesc &);
PackedImageDesc& operator= (const PackedImageDesc &);
Expand Down Expand Up @@ -585,6 +591,8 @@ OCIO_NAMESPACE_ENTER
class Impl;
friend class Impl;
Impl * m_impl;
Impl * getImpl() { return m_impl; }
const Impl * getImpl() const { return m_impl; }

PlanarImageDesc(const PlanarImageDesc &);
PlanarImageDesc& operator= (const PlanarImageDesc &);
Expand All @@ -609,12 +617,15 @@ OCIO_NAMESPACE_ENTER
int getLut3DEdgeLen() const;

private:
class Impl;
friend class Impl;
Impl * m_impl;

GpuShaderDesc(const GpuShaderDesc &);
GpuShaderDesc& operator= (const GpuShaderDesc &);

class Impl;
friend class Impl;
Impl * m_impl;
Impl * getImpl() { return m_impl; }
const Impl * getImpl() const { return m_impl; }
};


Expand Down Expand Up @@ -656,7 +667,6 @@ OCIO_NAMESPACE_ENTER
class Impl;
friend class Impl;
Impl * m_impl;

Impl * getImpl() { return m_impl; }
const Impl * getImpl() const { return m_impl; }
};
Expand Down
18 changes: 18 additions & 0 deletions export/OpenColorIO/OpenColorTransforms.h
Expand Up @@ -98,6 +98,8 @@ OCIO_NAMESPACE_ENTER
class Impl;
friend class Impl;
Impl * m_impl;
Impl * getImpl() { return m_impl; }
const Impl * getImpl() const { return m_impl; }
};

extern OCIOEXPORT std::ostream& operator<< (std::ostream&, const AllocationTransform&);
Expand Down Expand Up @@ -177,6 +179,8 @@ OCIO_NAMESPACE_ENTER
class Impl;
friend class Impl;
Impl * m_impl;
Impl * getImpl() { return m_impl; }
const Impl * getImpl() const { return m_impl; }
};

extern OCIOEXPORT std::ostream& operator<< (std::ostream&, const CDLTransform&);
Expand Down Expand Up @@ -215,6 +219,8 @@ OCIO_NAMESPACE_ENTER
class Impl;
friend class Impl;
Impl * m_impl;
Impl * getImpl() { return m_impl; }
const Impl * getImpl() const { return m_impl; }
};

extern OCIOEXPORT std::ostream& operator<< (std::ostream&, const ColorSpaceTransform&);
Expand Down Expand Up @@ -275,6 +281,8 @@ OCIO_NAMESPACE_ENTER
class Impl;
friend class Impl;
Impl * m_impl;
Impl * getImpl() { return m_impl; }
const Impl * getImpl() const { return m_impl; }
};

extern OCIOEXPORT std::ostream& operator<< (std::ostream&, const DisplayTransform&);
Expand Down Expand Up @@ -314,6 +322,8 @@ OCIO_NAMESPACE_ENTER
class Impl;
friend class Impl;
Impl * m_impl;
Impl * getImpl() { return m_impl; }
const Impl * getImpl() const { return m_impl; }
};

extern OCIOEXPORT std::ostream& operator<< (std::ostream&, const ExponentTransform&);
Expand Down Expand Up @@ -352,6 +362,8 @@ OCIO_NAMESPACE_ENTER
class Impl;
friend class Impl;
Impl * m_impl;
Impl * getImpl() { return m_impl; }
const Impl * getImpl() const { return m_impl; }
};

extern OCIOEXPORT std::ostream& operator<< (std::ostream&, const FileTransform&);
Expand Down Expand Up @@ -391,6 +403,8 @@ OCIO_NAMESPACE_ENTER
class Impl;
friend class Impl;
Impl * m_impl;
Impl * getImpl() { return m_impl; }
const Impl * getImpl() const { return m_impl; }
};

extern OCIOEXPORT std::ostream& operator<< (std::ostream&, const GroupTransform&);
Expand Down Expand Up @@ -430,6 +444,8 @@ OCIO_NAMESPACE_ENTER
class Impl;
friend class Impl;
Impl * m_impl;
Impl * getImpl() { return m_impl; }
const Impl * getImpl() const { return m_impl; }
};

extern OCIOEXPORT std::ostream& operator<< (std::ostream&, const LogTransform&);
Expand Down Expand Up @@ -490,6 +506,8 @@ OCIO_NAMESPACE_ENTER
class Impl;
friend class Impl;
Impl * m_impl;
Impl * getImpl() { return m_impl; }
const Impl * getImpl() const { return m_impl; }
};

extern OCIOEXPORT std::ostream& operator<< (std::ostream&, const MatrixTransform&);
Expand Down
22 changes: 11 additions & 11 deletions src/core/AllocationTransform.cpp
Expand Up @@ -101,47 +101,47 @@ OCIO_NAMESPACE_ENTER

TransformDirection AllocationTransform::getDirection() const
{
return m_impl->dir_;
return getImpl()->dir_;
}

void AllocationTransform::setDirection(TransformDirection dir)
{
m_impl->dir_ = dir;
getImpl()->dir_ = dir;
}


Allocation AllocationTransform::getAllocation() const
{
return m_impl->allocation_;
return getImpl()->allocation_;
}

void AllocationTransform::setAllocation(Allocation allocation)
{
m_impl->allocation_ = allocation;
getImpl()->allocation_ = allocation;
}

int AllocationTransform::getNumVars() const
{
return static_cast<int>(m_impl->vars_.size());
return static_cast<int>(getImpl()->vars_.size());
}

void AllocationTransform::getVars(float * vars) const
{
if(!m_impl->vars_.empty())
if(!getImpl()->vars_.empty())
{
memcpy(vars,
&m_impl->vars_[0],
m_impl->vars_.size()*sizeof(float));
&getImpl()->vars_[0],
getImpl()->vars_.size()*sizeof(float));
}
}

void AllocationTransform::setVars(int numvars, const float * vars)
{
m_impl->vars_.resize(numvars);
getImpl()->vars_.resize(numvars);

if(!m_impl->vars_.empty())
if(!getImpl()->vars_.empty())
{
memcpy(&m_impl->vars_[0],
memcpy(&getImpl()->vars_[0],
vars,
numvars*sizeof(float));
}
Expand Down
40 changes: 20 additions & 20 deletions src/core/CDLTransform.cpp
Expand Up @@ -240,22 +240,22 @@ OCIO_NAMESPACE_ENTER

TransformDirection CDLTransform::getDirection() const
{
return m_impl->dir_;
return getImpl()->dir_;
}

void CDLTransform::setDirection(TransformDirection dir)
{
m_impl->dir_ = dir;
getImpl()->dir_ = dir;
}

const char * CDLTransform::getXML() const
{
return m_impl->getXML();
return getImpl()->getXML();
}

void CDLTransform::setXML(const char * xml)
{
m_impl->setXML(xml);
getImpl()->setXML(xml);

// These will throw an exception if the xml is in any way invalid.
getSlope(0);
Expand All @@ -273,7 +273,7 @@ OCIO_NAMESPACE_ENTER
{
if(!other) return false;

if(m_impl->dir_ != other->m_impl->dir_) return false;
if(getImpl()->dir_ != other->getImpl()->dir_) return false;

float sop1[9];
getSOP(sop1);
Expand Down Expand Up @@ -311,32 +311,32 @@ OCIO_NAMESPACE_ENTER

void CDLTransform::setSlope(const float * rgb)
{
m_impl->setSOPVec(rgb, "Slope");
getImpl()->setSOPVec(rgb, "Slope");
}

void CDLTransform::getSlope(float * rgb) const
{
m_impl->getSOPVec(rgb, "Slope");
getImpl()->getSOPVec(rgb, "Slope");
}

void CDLTransform::setOffset(const float * rgb)
{
m_impl->setSOPVec(rgb, "Offset");
getImpl()->setSOPVec(rgb, "Offset");
}

void CDLTransform::getOffset(float * rgb) const
{
m_impl->getSOPVec(rgb, "Offset");
getImpl()->getSOPVec(rgb, "Offset");
}

void CDLTransform::setPower(const float * rgb)
{
m_impl->setSOPVec(rgb, "Power");
getImpl()->setSOPVec(rgb, "Power");
}

void CDLTransform::getPower(float * rgb) const
{
m_impl->getSOPVec(rgb, "Power");
getImpl()->getSOPVec(rgb, "Power");
}

void CDLTransform::setSOP(const float * vec9)
Expand All @@ -355,9 +355,9 @@ OCIO_NAMESPACE_ENTER

void CDLTransform::setSat(float sat)
{
m_impl->xml_ = "";
getImpl()->xml_ = "";

TiXmlHandle docHandle( m_impl->doc_ );
TiXmlHandle docHandle( getImpl()->doc_ );
std::string errorName("ColorCorrection.SatNode.Saturation");

TiXmlElement* element = docHandle.FirstChild( "ColorCorrection" ).FirstChild( "SatNode" ).FirstChild( "Saturation" ).ToElement();
Expand All @@ -374,7 +374,7 @@ OCIO_NAMESPACE_ENTER

float CDLTransform::getSat() const
{
TiXmlHandle docHandle( m_impl->doc_ );
TiXmlHandle docHandle( getImpl()->doc_ );
std::string errorName("ColorCorrection.SatNode.Saturation");

TiXmlElement* element = docHandle.FirstChild( "ColorCorrection" ).FirstChild( "SatNode" ).FirstChild( "Saturation" ).ToElement();
Expand Down Expand Up @@ -406,9 +406,9 @@ OCIO_NAMESPACE_ENTER

void CDLTransform::setID(const char * id)
{
m_impl->xml_ = "";
getImpl()->xml_ = "";

TiXmlHandle docHandle( m_impl->doc_ );
TiXmlHandle docHandle( getImpl()->doc_ );
std::string errorName("ColorCorrection");

TiXmlElement* element = docHandle.FirstChild( "ColorCorrection" ).ToElement();
Expand All @@ -424,7 +424,7 @@ OCIO_NAMESPACE_ENTER

const char * CDLTransform::getID() const
{
TiXmlHandle docHandle( m_impl->doc_ );
TiXmlHandle docHandle( getImpl()->doc_ );
std::string errorName("ColorCorrection");

TiXmlElement* element = docHandle.FirstChild( "ColorCorrection" ).ToElement();
Expand All @@ -442,9 +442,9 @@ OCIO_NAMESPACE_ENTER

void CDLTransform::setDescription(const char * desc)
{
m_impl->xml_ = "";
getImpl()->xml_ = "";

TiXmlHandle docHandle( m_impl->doc_ );
TiXmlHandle docHandle( getImpl()->doc_ );
std::string errorName("ColorCorrection.SOPNode.Description");

TiXmlElement* element = docHandle.FirstChild( "ColorCorrection" ).FirstChild( "SOPNode" ).FirstChild( "Description" ).ToElement();
Expand All @@ -460,7 +460,7 @@ OCIO_NAMESPACE_ENTER

const char * CDLTransform::getDescription() const
{
TiXmlHandle docHandle( m_impl->doc_ );
TiXmlHandle docHandle( getImpl()->doc_ );
std::string errorName("ColorCorrection.SOPNode.Description");

TiXmlElement* element = docHandle.FirstChild( "ColorCorrection" ).FirstChild( "SOPNode" ).FirstChild( "Description" ).ToElement();
Expand Down

0 comments on commit a0fb960

Please sign in to comment.