OSDN Git Service

カーネルのターゲット非依存部1.7.0およびCFGをマージ
[toppersasp4lpc/asp.git] / asp / cfg / toppers / itronx / factory.hpp
1 /*
2  *  TOPPERS Software
3  *      Toyohashi Open Platform for Embedded Real-Time Systems
4  *
5  *  Copyright (C) 2007-2008 by TAKAGI Nobuhisa
6  * 
7  *  上記著作権者は,以下の(1)〜(4)の条件を満たす場合に限り,本ソフトウェ
8  *  ア(本ソフトウェアを改変したものを含む.以下同じ)を使用・複製・改
9  *  変・再配布(以下,利用と呼ぶ)することを無償で許諾する.
10  *  (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作
11  *      権表示,この利用条件および下記の無保証規定が,そのままの形でソー
12  *      スコード中に含まれていること.
13  *  (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使
14  *      用できる形で再配布する場合には,再配布に伴うドキュメント(利用
15  *      者マニュアルなど)に,上記の著作権表示,この利用条件および下記
16  *      の無保証規定を掲載すること.
17  *  (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使
18  *      用できない形で再配布する場合には,次のいずれかの条件を満たすこ
19  *      と.
20  *    (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著
21  *        作権表示,この利用条件および下記の無保証規定を掲載すること.
22  *    (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに
23  *        報告すること.
24  *  (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損
25  *      害からも,上記著作権者およびTOPPERSプロジェクトを免責すること.
26  *      また,本ソフトウェアのユーザまたはエンドユーザからのいかなる理
27  *      由に基づく請求からも,上記著作権者およびTOPPERSプロジェクトを
28  *      免責すること.
29  * 
30  *  本ソフトウェアは,無保証で提供されているものである.上記著作権者お
31  *  よびTOPPERSプロジェクトは,本ソフトウェアに関して,特定の使用目的
32  *  に対する適合性も含めて,いかなる保証も行わない.また,本ソフトウェ
33  *  アの利用により直接的または間接的に生じたいかなる損害に関しても,そ
34  *  の責任を負わない.
35  * 
36  */
37 /*!
38  *  \file   toppers/itronx/factory.hpp
39  *  \brief  カーネルまたはモジュールに応じた処理オブジェクト生成に関する宣言定義
40  *
41  *  このファイルで定義されるクラス
42  *  \code
43  *  class factory;
44  *  \endcode
45  */
46 #ifndef TOPPERS_ITRONX_FACTORY_HPP_
47 #define TOPPERS_ITRONX_FACTORY_HPP_
48
49 #include <memory>
50 #include <string>
51 #include <vector>
52 #include "toppers/macro_processor.hpp"
53 #include "toppers/itronx/static_api.hpp"
54 #include "toppers/itronx/cfg1_out.hpp"
55 #include "toppers/itronx/checker.hpp"
56
57 namespace toppers
58 {
59
60   namespace itronx
61   {
62
63     /*!
64      *  \class  factory factory.hpp "toppers/itronx/factory.hpp"
65      *  \brief  カーネルまたはモジュールに応じた処理オブジェクト生成クラス
66      */
67     class factory
68     {
69     public:
70       explicit factory( std::string const& kernel );
71       virtual ~factory();
72       std::map< std::string, static_api::info > const* get_static_api_info_map() const;
73       cfg1_out::cfg1_def_table const* get_cfg1_def_table() const;
74       std::auto_ptr< cfg1_out > create_cfg1_out( std::string const& filename ) const
75       {
76         return do_create_cfg1_out( filename );
77       }
78       std::auto_ptr< checker > create_checker() const
79       {
80         return do_create_checker();
81       }
82       std::auto_ptr< macro_processor > create_macro_processor( cfg1_out const& cfg1out, cfg1_out::static_api_map const& api_map ) const
83       {
84         return do_create_macro_processor( cfg1out, api_map );
85       }
86       std::auto_ptr< macro_processor > create_macro_processor( cfg1_out const& cfg1out, std::vector< static_api > const& api_array ) const
87       {
88         return do_create_macro_processor( cfg1out, api_array );
89       }
90       void swap( factory& other ) { do_swap( other ); }
91     protected:
92       virtual void do_swap( factory& other );
93       virtual std::auto_ptr< macro_processor > do_create_macro_processor( cfg1_out const& cfg1out, cfg1_out::static_api_map const& api_map ) const;
94       virtual std::auto_ptr< macro_processor > do_create_macro_processor( cfg1_out const& cfg1out, std::vector< static_api > const& api_array ) const;
95     private:
96       virtual std::auto_ptr< cfg1_out > do_create_cfg1_out( std::string const& filename ) const;
97       virtual std::auto_ptr< checker > do_create_checker() const;
98
99       std::string kernel_;
100     };
101
102   }
103 }
104
105 #endif  // ! TOPPERS_ITRONX_FACTORY_HPP_