#include <gnSourceFactory.h>
Public Methods | |
~gnSourceFactory () | |
uint32 | GetSourceClassListSize () const |
Returns the number of file extension to class mappings. More... | |
boolean | DelSourceClass (const string &ext) |
Deletes a file extension to class mapping. More... | |
gnBaseSource* | GetSourceClass (const string &ext) const |
Gets the source class which is mapped to the specified file extension. More... | |
gnBaseSource* | MatchSourceClass (const string &sourceStr) const |
Gets the source class which would be mapped to the string. More... | |
boolean | HasSourceClass (const string &ext) const |
Checks if the specified file extension is recognized. More... | |
boolean | SetSourceClass (const string &ext, const gnBaseSource &source) |
Maps the specified file extension to the given source class. More... | |
boolean | SetDefaultSourceClass (const gnBaseSource *source) |
Sets a source class to be the default class for unknown file extensions. More... | |
gnBaseSource* | GetDefaultSourceClass () const |
Gets the source class which is the default class for unknown file extensions. More... | |
uint32 | GetPathListSize () const |
Returns the number of directory paths to search for files. More... | |
boolean | AddPath (const string &path) |
Adds the directory to the search path. More... | |
boolean | DelPath (uint32 i) |
Deletes the directory path at index i from the search path list. More... | |
boolean | InsPath (const string &path, uint32 i) |
Inserts the directory path at index i in the search path list. More... | |
string | GetPath (uint32 i) const |
Gets the directory path at index i in the path list. More... | |
boolean | HasPath (string path) const |
Checks the path list for the given path. More... | |
uint32 | GetSourceListSize () const |
Returns the number of open data sources. More... | |
gnBaseSource* | AddSource (const string &sourceStr, boolean searchPaths=true) |
Opens and returns a pointer to a source of genetic sequence data. More... | |
gnBaseSource* | GetSource (uint32 i) const |
Gets the source at index i in the source list. More... | |
void | DelSource (uint32 i) |
Deletes the source at index i in the source list. More... | |
boolean | DelSource (const gnBaseSource *source) |
Deletes the given source from the source list. More... | |
gnBaseSource* | HasSource (string sourceStr, boolean searchPaths=true) const |
Gets the source if it has already been opened. More... | |
Static Public Methods | |
gnSourceFactory* | GetSourceFactory () |
Returns the current source factory. More... | |
Private Methods | |
gnSourceFactory () | |
gnSourceFactory (gnSourceFactory &gnsf) | |
gnSourceFactory& | operator= (gnSourceFactory &gnsf) |
boolean | PathExists (string path) const |
Static Private Methods | |
boolean | GetURL (const string &urlStr, string &localFile) |
Private Attributes | |
vector< string > | m_pathList |
vector< gnBaseSource* > | m_sourceList |
map< string, gnBaseSource* > | m_sourceClassList |
gnBaseSource* | m_pDefaultSourceClass |
When opening a data source it first tries to interpret the source location as a URL, opening the specified file, or downloading it if necessary. If that fails, it will attempt to open the source as a file on the local disk. gnSourceFactory uses the file extension to determine file format, so a file which ends with .fas will be opened by gnFASSource. Finally, gnSourceFactory can be given directory paths to search when opening a file whose path is not specified. IMPORTANT: Do not try to instantiate this class. To use this class do the following: gnSourceFactory* mySourceFactory = gnSourceFactory::GetSourceFactory();
Definition at line 38 of file gnSourceFactory.h.
|
Definition at line 53 of file gnSourceFactory.cpp. |
|
Definition at line 40 of file gnSourceFactory.cpp. Referenced by GetSourceFactory().
|
|
|
|
Adds the directory to the search path.
Definition at line 107 of file gnSourceFactory.cpp. Referenced by gnDNXSource::ParseStream(), and main().
|
|
Opens and returns a pointer to a source of genetic sequence data. If the source has already been opened, AddSource() returns a copy of the existing source class.
Definition at line 233 of file gnSourceFactory.cpp. Referenced by gnDNXSource::ParseStream(), and main().
|
|
Deletes the directory path at index i from the search path list.
Definition at line 115 of file gnSourceFactory.cpp. Referenced by main().
|
|
Deletes the given source from the source list. This will close the associated file, network, or database connection.
Definition at line 334 of file gnSourceFactory.cpp. |
|
Deletes the source at index i in the source list. This will close the associated file, network, or database connection.
Definition at line 319 of file gnSourceFactory.cpp. |
|
Deletes a file extension to class mapping.
Definition at line 68 of file gnSourceFactory.cpp. Referenced by main().
|
|
Gets the source class which is the default class for unknown file extensions.
Definition at line 214 of file gnSourceFactory.h. Referenced by main().
|
|
Gets the directory path at index i in the path list.
Definition at line 132 of file gnSourceFactory.cpp. Referenced by main().
|
|
Returns the number of directory paths to search for files.
Definition at line 221 of file gnSourceFactory.h. Referenced by main().
|
|
Gets the source at index i in the source list.
Definition at line 313 of file gnSourceFactory.cpp. |
|
Gets the source class which is mapped to the specified file extension.
Definition at line 76 of file gnSourceFactory.cpp. Referenced by MatchSourceClass(), and main().
|
|
Returns the number of file extension to class mappings.
Definition at line 200 of file gnSourceFactory.h. Referenced by main().
|
|
Returns the current source factory.
Definition at line 190 of file gnSourceFactory.h. Referenced by gnSequence::LoadSource(), gnDNXSource::ParseStream(), gnDNXSource::Write(), and main().
|
|
Returns the number of open data sources.
Definition at line 226 of file gnSourceFactory.h. Referenced by main().
|
|
Definition at line 201 of file gnSourceFactory.cpp. Referenced by AddSource().
|
|
Checks the path list for the given path.
Definition at line 138 of file gnSourceFactory.cpp. Referenced by AddPath(), and main().
|
|
Gets the source if it has already been opened.
Definition at line 352 of file gnSourceFactory.cpp. Referenced by AddSource(), and gnDNXSource::Write().
|
|
Checks if the specified file extension is recognized.
Definition at line 91 of file gnSourceFactory.cpp. Referenced by main().
|
|
Inserts the directory path at index i in the search path list.
Definition at line 123 of file gnSourceFactory.cpp. Referenced by main().
|
|
Gets the source class which would be mapped to the string.
Definition at line 83 of file gnSourceFactory.cpp. Referenced by AddSource(), and main().
|
|
Definition at line 379 of file gnSourceFactory.cpp. Referenced by AddPath(), and InsPath().
|
|
Sets a source class to be the default class for unknown file extensions.
Definition at line 205 of file gnSourceFactory.h. Referenced by main().
|
|
Maps the specified file extension to the given source class. e.g. ".fas" to gnFASSource
Definition at line 97 of file gnSourceFactory.cpp. Referenced by main().
|
|
|
|
Definition at line 186 of file gnSourceFactory.h. |
|
Definition at line 183 of file gnSourceFactory.h. |
|
Definition at line 185 of file gnSourceFactory.h. |
|
Definition at line 184 of file gnSourceFactory.h. |