#include <gnSourceFactory.h>
Public Member Functions | |
~gnSourceFactory () | |
uint32 | GetSourceClassListSize () const |
Returns the number of file extension to class mappings. | |
boolean | DelSourceClass (const string &ext) |
Deletes a file extension to class mapping. | |
gnBaseSource * | GetSourceClass (const string &ext) const |
Gets the source class which is mapped to the specified file extension. | |
gnBaseSource * | MatchSourceClass (const string &sourceStr) const |
Gets the source class which would be mapped to the string. | |
boolean | HasSourceClass (const string &ext) const |
Checks if the specified file extension is recognized. | |
boolean | SetSourceClass (const string &ext, const gnBaseSource &source) |
Maps the specified file extension to the given source class. | |
boolean | SetDefaultSourceClass (const gnBaseSource *source) |
Sets a source class to be the default class for unknown file extensions. | |
gnBaseSource * | GetDefaultSourceClass () const |
Gets the source class which is the default class for unknown file extensions. | |
uint32 | GetPathListSize () const |
Returns the number of directory paths to search for files. | |
boolean | AddPath (const string &path) |
Adds the directory to the search path. | |
boolean | DelPath (uint32 i) |
Deletes the directory path at index i from the search path list. | |
boolean | InsPath (const string &path, uint32 i) |
Inserts the directory path at index i in the search path list. | |
string | GetPath (uint32 i) const |
Gets the directory path at index i in the path list. | |
boolean | HasPath (string path) const |
Checks the path list for the given path. | |
uint32 | GetSourceListSize () const |
Returns the number of open data sources. | |
gnBaseSource * | AddSource (const string &sourceStr, boolean searchPaths=true) |
Opens and returns a pointer to a source of genetic sequence data. | |
gnBaseSource * | GetSource (uint32 i) const |
Gets the source at index i in the source list. | |
void | DelSource (uint32 i) |
Deletes the source at index i in the source list. | |
boolean | DelSource (const gnBaseSource *source) |
Deletes the given source from the source list. | |
gnBaseSource * | HasSource (string sourceStr, boolean searchPaths=true) const |
Gets the source if it has already been opened. | |
Static Public Member Functions | |
gnSourceFactory * | GetSourceFactory () |
Returns the current source factory. | |
Private Member Functions | |
gnSourceFactory () | |
gnSourceFactory (gnSourceFactory &gnsf) | |
gnSourceFactory & | operator= (gnSourceFactory &gnsf) |
boolean | PathExists (string path) const |
Static Private Member Functions | |
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 37 of file gnSourceFactory.h.
|
Definition at line 52 of file gnSourceFactory.cpp. References m_sourceClassList, and m_sourceList. |
|
Definition at line 39 of file gnSourceFactory.cpp. References m_pDefaultSourceClass, and m_sourceClassList. Referenced by GetSourceFactory(). |
|
|
|
Adds the directory to the search path.
Definition at line 106 of file gnSourceFactory.cpp. References HasPath(), m_pathList, and PathExists(). Referenced by gnDNXSource::ParseStream(). |
|
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 232 of file gnSourceFactory.cpp. References gnBaseSource::Clone(), ErrorMsg(), FileNotOpened(), getFileString(), GetURL(), HasSource(), m_pathList, m_sourceList, MatchSourceClass(), gnBaseSource::Open(), and Throw_gnEx. Referenced by gnDNXSource::ParseStream(). |
|
Deletes the directory path at index i from the search path list.
Definition at line 114 of file gnSourceFactory.cpp. References m_pathList. |
|
Deletes the given source from the source list. This will close the associated file, network, or database connection.
Definition at line 333 of file gnSourceFactory.cpp. References gnBaseSource::Close(), and m_sourceList. |
|
Deletes the source at index i in the source list. This will close the associated file, network, or database connection.
Definition at line 318 of file gnSourceFactory.cpp. References gnBaseSource::Close(), IndexOutOfBounds(), m_sourceList, and Throw_gnEx. |
|
Deletes a file extension to class mapping.
Definition at line 67 of file gnSourceFactory.cpp. References m_sourceClassList. |
|
Gets the source class which is the default class for unknown file extensions.
Definition at line 213 of file gnSourceFactory.h. References m_pDefaultSourceClass. |
|
Gets the directory path at index i in the path list.
Definition at line 131 of file gnSourceFactory.cpp. References m_pathList. |
|
Returns the number of directory paths to search for files.
Definition at line 220 of file gnSourceFactory.h. References m_pathList, and uint32. |
|
Gets the source at index i in the source list.
Definition at line 312 of file gnSourceFactory.cpp. References m_sourceList. |
|
Gets the source class which is mapped to the specified file extension.
Definition at line 75 of file gnSourceFactory.cpp. References m_pDefaultSourceClass, and m_sourceClassList. Referenced by MatchSourceClass(). |
|
Returns the number of file extension to class mappings.
Definition at line 199 of file gnSourceFactory.h. References m_sourceClassList, and uint32. |
|
Returns the current source factory.
Definition at line 189 of file gnSourceFactory.h. References gnSourceFactory(). Referenced by gnSequence::LoadSource(), gnDNXSource::ParseStream(), and gnDNXSource::Write(). |
|
Returns the number of open data sources.
Definition at line 225 of file gnSourceFactory.h. References m_sourceList, and uint32. |
|
Definition at line 200 of file gnSourceFactory.cpp. References uint32. Referenced by AddSource(). |
|
Checks the path list for the given path.
Definition at line 137 of file gnSourceFactory.cpp. References m_pathList, standarizePathString(), and uint32. Referenced by AddPath(). |
|
Gets the source if it has already been opened.
Definition at line 351 of file gnSourceFactory.cpp. References getFileString(), m_pathList, m_sourceList, and standarizePathString(). Referenced by AddSource(), and gnDNXSource::Write(). |
|
Checks if the specified file extension is recognized.
Definition at line 90 of file gnSourceFactory.cpp. References m_sourceClassList. |
|
Inserts the directory path at index i in the search path list.
Definition at line 122 of file gnSourceFactory.cpp. References m_pathList, and PathExists(). |
|
Gets the source class which would be mapped to the string.
Definition at line 82 of file gnSourceFactory.cpp. References GetSourceClass(), and m_pDefaultSourceClass. Referenced by AddSource(). |
|
|
|
Definition at line 378 of file gnSourceFactory.cpp. References standarizePathString(). |
|
Sets a source class to be the default class for unknown file extensions.
Definition at line 204 of file gnSourceFactory.h. References gnBaseSource::Clone(), and m_pDefaultSourceClass. |
|
Maps the specified file extension to the given source class. e.g. ".fas" to gnFASSource
Definition at line 96 of file gnSourceFactory.cpp. References gnBaseSource::Clone(), and m_sourceClassList. |
|
Definition at line 182 of file gnSourceFactory.h. Referenced by AddPath(), AddSource(), DelPath(), GetPath(), GetPathListSize(), HasPath(), HasSource(), and InsPath(). |
|
Definition at line 185 of file gnSourceFactory.h. Referenced by GetDefaultSourceClass(), GetSourceClass(), gnSourceFactory(), MatchSourceClass(), and SetDefaultSourceClass(). |
|
Definition at line 184 of file gnSourceFactory.h. Referenced by DelSourceClass(), GetSourceClass(), GetSourceClassListSize(), gnSourceFactory(), HasSourceClass(), SetSourceClass(), and ~gnSourceFactory(). |
|
Definition at line 183 of file gnSourceFactory.h. Referenced by AddSource(), DelSource(), GetSource(), GetSourceListSize(), HasSource(), and ~gnSourceFactory(). |