OpenASIP
2.0
|
#include <OperationBuilder.hh>
Public Member Functions | |
std::string | xmlFilePath (const std::string &xmlFile) |
std::string | behaviorFile (const std::string &baseName, std::string &path) |
bool | buildObject (const std::string &baseName, const std::string &behaviorFile, const std::string &path, std::vector< std::string > &output) |
bool | installDataFile (const std::string &path, const std::string &xmlFile, const std::string &destination) |
bool | verifyXML (const std::string file) |
Static Public Member Functions | |
static OperationBuilder & | instance () |
Private Member Functions | |
OperationBuilder () | |
virtual | ~OperationBuilder () |
std::string | makeIncludeString (const std::vector< std::string > &paths) |
Static Private Attributes | |
static OperationBuilder * | instance_ = NULL |
Static unique instance. More... | |
Class that handles building the operation behavior.
Definition at line 42 of file OperationBuilder.hh.
|
private |
|
privatevirtual |
string OperationBuilder::behaviorFile | ( | const std::string & | baseName, |
std::string & | path | ||
) |
Searches for the path of behavior file.
If path for the file is not given, it is searched from the current working directory. If file is not found, an empty string is returned.
baseName | The name of behavior file. |
path | The path where the file is located. |
Definition at line 115 of file OperationBuilder.cc.
References FileSystem::currentWorkingDir(), FileSystem::DIRECTORY_SEPARATOR, and FileSystem::fileExists().
Referenced by buildObject(), and main().
bool OperationBuilder::buildObject | ( | const std::string & | baseName, |
const std::string & | behaviorFile, | ||
const std::string & | path, | ||
std::vector< std::string > & | output | ||
) |
Builds dynamic module and copies it to the same location where XML property file is located.
baseName | The base name for the module. |
behaviorFile | The full path for behavior file. |
path | Path where built module is put. |
output | Output of compilation. |
Definition at line 141 of file OperationBuilder.cc.
References behaviorFile(), FileSystem::currentWorkingDir(), Environment::developerMode(), FileSystem::DIRECTORY_SEPARATOR, DS, Environment::environmentVariable(), Environment::includeDirPaths(), Application::installationDir(), Application::isInstalled(), Application::logStream(), makeIncludeString(), Environment::opsetIncludeDir(), Application::runShellCommandAndGetOutput(), Application::VERBOSE_LEVEL_DEFAULT, and Application::verboseLevel().
Referenced by OperationIndex::addPath(), OSEdBuildCmd::Do(), OSEdBuildAllCmd::Do(), and main().
bool OperationBuilder::installDataFile | ( | const std::string & | sourcePath, |
const std::string & | xmlFile, | ||
const std::string & | destinationPath | ||
) |
Installs the data file containing operation property declarations.
Creates the destination path if it does not exist. Overwrites the existing file, if it is already installed in given destination.
Installation can fail for several reasons: no rights to create destination directory, no rights to overwrite a previously installed version of the data file, no rights to read the source data file.
path | Source path of data file. |
xmlFile | Name of the data file. |
destination | Destination path where the data file is to be installed. |
Definition at line 224 of file OperationBuilder.cc.
References assert, FileSystem::copy(), FileSystem::createDirectory(), FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), FileSystem::fileIsReadable(), and FileSystem::removeFileOrDirectory().
|
static |
Returns an instance of OperationBuilder.
Definition at line 71 of file OperationBuilder.cc.
References instance_, and OperationBuilder().
Referenced by OperationIndex::addPath(), OSEdBuildCmd::Do(), OSEdBuildAllCmd::Do(), and main().
|
private |
Makes an include string for compiler (-I<path1> -I<path2> etc) from the paths in the vector
Vector | containing the include paths |
Definition at line 284 of file OperationBuilder.cc.
Referenced by buildObject().
bool OperationBuilder::verifyXML | ( | const std::string | file | ) |
Verifies the correctness of XML file.
file | Absolute path of XML file. |
Definition at line 263 of file OperationBuilder.cc.
References Exception::errorMessage(), OperationSerializer::readState(), and OperationSerializer::setSourceFile().
Referenced by main().
string OperationBuilder::xmlFilePath | ( | const std::string & | xmlFile | ) |
Finds the path for XML file.
File is searched only from certain locations. If file is not found, returns an empty string.
xmlFile | The name of the XML file. |
Definition at line 88 of file OperationBuilder.cc.
References FileSystem::currentWorkingDir(), FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), and Environment::osalPaths().
|
staticprivate |
Static unique instance.
Definition at line 70 of file OperationBuilder.hh.
Referenced by instance().