OpenASIP
2.0
|
#include <ProcessorConfigurationFile.hh>
Public Member Functions | |
ProcessorConfigurationFile (std::istream &inputStream) | |
virtual | ~ProcessorConfigurationFile () |
void | setPCFDirectory (const std::string &path) |
std::string | architectureName () |
unsigned int | architectureSize () |
unsigned int | architectureModified () |
std::string | implementationName () |
unsigned int | implementationSize () |
unsigned int | implementationModified () |
std::string | encodingMapName () |
unsigned int | encodingMapSize () |
unsigned int | encodingMapModified () |
int | errorCount () |
std::string | errorString (int index) |
bool | errors () |
Public Member Functions inherited from ConfigurationFile | |
ConfigurationFile (bool doChecking=false) | |
virtual | ~ConfigurationFile () |
void | load (std::istream &inputStream) |
bool | hasKey (const std::string &key) |
std::string | value (const std::string &key, int index=0) |
int | itemCount (const std::string &key) |
int | intValue (const std::string &key, int index=0) |
float | floatValue (const std::string &key, int index=0) |
std::string | stringValue (const std::string &key, int index=0) |
bool | booleanValue (const std::string &key, int index=0) |
unsigned int | timeStampValue (const std::string &key) |
Protected Member Functions | |
virtual bool | handleError (int lineNumber, ConfigurationFile::ConfigurationFileError error, const std::string &line) |
Protected Member Functions inherited from ConfigurationFile | |
void | addSupportedKey (const std::string &key, ConfigurationValueType type, bool caseSensitive=false) |
Private Member Functions | |
std::string | realPath (const std::string &pathInPCF) const |
Private Attributes | |
std::vector< std::string > | errors_ |
std::string | pcfDir_ |
Static Private Attributes | |
static const std::string | ARCHITECTURE = "Architecture" |
static const std::string | ARCHITECTURE_SIZE = "ArchitectureSize" |
static const std::string | ARCHITECTURE_MODIFIED |
static const std::string | ENCODING_MAP = "EncodingMap" |
static const std::string | ENCODING_MAP_SIZE = "EncodingSize" |
static const std::string | ENCODING_MAP_MODIFIED |
static const std::string | IMPLEMENTATION = "Implementation" |
static const std::string | IMPLEMENTATION_SIZE |
static const std::string | IMPLEMENTATION_MODIFIED |
Additional Inherited Members | |
Protected Types inherited from ConfigurationFile | |
enum | ConfigurationValueType { VT_INTEGER, VT_FLOAT, VT_STRING, VT_BOOLEAN, VT_READABLE_TIME, VT_UNIX_TIMESTAMP } |
enum | ConfigurationFileError { FE_SYNTAX, FE_ILLEGAL_TYPE, FE_UNKNOWN_KEY, FE_MISSING_VALUE } |
Has knowledge of the format of the processor configuration file.
It knows its supported keys and provides shortcut methods for querying the values of the keys.
Definition at line 46 of file ProcessorConfigurationFile.hh.
|
explicit |
Constructor.
inputStream | Stream where configuration file is read from. |
Definition at line 58 of file ProcessorConfigurationFile.cc.
References ConfigurationFile::addSupportedKey(), ARCHITECTURE, ARCHITECTURE_MODIFIED, ARCHITECTURE_SIZE, ENCODING_MAP, ENCODING_MAP_MODIFIED, ENCODING_MAP_SIZE, IMPLEMENTATION, IMPLEMENTATION_MODIFIED, IMPLEMENTATION_SIZE, ConfigurationFile::load(), ConfigurationFile::VT_INTEGER, ConfigurationFile::VT_READABLE_TIME, and ConfigurationFile::VT_STRING.
|
virtual |
unsigned int ProcessorConfigurationFile::architectureModified | ( | ) |
Returns the timestamp of the architecture modified time.
KeyNotFound | If architecture modified time is not found. |
Definition at line 129 of file ProcessorConfigurationFile.cc.
References ARCHITECTURE_MODIFIED, and ConfigurationFile::timeStampValue().
string ProcessorConfigurationFile::architectureName | ( | ) |
Returns the name of the architecture.
KeyNotFound | If architecture is not found. |
Definition at line 107 of file ProcessorConfigurationFile.cc.
References ARCHITECTURE, realPath(), and ConfigurationFile::value().
Referenced by ProGe::ProGeUI::loadProcessorConfiguration(), SimulatorFrontend::loadProcessorConfiguration(), and MDFDocument::openCFG().
unsigned int ProcessorConfigurationFile::architectureSize | ( | ) |
Returns the size of the architecture.
KeyNotFound | If architecture size is not found. |
Definition at line 118 of file ProcessorConfigurationFile.cc.
References ARCHITECTURE_SIZE, and ConfigurationFile::intValue().
unsigned int ProcessorConfigurationFile::encodingMapModified | ( | ) |
Returns the timestamp of encoding map modified time.
KeyNotFound | If timestamp is not found. |
Definition at line 195 of file ProcessorConfigurationFile.cc.
References ENCODING_MAP_MODIFIED, and ConfigurationFile::timeStampValue().
string ProcessorConfigurationFile::encodingMapName | ( | ) |
Returns the name of the encoding map.
KeyNotFound | If encoding map is not found. |
Definition at line 173 of file ProcessorConfigurationFile.cc.
References ENCODING_MAP, realPath(), and ConfigurationFile::value().
Referenced by ProGe::ProGeUI::loadProcessorConfiguration().
unsigned int ProcessorConfigurationFile::encodingMapSize | ( | ) |
Returns the size of the encoding map.
KeyNotFound | If encoding map size is not found. |
Definition at line 184 of file ProcessorConfigurationFile.cc.
References ENCODING_MAP_SIZE, and ConfigurationFile::intValue().
int ProcessorConfigurationFile::errorCount | ( | ) |
Returns the number of errors.
Definition at line 205 of file ProcessorConfigurationFile.cc.
References errors_.
Referenced by MDFDocument::openCFG().
bool ProcessorConfigurationFile::errors | ( | ) |
Returns true if errors were found.
Definition at line 231 of file ProcessorConfigurationFile.cc.
References errors_.
Referenced by MDFDocument::openCFG().
string ProcessorConfigurationFile::errorString | ( | int | index | ) |
Returns the error string with a given index.
If such error string is not found, returns empty string.
Definition at line 217 of file ProcessorConfigurationFile.cc.
References errors_.
Referenced by handleError(), and MDFDocument::openCFG().
|
protectedvirtual |
Handles the errors.
Error string are added in internal data structure.
lineNumber | The line number. |
error | The type of the error. |
line | The line in which error occurred. |
Reimplemented from ConfigurationFile.
Definition at line 246 of file ProcessorConfigurationFile.cc.
References errors_, errorString(), ConfigurationFile::FE_ILLEGAL_TYPE, ConfigurationFile::FE_MISSING_VALUE, ConfigurationFile::FE_SYNTAX, ConfigurationFile::FE_UNKNOWN_KEY, and Conversion::toString().
unsigned int ProcessorConfigurationFile::implementationModified | ( | ) |
Returns the implementation modified timestamp.
KeyNotFound | If implementation modified timestamp is not found. |
Definition at line 162 of file ProcessorConfigurationFile.cc.
References IMPLEMENTATION_MODIFIED, and ConfigurationFile::timeStampValue().
string ProcessorConfigurationFile::implementationName | ( | ) |
Returns the name of the implementation.
KeyNotFound | If implementation is not found. |
Definition at line 140 of file ProcessorConfigurationFile.cc.
References IMPLEMENTATION, realPath(), and ConfigurationFile::value().
Referenced by ProGe::ProGeUI::loadProcessorConfiguration().
unsigned int ProcessorConfigurationFile::implementationSize | ( | ) |
Returns the size of the implementation.
KeyNotFound | If implementation size is not found. |
Definition at line 151 of file ProcessorConfigurationFile.cc.
References IMPLEMENTATION_SIZE, and ConfigurationFile::intValue().
|
private |
Creates real path to the file referred to in PCF.
The path is constructed assuming the PCF is in the directory set with setPCFDirectory method.
pathInPCF | The path that reads in the PCF. |
Definition at line 284 of file ProcessorConfigurationFile.cc.
References FileSystem::DIRECTORY_SEPARATOR, FileSystem::isAbsolutePath(), and pcfDir_.
Referenced by architectureName(), encodingMapName(), and implementationName().
void ProcessorConfigurationFile::setPCFDirectory | ( | const std::string & | directory | ) |
Sets the directory of PCF file itself.
Path of the ADF, IDF and BEM files are constructed relative to the PCF directory if a relative path is given in PCF.
directory | The directory of the PCF file. |
Definition at line 95 of file ProcessorConfigurationFile.cc.
References pcfDir_.
Referenced by ProGe::ProGeUI::loadProcessorConfiguration(), SimulatorFrontend::loadProcessorConfiguration(), and MDFDocument::openCFG().
|
staticprivate |
Definition at line 80 of file ProcessorConfigurationFile.hh.
Referenced by architectureName(), and ProcessorConfigurationFile().
|
staticprivate |
Definition at line 82 of file ProcessorConfigurationFile.hh.
Referenced by architectureModified(), and ProcessorConfigurationFile().
|
staticprivate |
Definition at line 81 of file ProcessorConfigurationFile.hh.
Referenced by architectureSize(), and ProcessorConfigurationFile().
|
staticprivate |
Definition at line 84 of file ProcessorConfigurationFile.hh.
Referenced by encodingMapName(), and ProcessorConfigurationFile().
|
staticprivate |
Definition at line 86 of file ProcessorConfigurationFile.hh.
Referenced by encodingMapModified(), and ProcessorConfigurationFile().
|
staticprivate |
Definition at line 85 of file ProcessorConfigurationFile.hh.
Referenced by encodingMapSize(), and ProcessorConfigurationFile().
|
private |
Definition at line 92 of file ProcessorConfigurationFile.hh.
Referenced by errorCount(), errors(), errorString(), and handleError().
|
staticprivate |
Definition at line 88 of file ProcessorConfigurationFile.hh.
Referenced by implementationName(), and ProcessorConfigurationFile().
|
staticprivate |
Definition at line 90 of file ProcessorConfigurationFile.hh.
Referenced by implementationModified(), and ProcessorConfigurationFile().
|
staticprivate |
Definition at line 89 of file ProcessorConfigurationFile.hh.
Referenced by implementationSize(), and ProcessorConfigurationFile().
|
private |
Directory of the PCF file, affects the path returned when ADF, IDF or BEM is requested.
Definition at line 98 of file ProcessorConfigurationFile.hh.
Referenced by realPath(), and setPCFDirectory().