Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
InputFileRegistry.hpp
Go to the documentation of this file.
1
6#pragma once
7
8#include <ext/memory>
9#include <ext/functional>
10
11#include <alib/string>
12#include <alib/map>
13
16
17namespace abstraction {
18
20 class Entry {
21 public:
22 virtual std::shared_ptr < abstraction::OperationAbstraction > getAbstraction ( const std::string & type, const ext::vector < std::string > & templateParams ) const = 0;
23
24 virtual ~Entry ( ) = default;
25 };
26
27 class EntryImpl : public Entry {
28 std::function < std::shared_ptr < abstraction::OperationAbstraction > ( const std::string & type, const ext::vector < std::string > & templateParams ) > m_callback;
29 public:
30 explicit EntryImpl ( std::shared_ptr < abstraction::OperationAbstraction > ( * callback ) ( const std::string & type, const ext::vector < std::string > & templateParams ) ) : m_callback ( callback ) {
31 }
32
33 std::shared_ptr < abstraction::OperationAbstraction > getAbstraction ( const std::string & type, const ext::vector < std::string > & templateParams ) const override;
34 };
35
37
38public:
39 static void registerInputFileHandler ( const std::string & fileType, std::shared_ptr < abstraction::OperationAbstraction > ( * callback ) ( const std::string & type, const ext::vector < std::string > & templateParams ) );
40
41 static void unregisterInputFileHandler ( const std::string & fileType );
42
43 static std::shared_ptr < abstraction::OperationAbstraction > getAbstraction ( const std::string & fileType, const std::string & type, const ext::vector < std::string > & templateParams );
44};
45
46} /* namespace abstraction */
47
Definition: InputFileRegistry.hpp:19
static void unregisterInputFileHandler(const std::string &fileType)
Definition: InputFileRegistry.cpp:22
static std::shared_ptr< abstraction::OperationAbstraction > getAbstraction(const std::string &fileType, const std::string &type, const ext::vector< std::string > &templateParams)
Definition: InputFileRegistry.cpp:27
static void registerInputFileHandler(const std::string &fileType, std::shared_ptr< abstraction::OperationAbstraction >(*callback)(const std::string &type, const ext::vector< std::string > &templateParams))
Definition: InputFileRegistry.cpp:16
Class extending the map class from the standard library. Original reason is to allow printing of the ...
Definition: map.hpp:48
Class extending the vector class from the standard library. Original reason is to allow printing of t...
Definition: vector.hpp:45
Definition: AlgorithmAbstraction.hpp:11
int callback(struct dl_phdr_info *info, size_t, void *data)
Definition: simpleStacktrace.cpp:25