    

 ## On this page

  

 

 # ansys::CffFileIO Class Reference

 Last update: 16.07.2025 

Base class that provides common function used in File providers such as [ansys::CffFileProvider](classansys_1_1_cff_file_provider.xhtml "Class that provides functions to access data stored within a CFF file."). [More...](classansys_1_1_cff_file_i_o.xhtml#details)

`#include "<a class="el" href="_cff_file_i_o_8hpp_source.xhtml">CffInterface/CffFileIO.hpp</a>"`

Inheritance diagram for ansys::CffFileIO:

 ![](/sites/default/files/migrate-content/common_fluids_format_2024_r1/classansys_1_1_cff_file_i_o.png)



## <a id="pub-methods" name="pub-methods"></a>Public Member Functions

virtual void [setFile](classansys_1_1_cff_file_i_o.xhtml#a5e700a7a3cb529ab48fb759e339c85e7) (const std::string &amp;file, [DataClass](group__enums.xhtml#gab852cc24891eb831942fb8da764d8ddb) dataClass) virtual bool [getFileVersion](classansys_1_1_cff_file_i_o.xhtml#a548f6a285539d9d571ded617ba1a8041) ([DataClass](group__enums.xhtml#gab852cc24891eb831942fb8da764d8ddb) dataClass, std::string &amp;version) const virtual bool [getFileVersion](classansys_1_1_cff_file_i_o.xhtml#a00f3a9cd110d836abebdbafd1516cc6f) ([DataClass](group__enums.xhtml#gab852cc24891eb831942fb8da764d8ddb) dataClass, int &amp;major, int &amp;minor, int &amp;patch) const ## <a id="pro-methods" name="pro-methods"></a>Protected Member Functions

std::vector&lt; [DataClass](group__enums.xhtml#gab852cc24891eb831942fb8da764d8ddb) &gt; [getDataClasses](classansys_1_1_cff_file_i_o.xhtml#a0ee7191bc49e9b689362e2195bacc3f4) () const std::string [getFile](classansys_1_1_cff_file_i_o.xhtml#a77ef49cc6834d7f441c61e0128b5dac7) ([DataClass](group__enums.xhtml#gab852cc24891eb831942fb8da764d8ddb) source) const virtual void [setFileVersion](classansys_1_1_cff_file_i_o.xhtml#abaebab966110531b473dcdb219134822) ([DataClass](group__enums.xhtml#gab852cc24891eb831942fb8da764d8ddb) dataClass, const std::string &amp;version) <a id="details" name="details"></a>## Detailed Description

Base class that provides common function used in File providers such as [ansys::CffFileProvider](classansys_1_1_cff_file_provider.xhtml "Class that provides functions to access data stored within a CFF file.").

Functions such as [ansys::CffFileIO::setFile](classansys_1_1_cff_file_i_o.xhtml#a5e700a7a3cb529ab48fb759e339c85e7) need to be called prior to the call to [ansys::CffProvider::startReading](classansys_1_1_cff_provider.xhtml#ae75f33106aba17bdc897ac8f7678a845 "Start reading data of a specific source of data.") or ansys::CffConsumer::startWriting

A typical workflow would be:

 // Use ansys::DataClass::CFF\_RESULTS for a results file

 provider-&gt;setFile(caseFileName, [ansys::DataClass::CFF\_CASE](group__enums.xhtml#ggab852cc24891eb831942fb8da764d8ddba6c8b8209348df38321689fb67cd4b331));

[CFF\_CASE](group__enums.xhtml#ggab852cc24891eb831942fb8da764d8ddba6c8b8209348df38321689fb67cd4b331)

@ CFF_CASE

**Definition:** CffTypes.h:419





 provider-&gt;startReading([ansys::DataClass::CFF\_CASE](group__enums.xhtml#ggab852cc24891eb831942fb8da764d8ddba6c8b8209348df38321689fb67cd4b331));





## Member Function Documentation

<a id="a0ee7191bc49e9b689362e2195bacc3f4" name="a0ee7191bc49e9b689362e2195bacc3f4"></a>## [◆ ](#a0ee7191bc49e9b689362e2195bacc3f4)getDataClasses()

 std::vector&lt; [DataClass](group__enums.xhtml#gab852cc24891eb831942fb8da764d8ddb) &gt; ansys::CffFileIO::getDataClasses  ( )  const  protected 

Get all classes of data for which file names have been set.

Returns- all data classes that have had files set. 



<a id="a77ef49cc6834d7f441c61e0128b5dac7" name="a77ef49cc6834d7f441c61e0128b5dac7"></a>## [◆ ](#a77ef49cc6834d7f441c61e0128b5dac7)getFile()

 std::string ansys::CffFileIO::getFile  ( [DataClass](group__enums.xhtml#gab852cc24891eb831942fb8da764d8ddb)  *dataClass*)  const  protected 

Get the file name of the file associated ith the class of data.

Parameters \[in\]dataClass- Data class to which file is associated. Returns- Associated filename. 



<a id="a00f3a9cd110d836abebdbafd1516cc6f" name="a00f3a9cd110d836abebdbafd1516cc6f"></a>## [◆ ](#a00f3a9cd110d836abebdbafd1516cc6f)getFileVersion() \[1/2\]

 bool ansys::CffFileIO::getFileVersion  ( [DataClass](group__enums.xhtml#gab852cc24891eb831942fb8da764d8ddb)  *dataClass*,    int &amp;  *major*,    int &amp;  *minor*,    int &amp;  *patch*   )  const  virtual 

Get the version number of API the file was written with as three integers representing the major, minor and patch numbers.

Parameters \[in\]dataClass- Data class associated with the file from which to read the version. \[out\]major- Major version number. \[out\]minor- Minor version number. \[out\]patch- Patch version number. Returns- true if successful, false if invalid. 



<a id="a548f6a285539d9d571ded617ba1a8041" name="a548f6a285539d9d571ded617ba1a8041"></a>## [◆ ](#a548f6a285539d9d571ded617ba1a8041)getFileVersion() \[2/2\]

 bool ansys::CffFileIO::getFileVersion  ( [DataClass](group__enums.xhtml#gab852cc24891eb831942fb8da764d8ddb)  *dataClass*,    std::string &amp;  *version*   )  const  virtual 

Get the version number of API the file was written with as a string.

Parameters dataClass\[in\] - Data class identifying the file from which to read the version. version\[out\] - e.g. Maj.Min\[.Patch\] Returns- true if successful, false if invalid. 



<a id="a5e700a7a3cb529ab48fb759e339c85e7" name="a5e700a7a3cb529ab48fb759e339c85e7"></a>## [◆ ](#a5e700a7a3cb529ab48fb759e339c85e7)setFile()

 void ansys::CffFileIO::setFile  ( const std::string &amp;  *file*,    [DataClass](group__enums.xhtml#gab852cc24891eb831942fb8da764d8ddb)  *dataClass*   )   virtual 

Set the file name of the file associated with a class of data.

Parameters \[in\]file- Filename to associate with the data class. \[in\]dataClass- Data class to which file is associated. 



<a id="abaebab966110531b473dcdb219134822" name="abaebab966110531b473dcdb219134822"></a>## [◆ ](#abaebab966110531b473dcdb219134822)setFileVersion()

 void ansys::CffFileIO::setFileVersion  ( [DataClass](group__enums.xhtml#gab852cc24891eb831942fb8da764d8ddb)  *dataClass*,    const std::string &amp;  *fileVersion*   )   protectedvirtual 

Set the version of the API the file, of the the provided data class, is written against.

Should be called at time of reading of the file by the [CffConsumer](classansys_1_1_cff_consumer.xhtml "Class that provides functions to write data within a CFF database. The database may be stored within ...").

Parameters \[in\]dataClass- file in which data in the source is read/written. \[in\]fileVersion- version string of the form Maj.Min\[.Patch\].