25 #ifndef WPROJECTFILE_H
26 #define WPROJECTFILE_H
32 #include <boost/filesystem.hpp>
33 #include <boost/shared_ptr.hpp>
34 #include <boost/function.hpp>
35 #include <boost/signals2/signal.hpp>
37 #include "../common/WSharedSequenceContainer.h"
38 #include "../common/WThreadedRunner.h"
40 #include "../common/WProjectFileIO.h"
50 public boost::enable_shared_from_this< WProjectFile >
56 typedef boost::shared_ptr< WProjectFile >
SPtr;
61 typedef boost::shared_ptr< const WProjectFile >
ConstSPtr;
66 typedef boost::function< void( boost::filesystem::path, std::vector< std::string >, std::vector< std::string > ) >
ProjectLoadCallback;
71 typedef boost::signals2::signal< void( boost::filesystem::path, std::vector< std::string >, std::vector< std::string > ) >
79 explicit WProjectFile( boost::filesystem::path project );
110 virtual void save(
const std::list< boost::shared_ptr< WProjectFileIO > >& writer );
118 virtual void save(
const std::vector< boost::shared_ptr< WProjectFileIO > >& writer );
139 static boost::shared_ptr< WProjectFileIO >
getROIWriter();
167 boost::shared_ptr< WModule >
mapToModule(
unsigned int id )
const;
177 unsigned int mapFromModule( boost::shared_ptr< WModule > module )
const;
194 std::list< boost::shared_ptr< WProjectFileIO > >
m_parsers;
199 std::list< boost::shared_ptr< WProjectFileIO > >
m_writers;
236 #endif // WPROJECTFILE_H
boost::signals2::signal< void(boost::filesystem::path, std::vector< std::string >, std::vector< std::string >) > ProjectLoadCallbackSignal
A callback function signal type reporting bach a finished load job.
boost::shared_ptr< WModuleProjectFileCombiner > m_moduleIO
This is the only WProjectFileIO instance which is needed.
boost::shared_ptr< WProjectFile > SPtr
Abbreviation for a shared pointer.
std::list< boost::shared_ptr< WProjectFileIO > > m_writers
The writer instances.
static void deregisterParser(WProjectFileIO::SPtr parser)
Remove parser from registry.
boost::filesystem::path m_project
The project file to parse.
Class representing a single module of OpenWalnut.
boost::shared_ptr< WModule > mapToModule(unsigned int id) const
Map a given project file ID to a module.
This class provides a common interface for thread-safe access to sequence containers (list...
static void registerParser(WProjectFileIO::SPtr parser)
Register a custom project file parser.
boost::function< void(boost::filesystem::path, std::vector< std::string >, std::vector< std::string >) > ProjectLoadCallback
A callback function type reporting bach a finished load job.
Base class for all classes needing to be executed in a separate thread.
Class loading project files.
This class is able to parse project files and create the appropriate module graph inside a specified ...
std::list< boost::shared_ptr< WProjectFileIO > > m_parsers
The parser instances.
boost::signals2::connection m_signalLoadDoneConnection
Connection managing the signal m_signalLoadDone.
static boost::shared_ptr< WProjectFileIO > getROIWriter()
Returns an instance of the ROI writer.
static boost::shared_ptr< WProjectFileIO > getCameraWriter()
Returns an instance of the Camera writer.
virtual void onThreadException(const WException &e)
Do custom exception handling.
static boost::shared_ptr< WProjectFileIO > getModuleWriter()
Returns an instance of the module writer.
virtual void load()
Parses the project file and applies it.
boost::shared_ptr< WProjectFileIO > SPtr
Abbreviation for a shared pointer.
virtual ~WProjectFile()
Destructor.
WProjectFile(boost::filesystem::path project)
Default constructor.
unsigned int mapFromModule(boost::shared_ptr< WModule > module) const
Map a given module to project file ID.
virtual void threadMain()
Function that has to be overwritten for execution.
static ParserList m_additionalParsers
List of all additional parser prototypes.
virtual void save()
Saves the current state to the file specified in the constructor.
WSharedSequenceContainer< std::vector< WProjectFileIO::SPtr > > ParserList
Type used for returning lists of parser prototypes.
ProjectLoadCallbackSignal m_signalLoadDone
Signal used to callback someone that the loader was finished.
boost::shared_ptr< const WProjectFile > ConstSPtr
Abbreviation for const shared pointer.