IccMAX 2.1.27
Color Profile Tools
Loading...
Searching...
No Matches
CIccTagFixedNum< T, Tsig > Class Template Reference

#include <IccTagBasic.h>

+ Inheritance diagram for CIccTagFixedNum< T, Tsig >:
+ Collaboration diagram for CIccTagFixedNum< T, Tsig >:

Public Member Functions

 CIccTagFixedNum (const CIccTagFixedNum< T, Tsig > &ITFN)
 
 CIccTagFixedNum (int nSize=1)
 
virtual ~CIccTagFixedNum ()
 
virtual void Describe (std::string &sDescription, int nVerboseness)
 
virtual void DetachIO ()
 
virtual const icCharGetClassName () const
 
virtual IIccExtensionTagGetExtension ()
 
virtual icUInt32Number GetNumValues () const
 
icUInt32Number GetSize () const
 Returns the size of the data array.
 
virtual icArraySignature GetTagArrayType () const
 
virtual icStructSignature GetTagStructType () const
 
virtual icTagTypeSignature GetType () const
 
virtual bool GetValues (icFloatNumber *DstVector, icUInt32Number nStart=0, icUInt32Number nVectorSize=1) const
 
virtual bool Interpolate (icFloatNumber *DstVector, icFloatNumber val, icUInt32Number nVectorSize=1, icFloatNumber *zeroVals=NULL) const
 
virtual bool IsArrayType ()
 
virtual bool IsMatrixArray () const
 
virtual bool IsMBBType ()
 
virtual bool IsNumArrayType () const
 
virtual bool IsSupported ()
 
virtual CIccTagNewCopy () const
 
CIccTagFixedNumoperator= (const CIccTagFixedNum< T, Tsig > &FixedNumTag)
 
T & operator[] (icUInt32Number index)
 
virtual bool Read (icUInt32Number size, CIccIO *pIO)
 
virtual bool Read (icUInt32Number size, CIccIO *pIO, CIccProfile *pProfile)
 
virtual bool ReadAll ()
 
bool SetSize (icUInt32Number nSize, bool bZeroNew=true)
 
virtual icValidateStatus Validate (std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
 
virtual bool ValuePos (icFloatNumber &DstPos, icFloatNumber val, bool &bNoZero) const
 
virtual bool Write (CIccIO *pIO)
 

Static Public Member Functions

static CIccTagCreate (icTagTypeSignature sig)
 

Data Fields

icUInt32Number m_nReserved
 

Protected Attributes

icUInt32Number m_nSize
 
T * m_Num
 

Detailed Description

template<class T, icTagTypeSignature Tsig>
class CIccTagFixedNum< T, Tsig >

Class: CIccTagFixedNum

Purpose: A template class for arrays of Fixed point numbers

Derived Tags: CIccTagS15Fixed16 and CIccTagU16Fixed16

Constructor & Destructor Documentation

◆ CIccTagFixedNum() [1/2]

template<class T , icTagTypeSignature Tsig>
CIccTagFixedNum< T, Tsig >::CIccTagFixedNum ( int  nSize = 1)

Name: CIccTagFixedNum::CIccTagFixedNum

Purpose: CIccTagFixedNumConstructor

Args: nSize = number of data entries

5142{
5143 m_nSize = nSize;
5144 if (m_nSize <1)
5145 m_nSize = 1;
5146 m_Num = (T*)calloc(nSize, sizeof(T));
5147}
T * m_Num
Definition IccTagBasic.h:933
icUInt32Number m_nSize
Definition IccTagBasic.h:934

References CIccTagFixedNum< T, Tsig >::m_nSize, and CIccTagFixedNum< T, Tsig >::m_Num.

Referenced by main().

+ Here is the caller graph for this function:

◆ CIccTagFixedNum() [2/2]

template<class T , icTagTypeSignature Tsig>
CIccTagFixedNum< T, Tsig >::CIccTagFixedNum ( const CIccTagFixedNum< T, Tsig > &  ITFN)

Name: CIccTagFixedNum::CIccTagFixedNum

Purpose: Copy Constructor

Args: ITFN = The CIccTagFixedNum object to be copied

5162{
5163 m_nSize = ITFN.m_nSize;
5164 m_Num = (T*)calloc(m_nSize, sizeof(T));
5165 memcpy(m_Num, ITFN.m_Num, m_nSize*sizeof(T));
5166}

References CIccTagFixedNum< T, Tsig >::m_nSize, and CIccTagFixedNum< T, Tsig >::m_Num.

◆ ~CIccTagFixedNum()

template<class T , icTagTypeSignature Tsig>
CIccTagFixedNum< T, Tsig >::~CIccTagFixedNum ( )
virtual

Name: CIccTagFixedNum::~CIccTagFixedNum

Purpose: Destructor

5207{
5208 if (m_Num)
5209 free(m_Num);
5210}

References CIccTagFixedNum< T, Tsig >::m_Num.

Member Function Documentation

◆ Create()

CIccTag * CIccTag::Create ( icTagTypeSignature  sig)
staticinherited

Name: CIccTag::Create

Purpose: This is a static tag creator based upon tag signature type

Args: sig = tag type signature

Return: Pointer to Allocated tag

144{
145 return CIccTagCreator::CreateTag(sig);
146}
static CIccTag * CreateTag(icTagTypeSignature tagTypeSig)
Definition IccTagFactory.h:279

References CIccTagCreator::CreateTag().

Referenced by CIccDefaultEncProfileConverter::ConvertFromParams(), CIccTagStruct::LoadElem(), CIccProfileXml::ParseTag(), CIccTagXmlStruct::ParseTag(), CIccMpeXmlTintArray::ParseXml(), CIccTagXmlArray::ParseXml(), CIccMpeTintArray::Read(), CIccTagLutAtoB::Read(), CIccTagLut8::Read(), CIccTagLut16::Read(), CIccTagLut8::SetColorSpaces(), CIccTagLut16::SetColorSpaces(), and CIccProfileDescText::SetType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Describe()

template<class T , icTagTypeSignature Tsig>
void CIccTagFixedNum< T, Tsig >::Describe ( std::string &  sDescription,
int  nVerboseness 
)
virtual

Name: CIccTagFixedNum::Describe

Purpose: Dump data associated with the tag to a string

Args: sDescription - string to concatenate tag dump to

Reimplemented from CIccTag.

5321{
5322 icChar buf[128] = { 0 };
5323
5324 if (m_nSize == 1 ) {
5325 if (Tsig==icSigS15Fixed16ArrayType)
5326 sprintf(buf, "Value = %.4lf\n", icFtoD(m_Num[0]));
5327 else
5328 sprintf(buf, "Value = %.4lf\n", icUFtoD(m_Num[0]));
5329 sDescription += buf;
5330 }
5331 else {
5333
5334 if (Tsig==icSigS15Fixed16ArrayType && m_nSize==9) {
5335 sDescription += "Matrix Form:\n";
5336 icMatrixDump(sDescription, (icS15Fixed16Number*)m_Num);
5337
5338 sDescription += "\nArrayForm:\n";
5339 }
5340 sDescription.reserve(sDescription.size() + m_nSize*79);
5341
5342 for (i=0; i<m_nSize; i++) {
5343 if (Tsig==icSigS15Fixed16ArrayType)
5344 sprintf(buf, "Value[%u] = %8.4lf\n", i, icFtoD(m_Num[i]));
5345 else
5346 sprintf(buf, "Value[%u] = %8.4lf\n", i, icUFtoD(m_Num[i]));
5347 sDescription += buf;
5348 }
5349 }
5350}
unsigned long icUInt32Number
Definition icProfileHeader.h:262
@ icSigS15Fixed16ArrayType
Definition icProfileHeader.h:556
icInt32Number icS15Fixed16Number
Definition icProfileHeader.h:302
char icChar
Definition IccDefs.h:110
ICCPROFLIB_API void icMatrixDump(std::string &sDump, icS15Fixed16Number *pMatrix)
Definition IccUtil.cpp:988
ICCPROFLIB_API icFloatNumber icFtoD(icS15Fixed16Number num)
Definition IccUtil.cpp:559
ICCPROFLIB_API icFloatNumber icUFtoD(icU16Fixed16Number num)
Definition IccUtil.cpp:580

References icMatrixDump(), icSigS15Fixed16ArrayType, CIccTagFixedNum< T, Tsig >::m_nSize, and CIccTagFixedNum< T, Tsig >::m_Num.

+ Here is the call graph for this function:

◆ DetachIO()

virtual void CIccTag::DetachIO ( )
inlinevirtualinherited

Function: ReadAll() - Read All sub data for tag from file. Called by CIccProfile::ReadAll() to read all sub data for tag

Returns true if ReadAll is successful.

183{}

◆ GetClassName()

template<class T , icTagTypeSignature Tsig>
const icChar * CIccTagFixedNum< T, Tsig >::GetClassName ( ) const
virtual

Name: CIccTagFixedNum::GetClassName

Purpose: Returns the tag type class name

Reimplemented from CIccTag.

Reimplemented in CIccTagXmlFixedNum< T, Tsig >.

5222{
5223 if (Tsig==icSigS15Fixed16ArrayType)
5224 return "CIccTagS15Fixed16";
5225 else
5226 return "CIccTagU16Fixed16";
5227}

References icSigS15Fixed16ArrayType.

◆ GetExtension()

virtual IIccExtensionTag * CIccTag::GetExtension ( )
inlinevirtualinherited

Reimplemented in CIccTagXmlUnknown, CIccTagXmlText, CIccTagXmlUtf8Text, CIccTagXmlZipUtf8Text, CIccTagXmlZipXml, CIccTagXmlUtf16Text, CIccTagXmlTextDescription, CIccTagXmlSignature, CIccTagXmlNamedColor2, CIccTagXmlXYZ, CIccTagXmlChromaticity, CIccTagXmlCicp, CIccTagXmlSparseMatrixArray, CIccTagXmlFixedNum< T, Tsig >, CIccTagXmlNum< T, A, Tsig >, CIccTagXmlFloatNum< T, A, Tsig >, CIccTagXmlMeasurement, CIccTagXmlMultiLocalizedUnicode, CIccTagXmlTagData, CIccTagXmlDateTime, CIccTagXmlColorantOrder, CIccTagXmlColorantTable, CIccTagXmlViewingConditions, CIccTagXmlSpectralDataInfo, CIccTagXmlSpectralViewingConditions, CIccTagXmlProfileSeqDesc, CIccTagXmlResponseCurveSet16, CIccTagXmlCurve, CIccTagXmlParametricCurve, CIccTagXmlSegmentedCurve, CIccTagXmlLutAtoB, CIccTagXmlLutBtoA, CIccTagXmlLut8, CIccTagXmlLut16, CIccTagXmlMultiProcessElement, CIccTagXmlProfileSequenceId, CIccTagXmlDict, CIccTagXmlStruct, CIccTagXmlArray, CIccTagXmlGamutBoundaryDesc, CIccTagXmlEmbeddedHeightImage, CIccTagXmlEmbeddedNormalImage, and CIccTagXmlEmbeddedProfile.

143{return NULL;}

Referenced by icCurvesFromXml(), icCurvesToXml(), icProfDescToXml(), icXmlParseProfDesc(), CIccProfileXml::ParseTag(), CIccTagXmlStruct::ParseTag(), CIccMpeXmlTintArray::ParseXml(), CIccTagXmlArray::ParseXml(), CIccMpeXmlTintArray::ToXml(), CIccTagXmlStruct::ToXml(), CIccTagXmlArray::ToXml(), and CIccProfileXml::ToXmlWithBlanks().

+ Here is the caller graph for this function:

◆ GetNumValues()

template<class T , icTagTypeSignature Tsig>
virtual icUInt32Number CIccTagFixedNum< T, Tsig >::GetNumValues ( ) const
inlinevirtual

Implements CIccTagNumArray.

924{ return GetSize(); }
icUInt32Number GetSize() const
Returns the size of the data array.
Definition IccTagBasic.h:918

References CIccTagFixedNum< T, Tsig >::GetSize().

+ Here is the call graph for this function:

◆ GetSize()

template<class T , icTagTypeSignature Tsig>
icUInt32Number CIccTagFixedNum< T, Tsig >::GetSize ( ) const
inline

Returns the size of the data array.

918{ return m_nSize; }

References CIccTagFixedNum< T, Tsig >::m_nSize.

Referenced by CIccTagFixedNum< T, Tsig >::GetNumValues().

+ Here is the caller graph for this function:

◆ GetTagArrayType()

virtual icArraySignature CIccTag::GetTagArrayType ( ) const
inlinevirtualinherited

Reimplemented in CIccTagArray.

133{ return icSigUndefinedArray; }
@ icSigUndefinedArray
Definition icProfileHeader.h:617

References icSigUndefinedArray.

Referenced by icGetTagArrayHandlerOfType(), and CIccProfileXml::ParseTag().

+ Here is the caller graph for this function:

◆ GetTagStructType()

virtual icStructSignature CIccTag::GetTagStructType ( ) const
inlinevirtualinherited

Reimplemented in CIccTagStruct.

132{ return icSigUndefinedStruct; }
@ icSigUndefinedStruct
Definition icProfileHeader.h:606

References icSigUndefinedStruct.

Referenced by icGetTagStructHandlerOfType(), CIccArrayColorantInfo::Validate(), and CIccArrayNamedColor::Validate().

+ Here is the caller graph for this function:

◆ GetType()

template<class T , icTagTypeSignature Tsig>
virtual icTagTypeSignature CIccTagFixedNum< T, Tsig >::GetType ( ) const
inlinevirtual

Function: GetType()

Purpose: Get Tag Type. Each derived tag will implement it's own GetType() function.

Reimplemented from CIccTag.

907{ return Tsig; }

Referenced by CIccTagFixedNum< T, Tsig >::Write().

+ Here is the caller graph for this function:

◆ GetValues()

template<class T , icTagTypeSignature Tsig>
bool CIccTagFixedNum< T, Tsig >::GetValues ( icFloatNumber DstVector,
icUInt32Number  nStart = 0,
icUInt32Number  nVectorSize = 1 
) const
virtual

Name: CIccTagFixedNum::GetValues

Purpose: Gets values from the num array tag as floating point numbers

Args: nSize - number of data entries, bZeroNew - flag to zero newly formed values

Implements CIccTagNumArray.

5397{
5398 if (nVectorSize+nStart >m_nSize)
5399 return false;
5400
5402
5403 switch (Tsig) {
5405 for (i=0; i<m_nSize; i++) {
5406 DstVector[i] = (icFloatNumber)icFtoD(m_Num[i+nStart]);
5407 }
5408 break;
5410 for (i=0; i<m_nSize; i++) {
5411 DstVector[i] = (icFloatNumber)icUFtoD(m_Num[i+nStart]);
5412 }
5413 break;
5414 default:
5415 return false;
5416 }
5417 return true;
5418}
@ icSigU16Fixed16ArrayType
Definition icProfileHeader.h:567
float icFloatNumber
Definition IccDefs.h:101

References icSigS15Fixed16ArrayType, icSigU16Fixed16ArrayType, CIccTagFixedNum< T, Tsig >::m_nSize, and CIccTagFixedNum< T, Tsig >::m_Num.

◆ Interpolate()

template<class T , icTagTypeSignature Tsig>
bool CIccTagFixedNum< T, Tsig >::Interpolate ( icFloatNumber DstVector,
icFloatNumber  pos,
icUInt32Number  nVectorSize = 1,
icFloatNumber zeroVals = NULL 
) const
virtual

Name: CIccTagFixedNum::Interpolate

Purpose: Gets values from the num array tag as floating point numbers

Args: nSize - number of data entries, bZeroNew - flag to zero newly formed values

Implements CIccTagNumArray.

5435{
5436 icUInt32Number nVector = m_nSize / nVectorSize;
5437
5438 if (!nVector)
5439 return false;
5440
5441 if (zeroVals)
5442 nVector ++;
5443 else if (nVector<=1)
5444 return false;
5445
5446 if (pos<0.0)
5447 pos=0.0;
5448 if (pos>1.0)
5449 pos=1.0;
5450
5451 icFloatNumber fpos = (icFloatNumber)(nVector-1) * pos;
5452 icUInt32Number iPos = (icUInt32Number)fpos;
5453 icFloatNumber x = fpos - iPos;
5454
5455 if (iPos == nVector-1) {
5456 iPos--;
5457 x = (icFloatNumber)1.0;
5458 }
5459
5460 T *lo, *hi;
5461
5462 if (zeroVals) {
5463 if (!iPos) {
5464 lo = NULL;
5465 hi = m_Num;
5466 }
5467 else {
5468 lo = &m_Num[(iPos-1)*nVectorSize];
5469 hi = &lo[nVectorSize];
5470 }
5471 }
5472 else {
5473 lo = &m_Num[iPos*nVectorSize];
5474 hi = &lo[nVectorSize];
5475 }
5476
5478
5479 switch (Tsig) {
5481 if (!lo) {
5482 if (zeroVals) {
5483 for (i = 0; i < m_nSize; i++) {
5484 DstVector[i] = (icFloatNumber)(zeroVals[i] * (1.0f - x) + icFtoD(hi[i]) * x);
5485 }
5486 }
5487 else {
5488 for (i = 0; i < m_nSize; i++) {
5489 DstVector[i] = (icFloatNumber)(icFtoD(hi[i]) * x);
5490 }
5491 }
5492 }
5493 else {
5494 for (i=0; i<m_nSize; i++) {
5495 DstVector[i] = (icFloatNumber)(icFtoD(lo[i])*(1.0-x) + icFtoD(hi[i])*x);
5496 }
5497 }
5498 break;
5500 if (!lo) {
5501 if (zeroVals) {
5502 for (i = 0; i < m_nSize; i++) {
5503 DstVector[i] = (icFloatNumber)(zeroVals[i] * (1.0 - x) + icUFtoD(hi[i]) * x);
5504 }
5505 }
5506 else {
5507 for (i = 0; i < m_nSize; i++) {
5508 DstVector[i] = (icFloatNumber)(icUFtoD(hi[i]) * x);
5509 }
5510 }
5511 }
5512 else {
5513 for (i=0; i<m_nSize; i++) {
5514 DstVector[i] = (icFloatNumber)(icUFtoD(lo[i])*(1.0-x) + icUFtoD(hi[i])*x);
5515 }
5516 }
5517 break;
5518 default:
5519 return false;
5520 }
5521 return true;
5522}

References icSigS15Fixed16ArrayType, icSigU16Fixed16ArrayType, CIccTagFixedNum< T, Tsig >::m_nSize, and CIccTagFixedNum< T, Tsig >::m_Num.

◆ IsArrayType()

template<class T , icTagTypeSignature Tsig>
virtual bool CIccTagFixedNum< T, Tsig >::IsArrayType ( )
inlinevirtual

Reimplemented from CIccTag.

905{ return m_nSize > 1; }

References CIccTagFixedNum< T, Tsig >::m_nSize.

◆ IsMatrixArray()

template<class T , icTagTypeSignature Tsig>
virtual bool CIccTagFixedNum< T, Tsig >::IsMatrixArray ( ) const
inlinevirtual

Implements CIccTagNumArray.

930{ return false; }

◆ IsMBBType()

virtual bool CIccTag::IsMBBType ( )
inlinevirtualinherited

Reimplemented in CIccMBB.

136{ return false; } //If true then CIccTag can be cast as an CIccMBB

Referenced by CIccProfileXml::ParseTag().

+ Here is the caller graph for this function:

◆ IsNumArrayType()

template<class T , icTagTypeSignature Tsig>
virtual bool CIccTagFixedNum< T, Tsig >::IsNumArrayType ( ) const
inlinevirtual

Reimplemented from CIccTag.

921{ return true; }

◆ IsSupported()

virtual bool CIccTag::IsSupported ( )
inlinevirtualinherited

Function: IsSupported(size, pIO) - Check if tag fully supported for apply purposes. By Default inherited classes are supported. Unknown tag types are not supported.

Returns true if tag type is supported.

Reimplemented in CIccTagUnknown, CIccTagEmbeddedProfile, and CIccTagMultiProcessElement.

153{ return true; }

◆ NewCopy()

template<class T , icTagTypeSignature Tsig>
virtual CIccTag * CIccTagFixedNum< T, Tsig >::NewCopy ( ) const
inlinevirtual

Function: NewCopy(sDescription) Each derived tag will implement it's own NewCopy() function.

Parameter(s): none

Returns a new CIccTag object that is a copy of this object.

Reimplemented from CIccTag.

902{ return new CIccTagFixedNum<T, Tsig>(*this); }
Definition IccTagBasic.h:897

◆ operator=()

template<class T , icTagTypeSignature Tsig>
CIccTagFixedNum< T, Tsig > & CIccTagFixedNum< T, Tsig >::operator= ( const CIccTagFixedNum< T, Tsig > &  ITFN)

Name: CIccTagFixedNum::operator=

Purpose: Copy Operator

Args: ITFN = The CIccTagFixedNum object to be copied

5181{
5182 if (&ITFN == this)
5183 return *this;
5184
5185 m_nSize = ITFN.m_nSize;
5186
5187 if (m_Num)
5188 free(m_Num);
5189 m_Num = (T*)calloc(m_nSize, sizeof(T));
5190 memcpy(m_Num, ITFN.m_Num, m_nSize*sizeof(T));
5191
5192 return *this;
5193}

References CIccTagFixedNum< T, Tsig >::m_nSize, and CIccTagFixedNum< T, Tsig >::m_Num.

◆ operator[]()

template<class T , icTagTypeSignature Tsig>
T & CIccTagFixedNum< T, Tsig >::operator[] ( icUInt32Number  index)
inline
915{return m_Num[index];}

References CIccTagFixedNum< T, Tsig >::m_Num.

Referenced by main().

+ Here is the caller graph for this function:

◆ Read() [1/2]

template<class T , icTagTypeSignature Tsig>
bool CIccTagFixedNum< T, Tsig >::Read ( icUInt32Number  size,
CIccIO pIO 
)
virtual

Name: CIccTagFixedNum::Read

Purpose: Read in the tag contents into a data block

Args: size - # of bytes in tag, pIO - IO object to read tag from

Return: true = successful, false = failure

Reimplemented from CIccTag.

5246{
5248
5249 if (sizeof(icTagTypeSignature) +
5250 sizeof(icUInt32Number) +
5251 sizeof(T) > size)
5252 return false;
5253
5254 if (!pIO) {
5255 return false;
5256 }
5257
5258 if (!pIO->Read32(&sig))
5259 return false;
5260
5261 if (!pIO->Read32(&m_nReserved))
5262 return false;
5263
5264 icUInt32Number nSize=((size-2*sizeof(icUInt32Number)) / sizeof(T));
5265
5266 if (!SetSize(nSize))
5267 return false;
5268
5269 if (pIO->Read32(m_Num, nSize) != (icInt32Number)nSize )
5270 return false;
5271
5272 return true;
5273}
long icInt32Number
Definition icProfileHeader.h:291
icTagTypeSignature
Definition icProfileHeader.h:526
icInt32Number Read32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:143
icUInt32Number m_nReserved
Definition IccTagBasic.h:235
bool SetSize(icUInt32Number nSize, bool bZeroNew=true)
Definition IccTagBasic.cpp:5364

References CIccTag::m_nReserved, CIccTagFixedNum< T, Tsig >::m_Num, CIccIO::Read32(), and CIccTagFixedNum< T, Tsig >::SetSize().

+ Here is the call graph for this function:

◆ Read() [2/2]

virtual bool CIccTag::Read ( icUInt32Number  size,
CIccIO pIO,
CIccProfile pProfile 
)
inlinevirtualinherited

Function: Read(size, pIO) - Read tag from file. Each derived tag will implement it's own Read() function.

Parameter(s): size - number of bytes in tag including the type signature. pIO - IO object used to read in tag. The IO object should already be initialized to point to the begining of the tag.

Returns true if Read is successful.

Reimplemented in CIccTagEmbeddedProfile.

197{ return Read(size, pIO); }
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Definition IccTagBasic.h:167

References CIccTag::Read().

+ Here is the call graph for this function:

◆ ReadAll()

virtual bool CIccTag::ReadAll ( )
inlinevirtualinherited

Function: ReadAll() - Read All sub data for tag from file. Called by CIccProfile::ReadAll() to read all sub data for tag

Returns true if ReadAll is successful.

Reimplemented in CIccTagEmbeddedProfile.

175{ return true; }

◆ SetSize()

template<class T , icTagTypeSignature Tsig>
bool CIccTagFixedNum< T, Tsig >::SetSize ( icUInt32Number  nSize,
bool  bZeroNew = true 
)

Name: CIccTagFixedNum::SetSize

Purpose: Sets the size of the data array.

Args: nSize - number of data entries, bZeroNew - flag to zero newly formed values

5365{
5366 if (nSize==m_nSize)
5367 return true;
5368
5369 m_Num = (T*)icRealloc(m_Num, nSize*sizeof(T));
5370
5371 if (!m_Num) {
5372 m_nSize = 0;
5373 return false;
5374 }
5375
5376 if (bZeroNew && m_nSize < nSize) {
5377 memset(&m_Num[m_nSize], 0, (nSize-m_nSize)*sizeof(T));
5378 }
5379 m_nSize = nSize;
5380
5381 return true;
5382}
ICCPROFLIB_API void * icRealloc(void *ptr, size_t size)
Definition IccUtil.cpp:111

References CIccTagFixedNum< T, Tsig >::m_nSize, and CIccTagFixedNum< T, Tsig >::m_Num.

Referenced by CIccTagFixedNum< T, Tsig >::Read().

+ Here is the caller graph for this function:

◆ Validate()

icValidateStatus CIccTag::Validate ( std::string  sigPath,
std::string &  sReport,
const CIccProfile pProfile = NULL 
) const
virtualinherited

Function: Validate Each derived tag will implement it's own IsValid() function

Parameter(s): sig - signature of tag being validated, sDescription - A string to put tag validation report.

Name: CIccTag::Validate

Purpose: Check tag data validity. In base class we only look at the tag's reserved data value

Args: sig = signature of tag being validated, sReport = String to add report information to

Return: icValidateStatusOK if valid, or other error status.

Reimplemented in CIccTagGamutBoundaryDesc, CIccTagText, CIccTagUtf8Text, CIccTagZipUtf8Text, CIccTagUtf16Text, CIccTagTextDescription, CIccTagSignature, CIccTagNamedColor2, CIccTagXYZ, CIccTagChromaticity, CIccTagCicp, CIccTagSparseMatrixArray, CIccTagNum< T, Tsig >, CIccTagFloatNum< T, Tsig >, CIccTagMeasurement, CIccTagMultiLocalizedUnicode, CIccTagData, CIccTagDateTime, CIccTagColorantOrder, CIccTagColorantTable, CIccTagViewingConditions, CIccTagProfileSeqDesc, CIccTagResponseCurveSet16, CIccTagSpectralDataInfo, CIccTagSpectralViewingConditions, CIccTagEmbeddedHeightImage, CIccTagEmbeddedNormalImage, CIccTagStruct, CIccTagArray, CIccTagDict, CIccTagEmbeddedProfile, CIccTagCurve, CIccTagParametricCurve, CIccTagSegmentedCurve, CIccTagMultiProcessElement, and CIccTagProfileSequenceId.

165{
167
168 if (m_nReserved != 0) {
169 CIccInfo Info;
170 sReport += icMsgValidateNonCompliant;
171 sReport += Info.GetSigPathName(sigPath);
172 sReport += " - Reserved Value must be zero.\n";
173
175 }
176
177 return rv;
178}
icValidateStatus
Definition IccDefs.h:119
@ icValidateOK
Definition IccDefs.h:120
@ icValidateNonCompliant
Definition IccDefs.h:122
ICCPROFLIB_API const char * icMsgValidateNonCompliant
Definition IccUtil.cpp:91
Definition IccUtil.h:303
std::string GetSigPathName(std::string sigPath)
Definition IccUtil.cpp:1614

References CIccInfo::GetSigPathName(), icMsgValidateNonCompliant, icValidateNonCompliant, icValidateOK, and CIccTag::m_nReserved.

Referenced by CIccTagGamutBoundaryDesc::Validate(), CIccMBB::Validate(), CIccTagLutAtoB::Validate(), CIccTagLutBtoA::Validate(), CIccTagLut8::Validate(), CIccTagLut16::Validate(), CIccArrayUnknown::Validate(), CIccArrayColorantInfo::Validate(), CIccArrayNamedColor::Validate(), CIccStructUnknown::Validate(), CIccTagText::Validate(), CIccTagUtf8Text::Validate(), CIccTagZipUtf8Text::Validate(), CIccTagUtf16Text::Validate(), CIccTagTextDescription::Validate(), CIccTagSignature::Validate(), CIccTagNamedColor2::Validate(), CIccTagXYZ::Validate(), CIccTagChromaticity::Validate(), CIccTagCicp::Validate(), CIccTagNum< T, Tsig >::Validate(), CIccTagFloatNum< T, Tsig >::Validate(), CIccTagMeasurement::Validate(), CIccTagMultiLocalizedUnicode::Validate(), CIccTagData::Validate(), CIccTagDateTime::Validate(), CIccTagColorantOrder::Validate(), CIccTagColorantTable::Validate(), CIccTagViewingConditions::Validate(), CIccTagProfileSeqDesc::Validate(), CIccTagResponseCurveSet16::Validate(), CIccTagSpectralDataInfo::Validate(), CIccTagSpectralViewingConditions::Validate(), CIccTagEmbeddedHeightImage::Validate(), CIccTagEmbeddedNormalImage::Validate(), CIccTagStruct::Validate(), CIccTagArray::Validate(), CIccTagDict::Validate(), CIccTagEmbeddedProfile::Validate(), CIccTagCurve::Validate(), CIccTagParametricCurve::Validate(), and CIccTagProfileSequenceId::Validate().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ValuePos()

template<class T , icTagTypeSignature Tsig>
bool CIccTagFixedNum< T, Tsig >::ValuePos ( icFloatNumber DstPos,
icFloatNumber  val,
bool &  bNoZero 
) const
virtual

Name: CIccTagFixedNum::ValuePos

Purpose: Gets position of a value int the num array tag

Args: DstPos - position of val in array val - value to look for in array. bNoZero - flag indicating whether first entry is zero

Implements CIccTagNumArray.

5538{
5539 if(val<0.0)
5540 return false;
5541
5542 icFloatNumber nv = 0.0;
5543 icFloatNumber lv = 0.0;
5544 switch (Tsig) {
5546 lv = icFtoD(m_Num[0]);
5547 break;
5549 lv = icUFtoD(m_Num[0]);
5550 break;
5551 default:
5552 return false;
5553 }
5554 bNoZero = (lv!=0.0);
5555
5556 if (val<lv) {
5557 DstPos = val/lv - 1.0f;
5558 return true;
5559 }
5560
5562 for (i=1; i<m_nSize; i++, lv=nv) {
5563 switch (Tsig) {
5565 nv = icFtoD(m_Num[i]);
5566 break;
5568 nv = icUFtoD(m_Num[i]);
5569 break;
5570 default:
5571 return false;
5572 }
5573 if (val<=nv) {
5574 DstPos = (val-lv)/(nv-lv) + i - 1.0f;
5575 return true;
5576 }
5577 }
5578
5579 return false;
5580}

References icSigS15Fixed16ArrayType, icSigU16Fixed16ArrayType, CIccTagFixedNum< T, Tsig >::m_nSize, and CIccTagFixedNum< T, Tsig >::m_Num.

◆ Write()

template<class T , icTagTypeSignature Tsig>
bool CIccTagFixedNum< T, Tsig >::Write ( CIccIO pIO)
virtual

Name: CIccTagFixedNum::Write

Purpose: Write the tag to a file

Args: pIO - The IO object to write tag to.

Return: true = succesful, false = failure

Reimplemented from CIccTag.

5291{
5293
5294 if (!pIO)
5295 return false;
5296
5297 if (!pIO->Write32(&sig))
5298 return false;
5299
5300 if (!pIO->Write32(&m_nReserved))
5301 return false;
5302
5303 if (pIO->Write32(m_Num, m_nSize) != (icInt32Number)m_nSize)
5304 return false;
5305
5306 return true;
5307}
icInt32Number Write32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:152
virtual icTagTypeSignature GetType() const
Definition IccTagBasic.h:907

References CIccTagFixedNum< T, Tsig >::GetType(), CIccTag::m_nReserved, CIccTagFixedNum< T, Tsig >::m_nSize, CIccTagFixedNum< T, Tsig >::m_Num, and CIccIO::Write32().

+ Here is the call graph for this function:

Field Documentation

◆ m_nReserved

icUInt32Number CIccTag::m_nReserved
inherited

Referenced by CIccTag::CIccTag(), CIccTagMultiProcessElement::CIccTagMultiProcessElement(), CIccTagMultiProcessElement::CIccTagMultiProcessElement(), CIccTagMultiProcessElement::operator=(), CIccProfileXml::ParseTag(), CIccTagXmlStruct::ParseTag(), CIccMpeXmlTintArray::ParseXml(), CIccTagXmlArray::ParseXml(), CIccTagText::Read(), CIccTagUtf8Text::Read(), CIccTagZipUtf8Text::Read(), CIccTagUtf16Text::Read(), CIccTagTextDescription::Read(), CIccTagSignature::Read(), CIccTagNamedColor2::Read(), CIccTagXYZ::Read(), CIccTagChromaticity::Read(), CIccTagCicp::Read(), CIccTagSparseMatrixArray::Read(), CIccTagFixedNum< T, Tsig >::Read(), CIccTagNum< T, Tsig >::Read(), CIccTagFloatNum< T, Tsig >::Read(), CIccTagMeasurement::Read(), CIccTagMultiLocalizedUnicode::Read(), CIccTagData::Read(), CIccTagDateTime::Read(), CIccTagColorantOrder::Read(), CIccTagColorantTable::Read(), CIccTagViewingConditions::Read(), CIccTagProfileSeqDesc::Read(), CIccTagResponseCurveSet16::Read(), CIccTagSpectralDataInfo::Read(), CIccTagSpectralViewingConditions::Read(), CIccTagEmbeddedHeightImage::Read(), CIccTagEmbeddedNormalImage::Read(), CIccTagStruct::Read(), CIccTagArray::Read(), CIccTagDict::Read(), CIccTagCurve::Read(), CIccTagParametricCurve::Read(), CIccTagLutAtoB::Read(), CIccTagLut8::Read(), CIccTagLut16::Read(), CIccTagGamutBoundaryDesc::Read(), CIccTagMultiProcessElement::Read(), CIccTagProfileSequenceId::Read(), CIccTagEmbeddedProfile::Read(), CIccTag::Validate(), CIccTagText::Write(), CIccTagUtf8Text::Write(), CIccTagZipUtf8Text::Write(), CIccTagUtf16Text::Write(), CIccTagTextDescription::Write(), CIccTagSignature::Write(), CIccTagNamedColor2::Write(), CIccTagXYZ::Write(), CIccTagChromaticity::Write(), CIccTagCicp::Write(), CIccTagSparseMatrixArray::Write(), CIccTagFixedNum< T, Tsig >::Write(), CIccTagNum< T, Tsig >::Write(), CIccTagFloatNum< T, Tsig >::Write(), CIccTagMeasurement::Write(), CIccTagMultiLocalizedUnicode::Write(), CIccTagData::Write(), CIccTagDateTime::Write(), CIccTagColorantOrder::Write(), CIccTagColorantTable::Write(), CIccTagViewingConditions::Write(), CIccTagProfileSeqDesc::Write(), CIccTagResponseCurveSet16::Write(), CIccTagSpectralDataInfo::Write(), CIccTagSpectralViewingConditions::Write(), CIccTagEmbeddedHeightImage::Write(), CIccTagEmbeddedNormalImage::Write(), CIccTagStruct::Write(), CIccTagArray::Write(), CIccTagDict::Write(), CIccTagEmbeddedProfile::Write(), CIccTagCurve::Write(), CIccTagParametricCurve::Write(), CIccTagLutAtoB::Write(), CIccTagLut8::Write(), CIccTagLut16::Write(), CIccTagGamutBoundaryDesc::Write(), CIccTagMultiProcessElement::Write(), and CIccTagProfileSequenceId::Write().

◆ m_nSize

◆ m_Num


The documentation for this class was generated from the following files: