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

#include <IccTagXml.h>

+ Inheritance diagram for CIccTagXmlFloatNum< T, A, Tsig >:
+ Collaboration diagram for CIccTagXmlFloatNum< T, A, Tsig >:

Public Member Functions

virtual ~CIccTagXmlFloatNum ()
 
virtual void Describe (std::string &sDescription, int nVerboseness)
 
virtual void DetachIO ()
 
virtual const char * GetClassName () const
 
virtual const char * GetExtClassName () const
 
virtual const char * GetExtDerivedClassName () 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
 
T & operator[] (icUInt32Number index)
 
virtual bool ParseXml (xmlNode *pNode, std::string &parseStr)
 
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 bool ToXml (std::string &xml, std::string blanks="")
 
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, class A, icTagTypeSignature Tsig>
class CIccTagXmlFloatNum< T, A, Tsig >

Constructor & Destructor Documentation

◆ ~CIccTagXmlFloatNum()

template<class T , class A , icTagTypeSignature Tsig>
virtual CIccTagXmlFloatNum< T, A, Tsig >::~CIccTagXmlFloatNum ( )
inlinevirtual
326{}

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 CIccTagFloatNum< T, Tsig >::Describe ( std::string &  sDescription,
int  nVerboseness 
)
virtualinherited

Name: CIccTagFloatNum::Describe

Purpose: Dump data associated with the tag to a string

Args: sDescription - string to concatenate tag dump to

Reimplemented from CIccTag.

6432{
6433 icChar buf[128] = {0};
6434
6435 if (m_nSize == 1 ) {
6436 switch (sizeof(T)) {
6437 case 4:
6438 sprintf(buf, "Value = %.8f\n", m_Num[0]);
6439 break;
6440 case 8:
6441 sprintf(buf, "Value = %.16f\n", m_Num[0]);
6442 break;
6443 default:
6444 sprintf(buf, "Value = %.f\n", m_Num[0]);
6445 break;
6446 }
6447 sDescription += buf;
6448 }
6449 else {
6450 icUInt32Number i, n;
6451 sDescription.reserve(sDescription.size() + m_nSize*79);
6452
6453 sprintf(buf, "Begin_Value_Array[%d]\n", m_nSize);
6454 sDescription += buf;
6455
6456 if (sizeof(T)!=8)
6457 n=8;
6458 else
6459 n=4;
6460
6461 for (i=0; i<m_nSize; i++) {
6462 if (i&& !(i%n))
6463 sDescription += "\n";
6464
6465 switch (sizeof(T)) {
6466 case 4:
6467 sprintf(buf, " %.8f", m_Num[i]);
6468 break;
6469 case 8:
6470 sprintf(buf, " %.16f", m_Num[i]);
6471 break;
6472 default:
6473 sprintf(buf, " %f", m_Num[i]);
6474 }
6475 sDescription += buf;
6476 }
6477 if ((i%n)!=1)
6478 sDescription += "\n";
6479 sDescription += "End_Value_Array\n";
6480 }
6481}
unsigned long icUInt32Number
Definition icProfileHeader.h:262
char icChar
Definition IccDefs.h:110
T * m_Num
Definition IccTagBasic.h:1096
icUInt32Number m_nSize
Definition IccTagBasic.h:1097

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

◆ 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 , class A , icTagTypeSignature Tsig>
const icChar * CIccTagXmlFloatNum< T, A, Tsig >::GetClassName ( ) const
virtual

Name: CIccTagFloatNum::GetClassName

Purpose: Returns the tag type class name

Reimplemented from CIccTagFloatNum< T, Tsig >.

1394{
1395 if (Tsig==icSigFloat16ArrayType)
1396 return "CIccTagXmlFloat32";
1397 else if (Tsig==icSigFloat32ArrayType)
1398 return "CIccTagXmlFloat32";
1399 else if (Tsig==icSigFloat64ArrayType)
1400 return "CIccTagXmlFloat64";
1401 else
1402 return "CIccTagXmlFloatNum<>";
1403}
@ icSigFloat16ArrayType
Definition icProfileHeader.h:540
@ icSigFloat64ArrayType
Definition icProfileHeader.h:542
@ icSigFloat32ArrayType
Definition icProfileHeader.h:541

References icSigFloat16ArrayType, icSigFloat32ArrayType, and icSigFloat64ArrayType.

◆ GetExtClassName()

virtual const char * CIccTagXml::GetExtClassName ( ) const
inlinevirtualinherited

Implements IIccExtensionTag.

79{ return "CIccTagXml"; }

Referenced by icProfDescToXml(), and icXmlParseProfDesc().

+ Here is the caller graph for this function:

◆ GetExtDerivedClassName()

virtual const char * CIccTagXml::GetExtDerivedClassName ( ) const
inlinevirtualinherited

Implements IIccExtensionTag.

Reimplemented in CIccCurveXml.

80{ return ""; }

◆ GetExtension()

template<class T , class A , icTagTypeSignature Tsig>
virtual IIccExtensionTag * CIccTagXmlFloatNum< T, A, Tsig >::GetExtension ( )
inlinevirtual

Reimplemented from CIccTag.

330{return this; }

◆ GetNumValues()

template<class T , icTagTypeSignature Tsig>
virtual icUInt32Number CIccTagFloatNum< T, Tsig >::GetNumValues ( ) const
inlinevirtualinherited

Implements CIccTagNumArray.

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

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

Referenced by CIccDefaultEncProfileConverter::ConvertFromParams().

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

◆ GetSize()

template<class T , icTagTypeSignature Tsig>
icUInt32Number CIccTagFloatNum< T, Tsig >::GetSize ( ) const
inlineinherited

Returns the size of the data array.

1079{ return m_nSize; }

References CIccTagFloatNum< T, Tsig >::m_nSize.

Referenced by CIccDefaultEncProfileConverter::ConvertFromParams(), CIccTagFloatNum< T, Tsig >::GetNumValues(), and icGetParamFloatNum().

+ 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 CIccTagFloatNum< T, Tsig >::GetType ( ) const
inlinevirtualinherited

Function: GetType()

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

Reimplemented from CIccTag.

1068{ return Tsig; }

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

+ Here is the caller graph for this function:

◆ GetValues()

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

Name: CIccTagFloatNum::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.

6529{
6530 if (nVectorSize >m_nSize)
6531 return false;
6532
6534
6535 for (i=0; i<m_nSize; i++) {
6536 DstVector[i] = (icFloatNumber)m_Num[i+nStart];
6537 }
6538 return true;
6539}
float icFloatNumber
Definition IccDefs.h:101

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

Referenced by CIccDefaultEncProfileConverter::ConvertFromParams().

+ Here is the caller graph for this function:

◆ Interpolate()

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

Name: CIccTagFloatNum::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.

6591{
6592 icUInt32Number nVector = m_nSize / nVectorSize;
6593
6594 if (!nVector)
6595 return false;
6596
6597 if (zeroVals)
6598 nVector ++;
6599 else if (nVector<=1)
6600 return false;
6601
6602 if (pos<0.0)
6603 pos=0.0;
6604 if (pos>1.0)
6605 pos=1.0;
6606
6607 icFloatNumber fpos = (icFloatNumber)(nVector-1) * pos;
6608 icUInt32Number iPos = (icUInt32Number)fpos;
6609 icFloatNumber x = fpos - iPos;
6610 icFloatNumber invx = (1.0f - x);
6611
6612 if (iPos == nVector-1) {
6613 iPos--;
6614 x = (icFloatNumber)1.0f;
6615 invx = (icFloatNumber)0.0f;
6616 }
6617
6618 T *lo, *hi;
6619
6620 if (zeroVals) {
6621 if (!iPos) {
6622 lo = NULL;
6623 hi = m_Num;
6624 }
6625 else {
6626 lo = &m_Num[(iPos-1)*nVectorSize];
6627 hi = &lo[nVectorSize];
6628 }
6629 }
6630 else {
6631 lo = &m_Num[iPos*nVectorSize];
6632 hi = &lo[nVectorSize];
6633 }
6634
6636
6637 if (!lo) {
6638 if (zeroVals) {
6639 for (i = 0; i < nVectorSize; i++) {
6640 DstVector[i] = (icFloatNumber)(zeroVals[i] * invx + hi[i] * x);
6641 }
6642 }
6643 else {
6644 for (i = 0; i < nVectorSize; i++) {
6645 DstVector[i] = (icFloatNumber)(hi[i] * x);
6646 }
6647 }
6648 }
6649 else {
6650 for (i=0; i<nVectorSize; i++) {
6651 DstVector[i] = (icFloatNumber)(lo[i]*invx + hi[i]*x);
6652 }
6653 }
6654 return true;
6655}

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

◆ IsArrayType()

template<class T , icTagTypeSignature Tsig>
virtual bool CIccTagFloatNum< T, Tsig >::IsArrayType ( )
inlinevirtualinherited

Reimplemented from CIccTag.

1066{ return m_nSize > 1; }

References CIccTagFloatNum< T, Tsig >::m_nSize.

◆ IsMatrixArray()

template<class T , icTagTypeSignature Tsig>
virtual bool CIccTagFloatNum< T, Tsig >::IsMatrixArray ( ) const
inlinevirtualinherited

Implements CIccTagNumArray.

1091{ 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 CIccTagFloatNum< T, Tsig >::IsNumArrayType ( ) const
inlinevirtualinherited

Reimplemented from CIccTag.

1082{ 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 * CIccTagFloatNum< T, Tsig >::NewCopy ( ) const
inlinevirtualinherited

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.

1063{ return new CIccTagFloatNum<T, Tsig>(*this); }
Definition IccTagBasic.h:1058

◆ operator[]()

template<class T , icTagTypeSignature Tsig>
T & CIccTagFloatNum< T, Tsig >::operator[] ( icUInt32Number  index)
inlineinherited
1076{return m_Num[index];}

References CIccTagFloatNum< T, Tsig >::m_Num.

Referenced by CIccDefaultEncProfileConverter::ConvertFromParams(), and icGetParamFloatNum().

+ Here is the caller graph for this function:

◆ ParseXml()

template<class T , class A , icTagTypeSignature Tsig>
bool CIccTagXmlFloatNum< T, A, Tsig >::ParseXml ( xmlNode *  pNode,
std::string &  parseStr 
)
virtual

Implements CIccTagXml.

1464{
1465 pNode = icXmlFindNode(pNode, "Data");
1466
1467 const char *filename = icXmlAttrValue(pNode, "Filename", "");
1468 if (!filename[0]) {
1469 filename = icXmlAttrValue(pNode, "File", "");
1470 }
1471
1472 A a;
1473
1474 if (filename[0]) {
1475 CIccIO *file = IccOpenFileIO(filename, "rb");
1476 if (!file){
1477 parseStr += "Error! - File '";
1478 parseStr += filename;
1479 parseStr +="' not found.\n";
1480 delete file;
1481 return false;
1482 }
1483
1484 icUInt32Number len = file->GetLength();
1485
1486 if (!stricmp(icXmlAttrValue(pNode, "Format", "text"), "text")) {
1487 char *fbuf = (char*)malloc(len+1);
1488 fbuf[len]=0;
1489 if (!fbuf) {
1490 parseStr += "Memory error!\n";
1491 delete file;
1492 return false;
1493 }
1494
1495 if (file->Read8(fbuf, len)!=len) {
1496 parseStr += "Read error of (";
1497 parseStr += filename;
1498 parseStr += ")!\n";
1499 free(fbuf);
1500 delete file;
1501 return false;
1502 }
1503 delete file;
1504
1505 if (!a.ParseTextArray(fbuf) || !a.GetSize()) {
1506 parseStr += "Parse error of (";
1507 parseStr += filename;
1508 parseStr += ")!\n";
1509 free(fbuf);
1510 return false;
1511 }
1512 free(fbuf);
1513 }
1514 else if (Tsig==icSigFloat16ArrayType && sizeof(T)==sizeof(icFloat16Number)) {
1515 icUInt32Number n = len/sizeof(icFloat16Number);
1516 this->SetSize(n);
1517 if (file->Read16(&this->m_Num[0], n)!=n) {
1518 delete file;
1519 return false;
1520 }
1521 delete file;
1522 return true;
1523 }
1524 else if (Tsig==icSigFloat16ArrayType && sizeof(T)==sizeof(icFloat32Number)) {
1525 icUInt32Number n = len/sizeof(icFloat32Number);
1526 this->SetSize(n);
1527 if (file->ReadFloat16Float(&this->m_Num[0], n)!=n) {
1528 delete file;
1529 return false;
1530 }
1531 delete file;
1532 return true;
1533 }
1534 else if (Tsig==icSigFloat32ArrayType && sizeof(T)==sizeof(icFloat32Number)) {
1535 icUInt32Number n = len/sizeof(icFloat32Number);
1536 this->SetSize(n);
1537 if (file->ReadFloat32Float(&this->m_Num[0], n)!=n) {
1538 delete file;
1539 return false;
1540 }
1541 delete file;
1542 return true;
1543 }
1544 else if (Tsig==icSigFloat64ArrayType && sizeof(T)==sizeof(icFloat64Number)) {
1545 icUInt32Number n = len/sizeof(icFloat64Number);
1546 this->SetSize(n);
1547 if (file->Read64(&this->m_Num[0], n)!=n) {
1548 delete file;
1549 return false;
1550 }
1551 delete file;
1552 return true;
1553
1554 }
1555 else {
1556 delete file;
1557 parseStr += "Unsupported file parsing type!\n";
1558 return false;
1559 }
1560 }
1561 else {
1562 pNode = pNode->children;
1563
1564 if (!a.ParseArray(pNode) || !a.GetSize()) {
1565 return false;
1566 }
1567 }
1568
1569 icUInt32Number i, n = a.GetSize();
1570 T *buf = a.GetBuf();
1571
1572 this->SetSize(n);
1573
1574 for (i=0; i<n; i++) {
1575 this->m_Num[i] = buf[i];
1576 }
1577 return true;
1578}
float icFloat32Number
Definition icProfileHeader.h:313
icUInt16Number icFloat16Number
Definition icProfileHeader.h:310
double icFloat64Number
Definition icProfileHeader.h:314
#define stricmp
Definition IccProfLibConf.h:149
xmlNode * icXmlFindNode(xmlNode *pNode, const char *szNodeName)
Definition IccUtilXml.cpp:687
const char * icXmlAttrValue(xmlAttr *attr, const char *szDefault="")
Definition IccUtilXml.cpp:572
CIccIO * IccOpenFileIO(const icChar *szFilename, const char *szAttr)
Definition IccIoXml.cpp:100
Definition IccIO.h:97
icInt32Number ReadFloat16Float(void *pBufFloat, icInt32Number nNum=1)
Definition IccIO.cpp:269
icInt32Number ReadFloat32Float(void *pBufFloat, icInt32Number nNum=1)
Definition IccIO.cpp:302
virtual icInt32Number GetLength()
Definition IccIO.h:130
virtual icInt32Number Read8(void *pBuf8, icInt32Number nNum=1)
Definition IccIO.h:104
icInt32Number Read16(void *pBuf16, icInt32Number nNum=1)
Definition IccIO.cpp:114
icInt32Number Read64(void *pBuf64, icInt32Number nNum=1)
Definition IccIO.cpp:173
bool SetSize(icUInt32Number nSize, bool bZeroNew=true)
Definition IccTagBasic.cpp:6496

References CIccIO::GetLength(), IccOpenFileIO(), icSigFloat16ArrayType, icSigFloat32ArrayType, icSigFloat64ArrayType, icXmlAttrValue(), icXmlFindNode(), CIccIO::Read16(), CIccIO::Read64(), CIccIO::Read8(), CIccIO::ReadFloat16Float(), and CIccIO::ReadFloat32Float().

+ Here is the call graph for this function:

◆ Read() [1/2]

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

Name: CIccTagFloatNum::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.

6314{
6316
6317 if (Tsig==icSigFloat16ArrayType) {
6318 if (sizeof(icTagTypeSignature) +
6319 sizeof(icUInt32Number) +
6320 sizeof(icFloat16Number) > size)
6321 return false;
6322 }
6323 else {
6324 if (sizeof(icTagTypeSignature) +
6325 sizeof(icUInt32Number) +
6326 sizeof(T) > size)
6327 return false;
6328 }
6329
6330 if (!pIO) {
6331 return false;
6332 }
6333
6334 if (!pIO->Read32(&sig))
6335 return false;
6336
6337 if (!pIO->Read32(&m_nReserved))
6338 return false;
6339
6340 if (Tsig==icSigFloat16ArrayType) {
6341 icUInt32Number nSize=((size-2*sizeof(icUInt32Number)) / sizeof(icFloat16Number));
6342
6343 if (!SetSize(nSize))
6344 return false;
6345
6346 if (pIO->ReadFloat16Float(&m_Num[0], nSize) != (icInt32Number)nSize)
6347 return false;
6348 }
6349 else if (Tsig==icSigFloat32ArrayType) {
6350 icUInt32Number nSize=((size-2*sizeof(icUInt32Number)) / sizeof(icFloat32Number));
6351
6352 if (!SetSize(nSize))
6353 return false;
6354
6355 if (pIO->Read32(m_Num, nSize) != (icInt32Number)nSize )
6356 return false;
6357 }
6358 else if (Tsig==icSigFloat64ArrayType) {
6359 icUInt32Number nSize=((size-2*sizeof(icUInt32Number)) / sizeof(icFloat64Number));
6360
6361 if (!SetSize(nSize))
6362 return false;
6363
6364 if (pIO->Read64(m_Num, nSize) != (icInt32Number)nSize )
6365 return false;
6366 }
6367 else
6368 return false;
6369
6370 return true;
6371}
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

References icSigFloat16ArrayType, icSigFloat32ArrayType, icSigFloat64ArrayType, CIccTag::m_nReserved, CIccTagFloatNum< T, Tsig >::m_Num, CIccIO::Read32(), CIccIO::Read64(), CIccIO::ReadFloat16Float(), and CIccTagFloatNum< 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 CIccTagFloatNum< T, Tsig >::SetSize ( icUInt32Number  nSize,
bool  bZeroNew = true 
)
inherited

Name: CIccTagFloatNum::SetSize

Purpose: Sets the size of the data array.

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

6497{
6498 if (nSize==m_nSize)
6499 return true;
6500
6501 m_Num = (T*)icRealloc(m_Num, nSize*sizeof(T));
6502
6503 if (!m_Num) {
6504 m_nSize = 0;
6505 return false;
6506 }
6507
6508 if (bZeroNew && m_nSize < nSize) {
6509 memset(&m_Num[m_nSize], 0, (nSize-m_nSize)*sizeof(T));
6510 }
6511 m_nSize = nSize;
6512
6513 return true;
6514}
ICCPROFLIB_API void * icRealloc(void *ptr, size_t size)
Definition IccUtil.cpp:111

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

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

+ Here is the caller graph for this function:

◆ ToXml()

template<class T , class A , icTagTypeSignature Tsig>
bool CIccTagXmlFloatNum< T, A, Tsig >::ToXml ( std::string &  xml,
std::string  blanks = "" 
)
virtual

Implements CIccTagXml.

1409{
1410 char buf[512];
1411
1412 if (this->m_nSize==1) {
1413#ifdef _WIN32
1414 if (sizeof(T)==sizeof(icFloat32Number))
1415 sprintf(buf, "<Data>" icXmlFloatFmt "</Data>\n", this->m_Num[0]);
1416 else if (sizeof(T)==sizeof(icFloat64Number))
1417 sprintf(buf, "<Data>" icXmlDoubleFmt "</Data>\n", this->m_Num[0]);
1418 else
1419#endif
1420 sprintf(buf, "<Data>" icXmlFloatFmt "</Data>", this->m_Num[0]);
1421 xml += blanks;
1422 xml += buf;
1423 }
1424 else {
1425 int i;
1426 int n = 8;
1427 xml += blanks + "<Data>\n";
1428 for (i=0; i<(int)this->m_nSize; i++) {
1429 if (!(i%n)) {
1430 if (i)
1431 xml += "\n";
1432 xml += blanks + blanks;
1433 }
1434 else {
1435 xml += " ";
1436 }
1437#ifdef _WIN32
1438 if (sizeof(T)==sizeof(icFloat32Number))
1439 sprintf(buf, icXmlFloatFmt, this->m_Num[i]);
1440
1441 else if (sizeof(T)==sizeof(icFloat32Number))
1442 sprintf(buf, icXmlDoubleFmt, this->m_Num[i]);
1443 else
1444#endif
1445 sprintf(buf, icXmlFloatFmt, this->m_Num[i]);
1446 xml += buf;
1447 }
1448
1449 if ((i%n)!=1) {
1450 xml += "\n";
1451 xml += blanks + "</Data>\n";
1452 }
1453 else {
1454 xml += " </Data>\n";
1455 }
1456 }
1457 return true;
1458}
#define icXmlDoubleFmt
Definition IccXmlConfig.h:76
#define icXmlFloatFmt
Definition IccXmlConfig.h:75

◆ Validate()

template<class T , icTagTypeSignature Tsig>
icValidateStatus CIccTagFloatNum< T, Tsig >::Validate ( std::string  sigPath,
std::string &  sReport,
const CIccProfile pProfile = NULL 
) const
virtualinherited

Name: CIccTagFloatNum::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

Reimplemented from CIccTag.

6555{
6557 //Check # of channels
6559 pProfile &&
6560 m_nSize != icGetMaterialColorSpaceSamples(pProfile->m_Header.mcs)) {
6561 CIccInfo Info;
6562 std::string sSigPathName = Info.GetSigPathName(sigPath);
6563
6564 sReport += icMsgValidateCriticalError;
6565 sReport += sSigPathName;
6566 sReport += " - Number of material default values does not match MCS in header.\n";
6568 }
6569
6570 rv = icMaxStatus(rv, CIccTagNumArray::Validate(sigPath, sReport, pProfile));
6571
6572 return rv;
6573}
@ icSigMaterialDefaultValuesTag
Definition icProfileHeader.h:426
icValidateStatus
Definition IccDefs.h:119
@ icValidateOK
Definition IccDefs.h:120
@ icValidateCriticalError
Definition IccDefs.h:123
ICCPROFLIB_API icSignature icGetFirstSigPathSig(std::string sigPath)
Definition IccUtil.cpp:1201
ICCPROFLIB_API const char * icMsgValidateCriticalError
Definition IccUtil.cpp:92
ICCPROFLIB_API icValidateStatus icMaxStatus(icValidateStatus s1, icValidateStatus s2)
Definition IccUtil.cpp:244
ICCPROFLIB_API icUInt32Number icGetMaterialColorSpaceSamples(icMaterialColorSignature sig)
Definition IccUtil.cpp:1391
Definition IccUtil.h:303
std::string GetSigPathName(std::string sigPath)
Definition IccUtil.cpp:1614
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
Definition IccTagBasic.cpp:164

References CIccInfo::GetSigPathName(), icGetFirstSigPathSig(), icGetMaterialColorSpaceSamples(), icMaxStatus(), icMsgValidateCriticalError, icSigMaterialDefaultValuesTag, icValidateCriticalError, icValidateOK, CIccTagFloatNum< T, Tsig >::m_nSize, icHeader::mcs, and CIccTag::Validate().

+ Here is the call graph for this function:

◆ ValuePos()

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

Name: CIccTagFloatNum::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.

6672{
6673 if(val<0.0)
6674 return false;
6675
6676 icFloatNumber nv = 0.0;
6677 icFloatNumber lv = 0.0;
6678
6679 lv = (icFloatNumber)m_Num[0];
6680
6681 bNoZero = (lv!=0.0);
6682
6683 if (val<lv) {
6684 DstPos = val/lv - 1.0f;
6685 return true;
6686 }
6687
6689 for (i=1; i<m_nSize; i++, lv=nv) {
6690 nv = (icFloatNumber)m_Num[i];
6691
6692 if (val<=nv) {
6693 DstPos = (val-lv)/(nv-lv) + i - 1.0f;
6694 return true;
6695 }
6696 }
6697
6698 return false;
6699}

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

◆ Write()

template<class T , icTagTypeSignature Tsig>
bool CIccTagFloatNum< T, Tsig >::Write ( CIccIO pIO)
virtualinherited

Name: CIccTagFloatNum::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.

6389{
6391
6392 if (!pIO)
6393 return false;
6394
6395 if (!pIO->Write32(&sig))
6396 return false;
6397
6398 if (!pIO->Write32(&m_nReserved))
6399 return false;
6400
6401 if (Tsig==icSigFloat16ArrayType) {
6403 return false;
6404 }
6405 else if (Tsig == icSigFloat32ArrayType) {
6406 if (pIO->Write32(m_Num, m_nSize) != (icInt32Number)m_nSize)
6407 return false;
6408 }
6409 else if (Tsig == icSigFloat64ArrayType) {
6410 if (pIO->Write64(m_Num, m_nSize) != (icInt32Number)m_nSize)
6411 return false;
6412 }
6413 else
6414 return false;
6415
6416 return true;
6417}
icInt32Number WriteFloat16Float(void *pBuf16, icInt32Number nNum=1)
Definition IccIO.cpp:285
icInt32Number Write32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:152
icInt32Number Write64(void *pBuf64, icInt32Number nNum=1)
Definition IccIO.cpp:182
virtual icTagTypeSignature GetType() const
Definition IccTagBasic.h:1068

References CIccTagFloatNum< T, Tsig >::GetType(), icSigFloat16ArrayType, icSigFloat32ArrayType, icSigFloat64ArrayType, CIccTag::m_nReserved, CIccTagFloatNum< T, Tsig >::m_nSize, CIccTagFloatNum< T, Tsig >::m_Num, CIccIO::Write32(), CIccIO::Write64(), and CIccIO::WriteFloat16Float().

+ 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: