18 #include "boost/bind.hpp" 37 std::cout <<
"[TODO] error FileManagerServiceBase::canLoadDataType not implemented yet." << std::endl;
38 return QString(
"TODO");
45 return reader->canRead(type, filename);
54 return reader->read(uid, filename);
61 for (std::set<FileReaderWriterServicePtr>::iterator iter = mDataReaders.begin(); iter != mDataReaders.end(); ++iter)
63 if ((*iter)->canRead(type, path))
72 for (std::set<FileReaderWriterServicePtr>::iterator iter = mDataReaders.begin(); iter != mDataReaders.end(); ++iter)
74 if ((*iter)->canWrite(type, path))
86 retval = reader->loadVtkImageData(filename);
95 return reader->loadVtkPolyData(filename);
101 std::vector<FileReaderWriterServicePtr> retval;
102 for (std::set<FileReaderWriterServicePtr>::iterator iter = mDataReaders.begin(); iter != mDataReaders.end(); ++iter)
104 if (dataType.compare((*iter)->canWriteDataType()) == 0)
105 retval.push_back(*iter);
113 std::vector<FileReaderWriterServicePtr> retval;
114 for (std::set<FileReaderWriterServicePtr>::iterator iter = mDataReaders.begin(); iter != mDataReaders.end(); ++iter)
116 if (dataType.compare((*iter)->canReadDataType()) == 0)
117 retval.push_back(*iter);
128 return reader->canReadDataType();
129 CX_LOG_WARNING() <<
"FileManagerServiceBase::findDataTypeFromFile: Cannot find a file reader";
135 bool success =
false;
138 success = reader->readInto(data, path);
152 std::vector<DataPtr> retval;
155 retval = reader->read(filename);
163 return writer->write(data, filename);
172 CX_LOG_DEBUG() <<
"Adding a reader/writer: " << service->objectName() <<
" to: " <<
this;
177 for(std::set<FileReaderWriterServicePtr>::iterator it = mDataReaders.begin(); it != mDataReaders.end(); )
179 if (service->
getName() == (*it)->getName())
181 mDataReaders.erase(it++);
192 return reader->getName();
QString qstring_cast(const T &val)
virtual ~FileManagerServiceBase()
std::vector< DataPtr > read(const QString &filename)
vtkPolyDataPtr loadVtkPolyData(QString filename)
std::vector< FileReaderWriterServicePtr > getExportersForDataType(QString dataType)
bool canLoad(const QString &type, const QString &filename)
QString getFileReaderName(const QString &filename)
bool readInto(DataPtr data, QString path)
boost::shared_ptr< class Data > DataPtr
void addFileReaderWriter(FileReaderWriterService *service)
QString canLoadDataType() const
boost::shared_ptr< class FileReaderWriterService > FileReaderWriterServicePtr
vtkSmartPointer< vtkPolyData > vtkPolyDataPtr
void removeFileReaderWriter(FileReaderWriterService *service)
QString changeExtension(QString name, QString ext)
vtkImageDataPtr loadVtkImageData(QString filename)
virtual QString getName() const =0
std::vector< FileReaderWriterServicePtr > getImportersForDataType(QString dataType)
void save(DataPtr data, const QString &filename)
QString findDataTypeFromFile(QString filename)
DataPtr load(const QString &uid, const QString &filename)
Namespace for all CustusX production code.