MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenColorIO / write

Method write

src/OpenColorIO/fileformats/FileFormatCTF.cpp:1555–1592  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1553}
1554
1555void LocalFileFormat::write(const ConstConfigRcPtr & config,
1556 const ConstContextRcPtr & context,
1557 const GroupTransform & group,
1558 const std::string & formatName,
1559 std::ostream & ostream) const
1560{
1561 bool isCLF = false;
1562 if (Platform::Strcasecmp(formatName.c_str(), FILEFORMAT_CLF) == 0)
1563 {
1564 isCLF = true;
1565 }
1566 else if (Platform::Strcasecmp(formatName.c_str(), FILEFORMAT_CTF) != 0)
1567 {
1568 // Neither a clf nor a ctf.
1569 std::ostringstream os;
1570 os << "Error: CLF/CTF writer does not also write format " << formatName << ".";
1571 throw Exception(os.str().c_str());
1572 }
1573
1574 OpRcPtrVec ops;
1575 BuildGroupOps(ops, *config, context, group, TRANSFORM_DIR_FORWARD);
1576
1577 ops.finalize();
1578
1579 // Call optimize to remove no-op types (e.g., allocation, file no-ops) since they do not have
1580 // a CTF representation.
1581 ops.optimize(OPTIMIZATION_NONE);
1582
1583 const FormatMetadataImpl & metadata = group.getFormatMetadata();
1584 CTFReaderTransformPtr transform = std::make_shared<CTFReaderTransform>(ops, metadata);
1585
1586 // Write XML Header.
1587 ostream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
1588 XmlFormatter fmt(ostream);
1589
1590 TransformWriter writer(fmt, transform, isCLF);
1591 writer.write();
1592}
1593
1594} // end of anonymous namespace.
1595

Callers

nothing calls this directly

Calls 4

StrcasecmpFunction · 0.85
BuildGroupOpsFunction · 0.85
optimizeMethod · 0.80
finalizeMethod · 0.45

Tested by

no test coverage detected