FileLoader_raw Class Reference

Back to the index.

Public Member Functions | Static Public Member Functions | List of all members
FileLoader_raw Class Reference

Raw binary loader (no specific format). More...

#include <FileLoader_raw.h>

Inheritance diagram for FileLoader_raw:
UnitTestable FileLoaderImpl ReferenceCountable

Public Member Functions

 FileLoader_raw (const string &filename)
 
 ~FileLoader_raw ()
 
string DetectFileType (unsigned char *buf, size_t buflen, float &matchness) const
 Attempt to detect file type. More...
 
bool LoadIntoComponent (refcount_ptr< Component > component, ostream &messages) const
 Loads the file into a Component. More...
 
- Public Member Functions inherited from FileLoaderImpl
 FileLoaderImpl (const string &filename)
 Constructs a file loader. More...
 
virtual ~FileLoaderImpl ()
 
- Public Member Functions inherited from ReferenceCountable
 ReferenceCountable ()
 Default constructor, which initializes the reference count to zero. More...
 
 ~ReferenceCountable ()
 

Static Public Member Functions

static void RunUnitTests (int &nSucceeded, int &nFailures)
 
- Static Public Member Functions inherited from UnitTestable
static void RunUnitTests (int &nSucceeded, int &nFailures)
 Runs unit test cases. More...
 

Additional Inherited Members

- Protected Member Functions inherited from FileLoaderImpl
const string & Filename () const
 

Detailed Description

Raw binary loader (no specific format).

TODO: Longer comment.

Definition at line 43 of file FileLoader_raw.h.

Constructor & Destructor Documentation

◆ FileLoader_raw()

FileLoader_raw::FileLoader_raw ( const string &  filename)

Definition at line 43 of file FileLoader_raw.cc.

◆ ~FileLoader_raw()

FileLoader_raw::~FileLoader_raw ( )
inline

Definition at line 50 of file FileLoader_raw.h.

Member Function Documentation

◆ DetectFileType()

string FileLoader_raw::DetectFileType ( unsigned char *  buf,
size_t  buflen,
float &  matchness 
) const
virtual

Attempt to detect file type.

Parameters
bufA buffer containing the header of the file.
buflenThe length of the buffer.
matchnessSet to a value between 0.0 and 1.0, indicating the match certainty.
Returns
A file type description, if there was a match; otherwise an empty string.

Implements FileLoaderImpl.

Definition at line 49 of file FileLoader_raw.cc.

References FileLoaderImpl::Filename(), and StringHelper::SplitStringIntoVector().

◆ LoadIntoComponent()

bool FileLoader_raw::LoadIntoComponent ( refcount_ptr< Component component,
ostream &  messages 
) const
virtual

Loads the file into a Component.

Parameters
componentThe AddressDataBus component to load the file into. (This is usually a CPUComponent.)
messagesAn output stream where debug messages can be put.
Returns
True if loading succeeded, false otherwise.

Implements FileLoaderImpl.

Definition at line 72 of file FileLoader_raw.cc.

References AddressDataBus::AddressSelect(), Component::AsAddressDataBus(), data, FileLoaderImpl::Filename(), StringHelper::ParseNumber(), Component::SetVariableValue(), StringHelper::SplitStringIntoVector(), and AddressDataBus::WriteData().

◆ RunUnitTests()

static void FileLoader_raw::RunUnitTests ( int &  nSucceeded,
int &  nFailures 
)
static

The documentation for this class was generated from the following files:

Generated on Tue Mar 24 2020 14:04:48 for GXemul by doxygen 1.8.17