Hoyt's FORK of DemoIccMAX 2.1.17.hoyt
Documentation for Hoyt's FORK of DemoIccMAX
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 const char * GetClassName () const
 Name: CIccTagFloatNum::GetClassName.
 
virtual IIccExtensionTagGetExtension ()
 
virtual bool ParseXml (xmlNode *pNode, std::string &parseStr)
 
virtual bool ToXml (std::string &xml, std::string blanks="")
 
virtual ~CIccTagXmlFloatNum ()
 
- Public Member Functions inherited from CIccTagFloatNum< T, Tsig >
 CIccTagFloatNum (const CIccTagFloatNum< T, Tsig > &ITNum)
 Name: CIccTagFloatNum::CIccTagFloatNum.
 
 CIccTagFloatNum (int nSize=1)
 Name: CIccTagFloatNum::CIccTagFloatNum.
 
virtual void Describe (std::string &sDescription, int nVerboseness)
 Name: CIccTagFloatNum::Describe.
 
virtual icUInt32Number GetNumValues () const
 
icUInt32Number GetSize () const
 Returns the size of the data array.
 
virtual icTagTypeSignature GetType () const
 Function: GetType()
 
virtual bool GetValues (icFloatNumber *DstVector, icUInt32Number nStart=0, icUInt32Number nVectorSize=1) const
 Name: CIccTagFloatNum::GetValues.
 
virtual bool Interpolate (icFloatNumber *DstVector, icFloatNumber val, icUInt32Number nVectorSize=1, icFloatNumber *zeroVals=NULL) const
 Name: CIccTagFloatNum::Interpolate.
 
virtual bool IsArrayType ()
 
virtual bool IsMatrixArray () const
 
virtual bool IsNumArrayType () const
 
virtual CIccTagNewCopy () const
 Function: NewCopy(sDescription) Each derived tag will implement it's own NewCopy() function.
 
CIccTagFloatNumoperator= (const CIccTagFloatNum< T, Tsig > &NumTag)
 Name: CIccTagFloatNum::operator=.
 
T & operator[] (icUInt32Number index)
 
virtual bool Read (icUInt32Number size, CIccIO *pIO)
 Name: CIccTagFloatNum::Read.
 
bool SetSize (icUInt32Number nSize, bool bZeroNew=true)
 Name: CIccTagFloatNum::SetSize.
 
virtual icValidateStatus Validate (std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
 Name: CIccTagFloatNum::Interpolate.
 
virtual bool ValuePos (icFloatNumber &DstPos, icFloatNumber val, bool &bNoZero) const
 Name: CIccTagFloatNum::ValuePos.
 
virtual bool Write (CIccIO *pIO)
 Name: CIccTagFloatNum::Write.
 
virtual ~CIccTagFloatNum ()
 Name: CIccTagFloatNum::~CIccTagFloatNum.
 
- Public Member Functions inherited from CIccTag
 CIccTag ()
 Name: CIccTag::CIccTag.
 
virtual void DetachIO ()
 Function: ReadAll() - Read All sub data for tag from file.
 
virtual icArraySignature GetTagArrayType () const
 
virtual icStructSignature GetTagStructType () const
 
virtual bool IsMBBType ()
 
virtual bool IsSupported ()
 Function: IsSupported(size, pIO) - Check if tag fully supported for apply purposes.
 
virtual bool Read (icUInt32Number size, CIccIO *pIO, CIccProfile *pProfile)
 Function: Read(size, pIO) - Read tag from file.
 
virtual bool ReadAll ()
 Function: ReadAll() - Read All sub data for tag from file.
 
virtual ~CIccTag ()
 Name: CIccTag::CIccTag.
 
- Public Member Functions inherited from CIccTagXml
virtual const char * GetExtClassName () const
 
virtual const char * GetExtDerivedClassName () const
 
virtual ~CIccTagXml (void)
 

Additional Inherited Members

- Static Public Member Functions inherited from CIccTag
static CIccTagCreate (icTagTypeSignature sig)
 Name: CIccTag::Create.
 
- Public Attributes inherited from CIccTag
icUInt32Number m_nReserved
 
- Protected Attributes inherited from CIccTagFloatNum< T, Tsig >
icUInt32Number m_nSize
 
T * m_Num
 

Detailed Description

template<class T, class A, icTagTypeSignature Tsig>
class CIccTagXmlFloatNum< T, A, Tsig >

Definition at line 323 of file IccTagXml.h.

Constructor & Destructor Documentation

◆ ~CIccTagXmlFloatNum()

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

Definition at line 326 of file IccTagXml.h.

326{}

Member Function Documentation

◆ 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 >.

Definition at line 1393 of file IccTagXml.cpp.

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
@ icSigFloat64ArrayType
@ icSigFloat32ArrayType

References icSigFloat16ArrayType, icSigFloat32ArrayType, and icSigFloat64ArrayType.

◆ GetExtension()

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

Reimplemented from CIccTag.

Definition at line 330 of file IccTagXml.h.

330{return this; }

◆ ParseXml()

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

Implements CIccTagXml.

Definition at line 1463 of file IccTagXml.cpp.

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}
CIccIO * IccOpenFileIO(const icChar *szFilename, const char *szAttr)
Definition IccIoXml.cpp:100
#define stricmp
xmlNode * icXmlFindNode(xmlNode *pNode, const char *szNodeName)
const char * icXmlAttrValue(xmlAttr *attr, const char *szDefault)
unsigned int icUInt32Number
Type: Class.
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)
Name: CIccTagFloatNum::SetSize.
float icFloat32Number
icUInt16Number icFloat16Number
IEEE float storage numbers.
double icFloat64Number

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

+ Here is the call 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.

Definition at line 1408 of file IccTagXml.cpp.

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
#define icXmlFloatFmt
icUInt32Number m_nSize

References icXmlDoubleFmt, and icXmlFloatFmt.


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