PandA-2024.02
Functions
fileIO.cpp File Reference

utility function used to read files. More...

#include "fileIO.hpp"
#include "Parameter.hpp"
#include "dbgPrintHelper.hpp"
#include "exceptions.hpp"
#include "file_IO_constants.hpp"
#include "string_manipulation.hpp"
#include <cstdlib>
#include <random>
#include <regex>
Include dependency graph for fileIO.cpp:

Go to the source code of this file.

Functions

fileIO_istreamRef fileIO_istream_open (const std::string &name)
 this function returns an istream compressed or not. More...
 
int PandaSystem (const ParameterConstRef Param, const std::string &system_command, bool host_exec, const std::string &output, const unsigned int type, const bool background, const size_t timeout)
 System call forcing execution with bash. More...
 
bool NaturalVersionOrder (const std::filesystem::path &_x, const std::filesystem::path &_y)
 
template<typename T >
void array_rand (T *arr, size_t size)
 
std::filesystem::path unique_path (const std::filesystem::path &model)
 

Detailed Description

utility function used to read files.

Author
Michele Fiorito miche.nosp@m.le.f.nosp@m.iorit.nosp@m.o@po.nosp@m.limi..nosp@m.it $Revision$ $Date$ Last modified by $Author$

Definition in file fileIO.cpp.

Function Documentation

◆ array_rand()

template<typename T >
void array_rand ( T *  arr,
size_t  size 
)

Definition at line 241 of file fileIO.cpp.

Referenced by unique_path().

Here is the caller graph for this function:

◆ fileIO_istream_open()

fileIO_istreamRef fileIO_istream_open ( const std::string &  name)

this function returns an istream compressed or not.

It first check for a compressed file, then search for the compressed version of the file and finally in case no compressed file is found it look for the plain text file. this function is mainly based on the gzstream wrapper and on zlib library.

Parameters
nameis the file name.
Returns
the refcount to the istream

Definition at line 55 of file fileIO.cpp.

References THROW_ERROR.

Referenced by AsnParser::Exec(), AadlParser::Exec(), Parameter::GetFileFormat(), and TestVectorParser::ParseXMLFile().

Here is the caller graph for this function:

◆ NaturalVersionOrder()

bool NaturalVersionOrder ( const std::filesystem::path &  _x,
const std::filesystem::path &  _y 
)

Definition at line 195 of file fileIO.cpp.

References distance(), and x.

Referenced by BambuParameter::CheckParameters(), EucalyptusParameter::CheckParameters(), and CopyFile().

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

◆ PandaSystem()

int PandaSystem ( const ParameterConstRef  Param,
const std::string &  system_command,
bool  host_exec = true,
const std::string &  output = "",
const unsigned int  type = 3,
const bool  background = false,
const size_t  timeout = 0 
)

System call forcing execution with bash.

Parameters
Paramis the set of input parameters
system_commandis the to be executed
host_execspecifies if the executable is expected to be in the host system or distributed within the AppImage
outputis the file where output has to be saved
typespecifies which streams have to be saved; possible values are 0 (none), 1 (stdout), 2 (stderr), 3(stdout and stderr)
backgroundspecifies if the command has to be executed in background
timeoutis the timeout for the command (in minutes)
Returns
the value returned by the shell

Definition at line 78 of file fileIO.cpp.

References test_panda::command, counter, GetCurrentPath(), GetPath(), OUTPUT_LEVEL_PEDANTIC, STR, STR_CST_file_IO_shell_output_file, STR_CST_file_IO_shell_script, THROW_ASSERT, and THROW_UNREACHABLE.

Referenced by CompilerWrapper::CompileFile(), CopyFile(), CompilerWrapper::CreateExecutable(), CTestbenchExecution::Exec(), BasicBlocksProfiling::Exec(), create_tree_manager::Exec(), ToolManager::execute_command(), FindMaxTransformations::ExecuteBambu(), NonDeterministicFlows::ExecuteTool(), XilinxTasteBackendFlow::GenerateSynthesisScripts(), CompilerWrapper::GetSystemIncludes(), main(), and CompilerWrapper::QueryCompilerConfig().

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

◆ unique_path()

std::filesystem::path unique_path ( const std::filesystem::path &  model)

Definition at line 286 of file fileIO.cpp.

References array_rand(), and ran.

Referenced by BambuParameter::CheckParameters(), CompilerWrapper::CompileFile(), CopyFile(), CompilerWrapper::FillTreeManager(), main(), and Parameter::ManageDefaultOptions().

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

Generated on Mon Feb 12 2024 13:03:35 for PandA-2024.02 by doxygen 1.8.13