Home
Install
Use
Develop
Support
News
Credits
hosted by
|
Loads BitSeries data from file.
More...
#include <File.h>
|
| File (const char *name) |
| Constructor.
|
|
virtual | ~File () |
| Destructor. More...
|
|
virtual bool | is_valid (const char *filename) const =0 |
| Return true if filename contains data in the recognized format. More...
|
|
virtual void | open (const char *filename) |
| Open the file.
|
|
void | open (const std::string &filename) |
| Convenience interface to File::open (const char*)
|
|
virtual void | close () |
| Close the file.
|
|
virtual void | reopen () |
| Reopen the file.
|
|
std::string | get_filename () const |
| Return the name of the file from which this instance was created.
|
|
std::string | get_current_filename () const |
|
virtual std::string | get_data_filename () const |
| For when the data file is not the current filename.
|
|
int | get_header_bytes () const |
| Inquire how many bytes are in the header.
|
|
virtual bool | contiguous (const File *that) const |
| Return true this this is contiguous with that.
|
|
| Seekable (const char *name) |
| Constructor.
|
|
virtual | ~Seekable () |
| Destructor. More...
|
|
virtual bool | eod () const |
| Return true when end of data has been reached.
|
|
virtual void | rewind () |
| Rewind to the start of the data.
|
|
virtual uint64_t | get_current_sample () |
| Inquire current time sample.
|
|
void | set_output (BitSeries *data) |
| Set the bits series into which data will be loaded.
|
|
void | set_overlap_buffer (BitSeries *) |
| Buffer used to store overlap (useful in multi-threaded applications)
|
|
void | set_overlap_buffer_memory (Memory *memory) |
| Set the memory type used in the overlap buffer.
|
|
| Input (const char *name) |
| Constructor.
|
|
virtual | ~Input () |
| Destructor.
|
|
virtual const Input * | get_origin () const |
| The origin of the data may be re-implemented by wrappers like SerialFiles.
|
|
virtual void | copy (const Input *input) |
| Copies the behaviour and information attributes (not data) More...
|
|
void | prepare () |
| Prepare the output with the attributes of the data source.
|
|
void | reserve () |
| Reserve the maximum amount of output space required.
|
|
void | reserve (BitSeries *) |
| Reserve the maximum amount of space required in the given container.
|
|
virtual void | restart () |
| Return to the start of data, if possible.
|
|
void | load (BitSeries *data) |
| Load BitSeries data. More...
|
|
virtual BitSeries * | get_output () |
| Retrieve a pointer to the output. More...
|
|
virtual bool | has_output () const |
| Return true if output is set.
|
|
virtual void | seek (int64_t offset, int whence=0) |
| Seek to the specified time sample. More...
|
|
uint64_t | tell () const |
| Return the first time sample to be read on the next call to operate.
|
|
virtual void | seek (const MJD &mjd) |
| Seek to a sample close to the specified MJD.
|
|
virtual uint64_t | get_block_size () const |
| Return the number of time samples to load on each load_block.
|
|
virtual void | set_block_size (uint64_t _size) |
| Set the number of time samples to load on each load_block. More...
|
|
virtual uint64_t | get_overlap () const |
| Return the number of time samples by which consecutive blocks overlap.
|
|
virtual void | set_overlap (uint64_t _overlap) |
| Set the number of time samples by which consecutive blocks overlap.
|
|
virtual uint64_t | get_stride () const |
| Convenience function for returning block_size-overlap.
|
|
virtual uint64_t | get_total_samples () const |
| Return the total number of time samples available.
|
|
void | set_total_samples (uint64_t s) |
| Set the total number of time samples available. More...
|
|
| operator const Observation * () const |
| Get the information about the data source.
|
|
virtual Observation * | get_info () |
| Get the information about the data source.
|
|
virtual const Observation * | get_info () const |
| Get the information about the data source.
|
|
uint64_t | get_load_sample () const |
| Get the next time sample to be loaded.
|
|
uint64_t | get_load_size () const |
| Get the number of samples to be loaded.
|
|
unsigned | get_resolution () const |
| Get the time sample resolution of the data source.
|
|
void | set_resolution (unsigned res) |
| Set the time sample resolution of the data source (use with care)
|
|
void | seek_seconds (double seconds, int whence=0) |
| Convenience method used to seek in units of seconds.
|
|
double | tell_seconds () const |
| Convenience method used to report the offset in seconds.
|
|
void | set_start_seconds (double seconds) |
| Set the start of observation offset in units of seconds.
|
|
void | set_total_seconds (double seconds) |
| Convenience method used to set the number of seconds.
|
|
void | set_context (ThreadContext *context) |
| In multi-threaded programs, a mutual exclusion and a condition.
|
|
bool | has_context () const |
| Return true if the thread context has been set.
|
|
virtual std::string | get_prefix () const |
| Input derived types may specify a prefix to be added to output files.
|
|
| Operation (const char *name) |
| All sub-classes must specify a unique name. More...
|
|
| Operation (const Operation &) |
| Copy constructor.
|
|
virtual | ~Operation () |
| Virtual destructor.
|
|
virtual bool | operate () |
| Call this method to operate on data Returns false on failure. More...
|
|
virtual void | add_extensions (Extensions *) |
| Add any extensions.
|
|
virtual void | combine (const Operation *) |
| Combine accumulated results with another operation. More...
|
|
virtual void | report () const |
| Report operation statistics.
|
|
virtual void | reset () |
| Reset accumulated results to intial values. More...
|
|
std::string | get_name () const |
| Return the unique name of this operation.
|
|
double | get_total_time () const |
| Return the total time spent on this Operation in seconds.
|
|
double | get_elapsed_time () const |
| Get the time spent in the last invocation of operate()
|
|
virtual uint64_t | get_total_weights () const |
| Return the total number of timesample weights encountered. More...
|
|
virtual uint64_t | get_discarded_weights () const |
| Return the number of invalid timesample weights encountered.
|
|
int | get_id () |
| Inquire the unique instantiation id.
|
|
virtual Function | get_function () const |
| Get the function classification of this operation.
|
|
virtual double | get_delay_time () const |
| Get the time delay of this operation, if any, in seconds.
|
|
virtual void | set_scratch (Scratch *) |
| Set the scratch space.
|
|
bool | scratch_was_set () const |
|
virtual uint64_t | bytes_storage () const |
| The number of bytes of additional storage used by the operation.
|
|
virtual uint64_t | bytes_scratch () const |
| The number of bytes of scratch space used by the operation. More...
|
|
| OwnStream (const OwnStream &) |
|
const OwnStream & | operator= (const OwnStream &) |
|
virtual void | set_cout (std::ostream &) const |
|
virtual void | set_cerr (std::ostream &) const |
|
| Able (const Able &) |
|
Able & | operator= (const Able &) |
|
unsigned | get_reference_count () const |
|
| HeapTracked (const HeapTracked &) |
|
HeapTracked & | operator= (const HeapTracked &) |
|
bool | __is_on_heap () const |
|
|
virtual void | open_file (const char *filename)=0 |
| Open the file specified by filename for reading. More...
|
|
virtual int64_t | fstat_file_ndat (uint64_t tailer_bytes=0) |
| Return ndat given the file and header sizes, nchan, npol, and ndim. More...
|
|
virtual int64_t | pad_bytes (unsigned char *buffer, int64_t bytes) |
| Over-ride this function to pad data via HoleyFile.
|
|
virtual void | set_eod (bool _eod) |
| set end_of_data
|
|
virtual void | load_data (BitSeries *data) |
| Load next block of data into BitSeries.
|
|
virtual uint64_t | recycle_data (BitSeries *data) |
| Conserve access to resources by re-using data already in BitSeries. More...
|
|
void | init () |
| initialize variables
|
|
virtual void | operation () |
| Load data into the BitSeries specified with set_output. More...
|
|
virtual void | mark_output () |
| Mark the output BitSeries with sequence informatin.
|
|
virtual bool | can_operate () |
| Return false if the operation doesn't have enough data to proceed.
|
|
virtual void | set_name (const std::string &_name) |
| Set the name!
|
|
int | timers_index (const std::string &op_name) |
| Returns the index in the 'timers' array of a particular timer.
|
|
Handle * | __reference (bool active) const |
|
void | __dereference (bool auto_delete=true) const |
|
|
class | SerialFiles |
|
class | Multiplex |
|
class | HoleyFile |
|
class | RingBuffer |
|
|
These attributes must be set by the open_file method of the derived class.
|
int | fd |
| The file descriptor.
|
|
int | header_bytes |
| The size of the header in bytes.
|
|
std::string | current_filename |
| The name of the currently opened file, set by open()
|
|
void * | host_buffer = nullptr |
| staging buffer for Host to Device transfers
|
|
uint64_t | host_buffer_size = 0 |
| The size of the host_buffer in bytes.
|
|
virtual int64_t | load_bytes (unsigned char *buffer, uint64_t nbytes) |
| Load nbyte bytes of sampled data from the device into buffer. More...
|
|
virtual int64_t | load_bytes_device (unsigned char *buffer, uint64_t bytes, void *device_handle) |
| The file descriptor.
|
|
virtual int64_t | seek_bytes (uint64_t bytes) |
| Set the file pointer to the absolute number of sampled data bytes. More...
|
|
virtual void | set_total_samples () |
| Calculates the total number of samples in the file, based on its size.
|
|
virtual void | open_fd (const std::string &filename) |
| Utility opens the file descriptor.
|
|
static Register & | get_register () |
| Return the list of registered sub-classes.
|
|
Loads BitSeries data from file.
This class is used in conjunction with the Unpacker class in order to add new file formats to the baseband/dsp library. Inherit either dsp::File or one of its derived classes and implement the two pure virtual methods:
then register the new class in File_registry.C
◆ ~File()
Destructor.
The destructor is defined in the .C file so that the Reference::To<BitStream> destructor need not know about the BitStream class in the .h file, allowing changes to be made to BitStream without forcing the re-compilation of code that uses Input but does not use BitStream.
◆ create()
dsp::File * dsp::File::create |
( |
const char * |
filename | ) |
|
|
static |
◆ fstat_file_ndat()
int64_t dsp::File::fstat_file_ndat |
( |
uint64_t |
tailer_bytes = 0 | ) |
|
|
protectedvirtual |
Return ndat given the file and header sizes, nchan, npol, and ndim.
Called by open_file for some file types, to determine that the header ndat matches the file size. Requires 'info' parameters nchan, npol, and ndim as well as header_bytes to be correctly set
Reimplemented in dsp::PdevFile, dsp::BlockFile, and dsp::LuMPFile.
Referenced by dsp::LuMPFile::fstat_file_ndat().
◆ is_valid()
virtual bool dsp::File::is_valid |
( |
const char * |
filename | ) |
const |
|
pure virtual |
Return true if filename contains data in the recognized format.
Derived classes must define the conditions under which they can be used to parse the given data file
Implemented in dsp::GUPPIBlockFile, dsp::CPSR2File, dsp::PdevFile, dsp::DADABuffer, dsp::SMROFile, dsp::LBADR64_File, dsp::PuMaFile, dsp::SPDA1K_File, dsp::SpigotFile, dsp::CPSRFile, dsp::FadcFile, dsp::MultiFile, dsp::CODIFFile, dsp::MaximFile, dsp::VDIFFile, dsp::GMRTBinaryFile, dsp::GUPPIBuffer, dsp::LuMPFile, dsp::PuMa2File, dsp::S2File, dsp::SigProcFile, dsp::DADAFile, dsp::DummyFile, dsp::ASPFile, dsp::DummyFile, dsp::GMRTFile, dsp::GMRTFilterbankFile, dsp::GUPPIFile, dsp::LOFAR_DALFile, dsp::Mark5File, dsp::Mark5bFile, dsp::FITSFile, dsp::PMDAQFile, dsp::BCPMFile, dsp::Mark4File, dsp::WAPPFile, and dsp::LWAFile.
◆ load_bytes()
int64_t dsp::File::load_bytes |
( |
unsigned char * |
buffer, |
|
|
uint64_t |
nbytes |
|
) |
| |
|
protectedvirtual |
Load nbyte bytes of sampled data from the device into buffer.
Load bytes from file.
If the data stored on the device contains information other than the sampled data, this method should be overloaded and the additional information should be filtered out.
Implements dsp::Seekable.
Reimplemented in dsp::PdevFile, dsp::BlockFile, dsp::GUPPIBlockFile, dsp::Mark5File, dsp::Mark5bFile, dsp::DADABuffer, dsp::SerialFiles, dsp::FITSFile, dsp::LuMPFile, dsp::DummyFile, dsp::DummyFile, dsp::LOFAR_DALFile, and dsp::Multiplex.
Referenced by dsp::SerialFiles::load_bytes().
◆ open_file()
virtual void dsp::File::open_file |
( |
const char * |
filename | ) |
|
|
protectedpure virtual |
Open the file specified by filename for reading.
Derived classes must open the file for reading and set the File::fd, File::header_bytes, Input::info, and Input::resolution attributes.
Implemented in dsp::GUPPIBlockFile, dsp::CPSR2File, dsp::PdevFile, dsp::FITSFile, dsp::DADABuffer, dsp::VDIFFile, dsp::LuMPFile, dsp::CPSRFile, dsp::SMROFile, dsp::LBADR64_File, dsp::PMDAQFile, dsp::SPDA1K_File, dsp::CODIFFile, dsp::FadcFile, dsp::PuMaFile, dsp::PuMa2File, dsp::SigProcFile, dsp::SpigotFile, dsp::DADAFile, dsp::MultiFile, dsp::GUPPIFile, dsp::Mark5File, dsp::Mark5bFile, dsp::MaximFile, dsp::GMRTBinaryFile, dsp::GUPPIBuffer, dsp::DummyFile, dsp::ASPFile, dsp::DummyFile, dsp::GMRTFile, dsp::GMRTFilterbankFile, dsp::S2File, dsp::WAPPFile, dsp::LOFAR_DALFile, dsp::LWAFile, dsp::Mark4File, and dsp::BCPMFile.
◆ seek_bytes()
int64_t dsp::File::seek_bytes |
( |
uint64_t |
bytes | ) |
|
|
protectedvirtual |
Set the file pointer to the absolute number of sampled data bytes.
Adjust the file pointer.
If the header_bytes attribute is set, this number of bytes will be subtracted by File::seek_bytes before seeking. If the data stored on the device after the header contains information other than the sampled data, this method should be overloaded and the additional information should be skipped.
Implements dsp::Seekable.
Reimplemented in dsp::DADABuffer, dsp::SerialFiles, dsp::BlockFile, dsp::PdevFile, dsp::FITSFile, dsp::LuMPFile, dsp::Mark5File, dsp::Mark5bFile, dsp::DummyFile, dsp::DummyFile, dsp::GUPPIFile, dsp::GUPPIBuffer, dsp::LOFAR_DALFile, and dsp::Multiplex.
Referenced by dsp::SerialFiles::seek_bytes().
The documentation for this class was generated from the following files:
Generated using doxygen 1.8.17
|