クラス toppers::itron::fdmp::class_id

マルチプロセッサ向けカーネル用"class_id.h"ファイルの出力クラス [詳細]

#include "toppers/itron/fdmp/class_id.hpp"

toppers::itron::fdmp::class_idに対する継承グラフ

Inheritance graph
[凡例]
toppers::itron::fdmp::class_idのコラボレーション図

Collaboration graph
[凡例]
すべてのメンバ一覧

Public メソッド

 class_id (const std::string &file=std::string("class_id.h"))
 コンストラクタ
void load (const boost::shared_ptr< itron::cfg_contents > &contents)
void save () const
 設定ファイルのセーブ
std::vector< std::string > & classes ()
const std::vector< std::string > & classes () const

Protected メソッド

virtual void do_body (std::ostream &ostr) const
 ファイル出力内容の主要部分の規定
virtual const std::vector<
std::string > & 
do_get_object_types () const

説明

マルチプロセッサ向けカーネル用"class_id.h"ファイルの出力クラス

class_id.hpp61 行で定義されています。


コンストラクタとデストラクタ

toppers::itron::fdmp::class_id::class_id const std::string &  file = std::string( "class_id.h" )  )  [explicit]
 

コンストラクタ

引数:
file ファイル名(通常"class_id.h")

class_id.cpp62 行で定義されています。

00062                                                 : kernel_id( file )
00063       {
00064       }


関数

void toppers::itron::fdmp::class_id::do_body std::ostream &  ostr  )  const [protected, virtual]
 

ファイル出力内容の主要部分の規定

引数:
ostr 出力ストリーム

toppers::cfg_baseを実装しています。

class_id.cpp105 行で定義されています。

参照先 do_get_object_types()toppers::kernel_id::get_id_array().

00106       {
00107         std::vector<std::string> object_types( do_get_object_types() );
00108         typedef std::vector<std::string>::const_iterator const_iterator;
00109         long id = 0;
00110 
00111         for ( const_iterator citer( classes_.begin() ), clast( classes_.end() ); citer != clast; ++citer )
00112         {
00113           ++id; // クラスID番号はとりあえず単純な連番
00114           ostr << boost::format( "#define %1%_CLASS_ID\t%2%" ) % *citer % id << "\n\n";
00115           for ( const_iterator titer( object_types.begin() ), tlast( object_types.end() ); titer != tlast; ++titer )
00116           {
00117             const kernel_id::id_array* pids = get_id_array( *citer + ' ' + *titer );
00118             if ( pids != 0 )
00119             {
00120               typedef kernel_id::id_array::const_iterator idb_iterator;
00121               for ( idb_iterator iter( pids->begin() ), last( pids->end() ); iter != last; ++iter )
00122               {
00123                 std::string name( ( *iter )->name() );
00124                 if ( !name.empty() )
00125                 {
00126                   ostr << boost::format( "#define %1%_%2%\t((%1%_CLASS_ID << 16) | %3%)" ) % *citer % name % ( *iter )->value() << '\n';
00127                 }
00128               }
00129             }
00130           }
00131           ostr << '\n';
00132         }
00133       }

関数の呼び出しグラフ:

void toppers::itron::fdmp::class_id::save  )  const
 

設定ファイルのセーブ

この関数は、内部で保持している名前のファイルに、 do_save 仮想関数で 定義された内容を出力します。
do_save に渡される出力ストリームは内部的なものであり、その操作によって 直接ファイルに書き込まれることはありません。(例外安全のため)

toppers::cfg_baseを再定義しています。

class_id.cpp85 行で定義されています。

参照先 _toppers::cfg_base::do_depend()toppers::kernel_id::do_save()toppers::error()toppers::cfg_base::file().

00086       {
00087         std::ostringstream osstr;
00088         if ( do_save( osstr ) )
00089         {
00090           for ( std::vector<std::string>::const_iterator iter( classes_.begin() ), last( classes_.end() ); iter != last; ++iter )
00091           {
00092             using namespace boost::filesystem;
00093             ofstream ofstr( path( *iter, native )/path( file(), native ) );
00094             if ( ofstr.fail() )
00095             {
00096               error( _( "cannot create file `%1%\'" ) % *iter );
00097             }
00098             ofstr << osstr.str() << std::endl;
00099             ofstr.close();
00100             do_depend();
00101           }
00102         }
00103       }

関数の呼び出しグラフ:


このクラスの説明は次のファイルから生成されました:
Copyright © 2006 by TAKAGI Nobuhisa.
このページは Wed Apr 12 16:32:07 2006 に Doxygen によって生成されました。