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