Element

abstract class for element models

[ libohymos | Source | Keywords | Summary | Ancestors | All Members | Descendants ]

Quick Index

DESCRIPTION

Class Summary

class Element : public Object
{

public:
enum OperationFlag ;
Boolean Register(void* obj, int num);
Boolean Construct(void);
void* Get_receive_port(char* c_name, char* o_name, int o_num );
void* Get_send_port(char* c_name, char* o_name, int o_num );
void* Get_receive_port(char* o_name, int o_num );
void* Get_send_port(char* o_name, int o_num );
void* Get_object(char* c_name, char* o_name, int o_num );
void* Get_component(char* c_name, char* o_name, int o_num ) ;
void* Get_component(char* o_name, int o_num ) ;
Boolean Switch(void);
Boolean Are_you_ready(void);
Boolean Set_data_string(char* d_str, int d_strlen );
void Clear_data_string(void);
Boolean Get_data_string(char* d_str);
void Set_parameter(FILE* fp) ;
void Parameter(FILE* fp, char*& buffer, int buflen, Boolean& stock_p);
void Set_initial_state(FILE* fp) ;
void Initial_state(FILE* fp, char*& buffer, int buflen, Boolean& stock_p);
Boolean Share_info(void) ;
void Save_send_port_stock(FILE* fp);
void Restore_send_port_stock(void);
time_t Current_time(void) ;
time_t Time_step(void) ;
time_t Next_time(void) ;
time_t Terminal_time(void) ;
time_t MediumTermTargetTime(void) ;
time_t Fixed_time(void) ;
time_t Target_time(void) ;
void Rewind_current_time(void);
void Renew_fixed_time(void);
void Initialize_target_time(void) ;
void Renew_target_time(time_t itrs);
time_t Calculate_iteration_step(void);
time_t Necessary_time_from(Receive_port* rp);
time_t Necessary_time_to(Receive_port* rp);
Boolean Initial_time(time_t i_time);
Boolean Initial_work(void);
Boolean Can_you_calculate(void) ;
Boolean Record_status(void);
Boolean Work(void) ;
Boolean Do_you_reach_target_time(void);
void Flush_data(void);
void Creq(void) ;
void Print_receive_ports(FILE* fp , char* head ) ;
void Print_send_ports(FILE* fp , char* head ) ;
void Print_connection(FILE* fp , char* head );
void Save_terminal_state(FILE* fp) ;
void Terminal_state(FILE* fp);
Element* NewElement() ;
Boolean Init(char*, int, FILE*) ;
Boolean Init(char* o_name, int o_num, int num_of_objs , char* p_str ) ;
Boolean Init(char* o_name, int o_num, char* p_str) ;
Element(char* o_name, int o_num, int num_of_objs , char* p_str );
Element(char* o_name, int o_num, char* p_str);
Element(void);
~Element(void);
protected:
Boolean initialworkdone_p;
Boolean shareinfodone_p;
List* object_list;
void** receive_port_array;
int number_of_receive_ports;
void** send_port_array;
int number_of_send_ports;
void** object_array;
int number_of_objects;
char* data_string;
time_t current_time;
time_t time_step;
time_t fixed_time;
time_t target_time;
Boolean mCreqp;
void* Get_from_list(char* c_name, char* o_name, int o_num);
void* Get_from_list(char* o_name, int o_num);
Boolean Register(void* obj);
void Register_receive_ports(void) ;
void Register_send_ports(void) ;
Boolean Make_object_array(void**& obj_array, int& num_of_objs);
Boolean Set_object_array(int num_of_objs);
void* Get_from_array(char* c_name, char* o_name, int o_num, void** obj_array, int num_of_objs);
void* Get_from_array(char* o_name, int o_num, void** obj_array, int num_of_objs);
Boolean Look_data_string(char*& buffer);
char* Get_line(FILE* fp, char* buffer, int buflen, Boolean& stock_p, int& iflag);
void Get_line(FILE*fp, char* buffer, int buflen, char* fname, int line_number);
void Cur2fix2tar(void) ;
Boolean Renew_current_time(void) ;
Boolean Initial_output(void) ;
time_t Calculate_time_step(void) ;
Boolean Can_you_calculate0(void);
Boolean Can_you_calculate1(void);
Boolean Calculate(void) ;
void Set_data_pack_array(void);
void Reduce_data_pack_stock(void);
Boolean Print_status(void) ;
Boolean Work0(void);
Boolean Work1(void);
Boolean Work2(void);
Boolean Work3(void);
void Send_stocked_data(void);
void Print_objects(FILE* fp, char* head, char* title, void** obj_array, int number_of_objs);
}; // Element

Back to the top of Element


DESCRIPTION

An element model

In hydrolgic simulations, we need various element models because various processes are involved.

Class Element expresses the common part of those hydrologic element models.

Back to the top of Element


enum OperationFlag ;

OperationFlag

E_UNDONE
initial work could not be done.
E_DONE
initial work was completed.
E_ALREADY
initial work had been done already.

This type of variable is used in Do_initial_work(void).

  enum OperationFlag {E_UNDONE, E_DONE, E_ALREADY};

Back to the top of Element


Boolean initialworkdone_p;

whether the initial work has been completed or not.

Initial_work を終ったか (YES) 否か (NO)

  Boolean initialworkdone_p;

Back to the top of Element


Boolean shareinfodone_p;

whether the 'Share_info' has been completed or not.

Share_info を終えたか(YES)否か(NO)

  Boolean shareinfodone_p;

Back to the top of Element


List* object_list;

pointer to a list for storing Object*

Object* のリスト。作業用

  List* object_list;

Back to the top of Element


void** receive_port_array;

array of Receive_port*

受信端子へのポインタの配列

  void** receive_port_array;

Back to the top of Element


int number_of_receive_ports;

number of receive ports

receive_port_array の要素数

  int number_of_receive_ports;

Back to the top of Element


void** send_port_array;

array of Send_port*

送信端子配列

  void** send_port_array;

Back to the top of Element


int number_of_send_ports;

number of send-ports

send_port_array の要素数

  int number_of_send_ports;

Back to the top of Element


void** object_array;

array of Object*

オブジェクト配列

  void** object_array;

Back to the top of Element


int number_of_objects;

the number of objects stored in object_array

object_array の要素数

  int number_of_objects;

Back to the top of Element


char* data_string;

data string

データ文字列取得用

  char* data_string;

Back to the top of Element


time_t current_time;

current time in unix time (sec)

現在 (計算済み) 時刻 (sec)

  time_t current_time;

Back to the top of Element


time_t time_step;

time step (sec)

計算1ステップの時間 (sec)

  time_t time_step;

Back to the top of Element


time_t fixed_time;

反復計算において状態が確定している時刻 (sec)

  time_t fixed_time;

Back to the top of Element


time_t target_time;

反復計算目標時刻 (sec)

(* 注意 *) 反復計算する要素では、計算開始時に fixed_time, target_time を current_time と一致させる必要があります。 Set_initial_state で current_time が初期設定された後、 下で定義する void Cur2fix2tar(void) をよぶか、直接 target_time = fixed_time = current_time; としてください。

  time_t target_time;

Back to the top of Element


Boolean mCreqp;

Flag of request of calculation. Initial value is NO.

下流側が計算しようとしたのに計算できない原因がこの要素にあるときに、 mCreqp = YES に設定されるようにします。そして、Element は、 mCreqp = YES のときは、計算するように努力します。 mCreqp は、class Element で始めて追加されたデータメンバです。class Element のオブジェクトを作ったときには、mCreqp は NO に初期化されま す。

  Boolean mCreqp;

Back to the top of Element


void* Get_from_list(char* c_name, char* o_name, int o_num);

Finds an object with class name 'c_name', object name 'o_name', and object number 'o_num' from object_list and returns the pointer to the object. When such an object could not be found from object_list, NULL will be returned.

  void* Get_from_list(char* c_name, char* o_name, int o_num);

Back to the top of Element


void* Get_from_list(char* o_name, int o_num);

Finds an object with object name 'o_name', and object number 'o_num' from object_list and returns the pointer to the object. When such an object could not be found from object_list, NULL will be returned.

  void* Get_from_list(char* o_name, int o_num);

Back to the top of Element


Boolean Register(void* obj);

Registers an object 'obj' to the data member 'object_list'

  Boolean Register(void* obj);

Back to the top of Element


void Register_receive_ports(void) ;

Declares member function Register_receive_ports(void) as pure virtual. In classes derived from class Element, its definition should be given.

Register_receive_port は, 純粋仮想関数です. 派生クラスで必ず定義して下さい.

Register_receive_port は, 派生クラスの全受信 端子メンバ, 全送信端子メンバのアドレスを Element::Register により 登録します.

登録されていない端子は, 接続できないので, 送受信に利用できません.

例えば, 派生クラスで受信端子メンバ abc を定義した場合,

void Register_receive_port(void) { Register((void*) &abc); }
とすれば, abc を受信端子として登録できます.

  virtual void Register_receive_ports(void) = NULL;

Back to the top of Element


void Register_send_ports(void) ;

Declares member function Register_send_ports(void) as pure virtual. In classes derived from class Element, its definition should be given.

Register_send_port は, 純粋仮想関数です. 派生クラスで必ず定義して下さい.

Register_send_port は, 派生クラスの全受信 端子メンバ, 全送信端子メンバのアドレスを Element::Register により 登録します.

登録されていない端子は, 接続できないので, 送受信に利用できません.

例えば, 派生クラスで受信端子メンバ abc を定義した場合,

void Register_send_port(void) { Register((void*) &abc); }
とすれば, abc を受信端子として登録できます.

  virtual void Register_send_ports(void) = NULL;

Back to the top of Element


Boolean Make_object_array(void**& obj_array, int& num_of_objs);

Creates an array of Objects* which are included in 'objext_list' and stores its address in 'obj_array' and the number of elements in 'num_of_objs'

object_list を配列化して obj_array に設定し, 要素数を num_of_objs に設定します.

object_list が NULL を指している場合, エラーメッセージを表示して NO を返します.

また num_of_objs が 0 以上の場合は, 既に配列を作成済みと判断し, エラーメッセージを表示して NO を返します. 配列化後, num_of_objs は 0 以上に設定されます. 従って配列設定前, num_of_objs は 0 未満に初期化しておいて下さい.

number_of_receive_port, number_of_send_port は, コンストラクタで -1 に初期化されます.

in obj_array
- 作成した配列のポインタを格納する参照引数.
in num_of_objs
- obj_array の要素数を格納する参照引数.

RETURN YES
- 正常に obj_array が作成された場合.
RETURN NO
- object_list が NULL の場合や、num_of_objs が 0 以上 の場合.

EXIT Level5
- obj_array の記憶領域を確保できない場合.

  Boolean Make_object_array(void**& obj_array, int& num_of_objs);

Back to the top of Element


Boolean Set_object_array(int num_of_objs);

Acquire the memory to store 'num_of_objs' objects and makes 'object_array' point to the memory

  Boolean Set_object_array(int num_of_objs);

Back to the top of Element


Boolean Register(void* obj, int num);

Registers the object 'obj' with which the current object communicates directly to object_array[num]

  Boolean Register(void* obj, int num);

Back to the top of Element


Boolean Construct(void);

Creates 'receive_port_array' and 'send_port_array'.

Construct does the following work

  1. Creates a List object in the heap area and make 'object_list' point to the List object,
  2. Creates 'receive_port_array' by the use of 'Register_receive_port' and 'Make_object_array',
  3. Reset 'object_list' by the use of List::clear,
  4. Creates 'send_port_array' by the use of 'Register_send_port' and 'Make_object_array', and
  5. Deletes 'object_list' and set it to NULL

  virtual Boolean Construct(void);

Back to the top of Element


void* Get_from_array(char* c_name, char* o_name, int o_num, void** obj_array, int num_of_objs);

  void* Get_from_array(char* c_name, char* o_name, int o_num,
                         void** obj_array, int num_of_objs);

Back to the top of Element


void* Get_from_array(char* o_name, int o_num, void** obj_array, int num_of_objs);

  void* Get_from_array(char* o_name, int o_num,
                         void** obj_array, int num_of_objs);

Back to the top of Element


void* Get_receive_port(char* c_name, char* o_name, int o_num );

  void* Get_receive_port(char* c_name, char* o_name, int o_num = 0);

Back to the top of Element


void* Get_send_port(char* c_name, char* o_name, int o_num );

  void* Get_send_port(char* c_name, char* o_name, int o_num = 0);

Back to the top of Element


void* Get_receive_port(char* o_name, int o_num );

  void* Get_receive_port(char* o_name, int o_num = 0);

Back to the top of Element


void* Get_send_port(char* o_name, int o_num );

  void* Get_send_port(char* o_name, int o_num = 0);

Back to the top of Element


void* Get_object(char* c_name, char* o_name, int o_num );

  void* Get_object(char* c_name, char* o_name, int o_num = 0);

Back to the top of Element


void* Get_component(char* c_name, char* o_name, int o_num ) ;

  virtual void* Get_component(char* c_name, char* o_name, int o_num = 0)
                                                                     ;

Function is currently defined inline.


Back to the top of Element


void* Get_component(char* o_name, int o_num ) ;

  virtual void* Get_component(char* o_name, int o_num = 0)
                                                                     ;

Function is currently defined inline.


Back to the top of Element


Boolean Switch(void);

全ての所有送信端子で Send_port::Switch を実行します.

この時, Send_port::buffer_list を送信先受信端子登録用から, 送信デー タパック収録用に転換し, 送信先受信端子配列, 送信データパック配列が 作成されます.

この関数の実行後は, 所有送信端子を接続, リンクできません.

        RETURN:
            ・YES   正常に実行できた場合.
            ・NO    Send_port::Switch で NO を返す送信端子が存在する場合.
                    (既に Send_port::Switch されている場合. )
        EXIT:
            ・Level 5   Send_port::Switch で強制終了される場合.
     

  virtual Boolean Switch(void);

Back to the top of Element


Boolean Are_you_ready(void);

計算作業前の確認

受信端子, 送信端子が, データパックを送受信可能な状態であることを 確認します.

全受信端子の Receive_port::Are_you_ready の戻り値, 及び全送信端子 の Send_port::Are_you_ready の戻り値が YES であることを確認します. 戻り値が NO の端子が存在する場合は NO を返し, 存在しない場合 YES を返します.

この関数の戻り値が YES の場合, Element は計算を実行できます.

NO の場合は, データパックを受信できない受信端子, またはデータパッ クを送信できない送信端子が存在し, この Element, 送信先の Element で計算を実行できません.

この場合, 接続作業に誤りがあるか, Swith_send_port を実行していな い可能性があります.

         RETURN:
          ・YES   全端子の Are_you_ready の戻り値が YES の場合.
          ・NO    戻り値が NO の端子が存在する場合.
     

  virtual Boolean Are_you_ready(void);

Back to the top of Element


Boolean Set_data_string(char* d_str, int d_strlen );

  Boolean Set_data_string(char* d_str, int d_strlen = -1);

Back to the top of Element


void Clear_data_string(void);

  virtual void Clear_data_string(void);

Back to the top of Element


Boolean Get_data_string(char* d_str);

  Boolean Get_data_string(char* d_str);

Back to the top of Element


Boolean Look_data_string(char*& buffer);

  Boolean Look_data_string(char*& buffer);

Back to the top of Element


char* Get_line(FILE* fp, char* buffer, int buflen, Boolean& stock_p, int& iflag);

stock_p が NO のときは,fp から 1 行読みとり, buffer に格納します。 第1カラムに # がある行や空白行は読み飛ばします。行頭の非空白文字を iflag に格納します。stock_p == YES の場合は,実際には読みとらず,読 みとった振りをして,戻ります。 stock_p は NO に変更されます。これで, 読み戻しを実現しています。正常に読みとることができなかった場合は, NULL を返します。正常に読みとれた場合は, buffer を返します。

in,out fp
- file pointer to the file to be read in
in,out buffer
- buffer
in,out stock_p
- NO: no stock, YES: previous line is stocked
out iflag
- first non blank character

  char* Get_line(FILE* fp, char* buffer, int buflen,
                   Boolean& stock_p, int& iflag);

Back to the top of Element


void Get_line(FILE*fp, char* buffer, int buflen, char* fname, int line_number);

  void Get_line(FILE*fp, char* buffer, int buflen, char* fname,
                   int line_number);

Back to the top of Element


void Set_parameter(FILE* fp) ;

ファイルポインタ fp が指すファイルからパラメタを読み取ります。純粋 仮想関数です。要素モデルを作成するプログラマが、要素モデルに応じて 作成する必要があります。

ファイルポインタ fp で指定されるファイルからデータを読みとって, パラメタを設定します。

例えば, パラメータ用データメンバ p0, p1 を設定する場合,

         void Set_parameter(FILE* fp) {
            fscanf(fp, "%lf %lf", &p0, &p1);
         }
     
パラメタを直接指定する関数を同じ名前で,例えば,
          void Set_parameter(double p0a, double p1a) {
              p0 = p0a;   p1 = p1a;
            }
     
のように用意しておくのも親切であると思います。

純粋仮想関数なので, 派生クラスで必ず定義して下さい.

  virtual void Set_parameter(FILE* fp) = NULL;

Back to the top of Element


void Parameter(FILE* fp, char*& buffer, int buflen, Boolean& stock_p);

パラメタを読み込む関数。定義済みで、ユーザは新規に定義する必要はあ りません。

  virtual void Parameter(FILE* fp, char*& buffer, int buflen,
        Boolean& stock_p);

Back to the top of Element


void Set_initial_state(FILE* fp) ;

初期状態量を設定する関数を, 各派生クラスに応じて定義します. ファイルポインタ fp で指定されるファイルからデータを読みとって, 初期状態量を設定します。

最終状態をファイルに保存するプログラムとつじつまがあうようにして ください。

          void Set_initial_state(FILE* fp) {
              fscanf(fp, "%ld %lf", ¤t_time, &x);
          }
     
この例では,要素の current_time と x が読みとられています。

Set_initial_state は純粋仮想関数なので, 派生クラスで必ず定義して 下さい.

  virtual void Set_initial_state(FILE* fp) = NULL;

Back to the top of Element


void Initial_state(FILE* fp, char*& buffer, int buflen, Boolean& stock_p);

  virtual void Initial_state(FILE* fp, char*& buffer, int buflen,
        Boolean& stock_p);

Back to the top of Element


Boolean Share_info(void) ;

Share_info は、直接通信を利用してパラメタなどの情報を共有するための 関数です。様々な利用方法が考えられますが、たとえばあるオブジェクト のパラメタを他のオブジェクトでも利用したい場合などに利用できます。 それぞれが同じパラメタを Set_parameter で設定するのではなく、一方が 設定したパラメタ値を、他方がコピーさせてもらう、あるいはそのパラメ タへのポインタを教えてもらう、などといった使い方が考えられます。情 報を共有する作業を行った場合は YES を返して下さい。作業を行えなかっ た場合は NO を返して下さい。デフォルトでは単に YES を返すように定義 しています。

  virtual Boolean Share_info(void)                
;

Function is currently defined inline.


Back to the top of Element


void Save_send_port_stock(FILE* fp);

  virtual void Save_send_port_stock(FILE* fp);

Back to the top of Element


void Restore_send_port_stock(void);

  void Restore_send_port_stock(void);

Back to the top of Element


time_t Current_time(void) ;

  time_t Current_time(void)                         
;

Function is currently defined inline.


Back to the top of Element


time_t Time_step(void) ;

  time_t Time_step(void)                      
;

Function is currently defined inline.


Back to the top of Element


time_t Next_time(void) ;

  time_t Next_time(void)                                       
;

Function is currently defined inline.


Back to the top of Element


time_t Terminal_time(void) ;

  virtual time_t Terminal_time(void)
                                                       
;

Function is currently defined inline.


Back to the top of Element


time_t MediumTermTargetTime(void) ;

Returns the medium term target time

中間目標時刻を、owner から get します。

  virtual time_t MediumTermTargetTime(void)
                                                      
;

Function is currently defined inline.


Back to the top of Element


time_t Fixed_time(void) ;

  time_t Fixed_time(void)                       
;

Function is currently defined inline.


Back to the top of Element


time_t Target_time(void) ;

  time_t Target_time(void)                        
;

Function is currently defined inline.


Back to the top of Element


void Cur2fix2tar(void) ;

  void Cur2fix2tar(void)                                             
;

Function is currently defined inline.


Back to the top of Element


Boolean Renew_current_time(void) ;

  virtual Boolean Renew_current_time(void)
                                                                  
;

Function is currently defined inline.


Back to the top of Element


void Rewind_current_time(void);

  virtual void Rewind_current_time(void);

Back to the top of Element


void Renew_fixed_time(void);

  virtual void Renew_fixed_time(void);

Back to the top of Element


void Initialize_target_time(void) ;

  virtual void Initialize_target_time(void)   
;

Function is currently defined inline.


Back to the top of Element


void Renew_target_time(time_t itrs);

  virtual void Renew_target_time(time_t itrs);

Back to the top of Element


time_t Calculate_iteration_step(void);

  virtual time_t Calculate_iteration_step(void);

Back to the top of Element


time_t Necessary_time_from(Receive_port* rp);

  virtual time_t Necessary_time_from(Receive_port* rp);

Back to the top of Element


time_t Necessary_time_to(Receive_port* rp);

  virtual time_t Necessary_time_to(Receive_port* rp);

Back to the top of Element


Boolean Initial_time(time_t i_time);

  virtual Boolean Initial_time(time_t i_time);

Back to the top of Element


Boolean Initial_output(void) ;

  virtual Boolean Initial_output(void) = NULL;

Back to the top of Element


Boolean Initial_work(void);

  virtual Boolean Initial_work(void);

Back to the top of Element


time_t Calculate_time_step(void) ;

  virtual time_t Calculate_time_step(void) = NULL;

Back to the top of Element


Boolean Can_you_calculate0(void);

  Boolean Can_you_calculate0(void);

Back to the top of Element


Boolean Can_you_calculate1(void);

  Boolean Can_you_calculate1(void);

Back to the top of Element


Boolean Can_you_calculate(void) ;

計算開始の可不可の判断

まず, current_time が Element::Terminal_time 以上の場合, 計算済み と判断し NO を返します.

次に, 全ての所有受信端子が Necessary_time_from, Necessary_time_to 間のデータパックを取得可能であることを確認します. 取得可能な場合, 計算実行可能と判断して YES を返します. 取得不可能な場合, 計算実行不可と判断して NO を返します.

     RETURN:
       ・YES   計算実行可能の場合.
       ・NO    計算実行不可能の場合.
                計算済みの場合.
     

  virtual Boolean Can_you_calculate(void) = NULL;

Back to the top of Element


Boolean Calculate(void) ;

1 ステップ分の計算手続き

1ステップ分の計算手続きを定義して下さい.

一般的な Element では,

      ・最初, 各状態量には, current_time における値が格納されている.
      ・ここでは current_time + time_step における状態量, 出力値を
        計算する.
      ・この関数終了後, 状態量は current_time + time_step における
        値に更新されている.
     
     の3点を満足するように, 下記の (1) から (4) を順に記述して下さい.
     
       (1) 受信端子からの入力.
       (2) 数理計算.
       (3) 送信端子への出力.
       (4) 状態量の更新.
     
(2) では, パラメータ, current_time における状態量, 受信端子からの 入力を用い, current_time + time_step における状態量, 送信すべき出 力値を計算する, 数理モデルの1ステップ分を具体的に定義して下さい.

この関数の中で current_time, time_step を変更しないで下さい. 必要ならば time_step を更に細かい時間区分に分割して計算できますが, この時は作業用変数を用い, current_time, time_step を変更しないよ うに注意して下さい.

計算に必要な全ての数値は, データメンバ, 及び所有受信端子からの入 力として取得できます. 従って引数は不要です.

予定通り計算できた場合は, YES を返します。Calculate の内部で計算 時間ステップを計算し, その計算時間ステップ分のデータを取得できな いなどして, 計算を進めることができなかった場合は, NO を返します。

純粋仮装関数なので, 派生クラスで必ず定義して下さい.

      ACCIDENT:
        ・この関数の中で current_time, time_step が変更された場合, 異
          常発生の恐れがある.
     

  virtual Boolean Calculate(void) = NULL;

Back to the top of Element


void Set_data_pack_array(void);

  void Set_data_pack_array(void);

Back to the top of Element


void Reduce_data_pack_stock(void);

  void Reduce_data_pack_stock(void);

Back to the top of Element


Boolean Print_status(void) ;

  virtual Boolean Print_status(void)                
;

Function is currently defined inline.


Back to the top of Element


Boolean Record_status(void);

  Boolean Record_status(void);

Back to the top of Element


Boolean Work0(void);

time_step を得てから, Calculate を実行する Work

  Boolean Work0(void);

Back to the top of Element


Boolean Work1(void);

time_step は, Calculate の内部で計算される Work

  Boolean Work1(void);

Back to the top of Element


Boolean Work2(void);

  Boolean Work2(void); //; 反復計算要素用 Work の例

Back to the top of Element


Boolean Work3(void);

中間目標時刻に対応した Work の例

  Boolean Work3(void);

Back to the top of Element


Boolean Work(void) ;

  virtual Boolean Work(void) = NULL;

Back to the top of Element


Boolean Do_you_reach_target_time(void);

  virtual Boolean Do_you_reach_target_time(void);

Back to the top of Element


void Flush_data(void);

  virtual void Flush_data(void);

Back to the top of Element


void Send_stocked_data(void);

  virtual void Send_stocked_data(void);

Back to the top of Element


void Creq(void) ;

Register request of calculation to this element

この要素への計算要請があったことを記録します。この要素の Work で、 この要請を考慮します。

この関数は、この要素の送信端子から呼ばれます。部分系では、この関数 が呼ばれることはありません。中継端子は、計算要求を送信端子に転送す るだけで、中継端子の所有者である部分系には計算要求を送らないからで す。

  void Creq(void)                  
;

Function is currently defined inline.


Back to the top of Element


void Print_objects(FILE* fp, char* head, char* title, void** obj_array, int number_of_objs);

  void Print_objects(FILE* fp, char* head, char* title,
                       void** obj_array, int number_of_objs);

Back to the top of Element


void Print_receive_ports(FILE* fp , char* head ) ;

  void Print_receive_ports(FILE* fp = stderr, char* head = "    ")
                                                 ;

Function is currently defined inline.


Back to the top of Element


void Print_send_ports(FILE* fp , char* head ) ;

  void Print_send_ports(FILE* fp = stderr, char* head = "    ")
                                              ;

Function is currently defined inline.


Back to the top of Element


void Print_connection(FILE* fp , char* head );

  void Print_connection(FILE* fp = stderr, char* head = "    ");

Back to the top of Element


void Save_terminal_state(FILE* fp) ;

要素の最終状態をファイルポインタ fp で指定されるファイルに書き込む 作業をするメンバ関数です。ユーザが定義する要素モデルでは,この関数 を必ず定義しなければなりません。

最終状態を書き込む仕様は次のようにしてください。

(data_string)

  virtual void Save_terminal_state(FILE* fp) = NULL;

Back to the top of Element


void Terminal_state(FILE* fp);

  virtual void Terminal_state(FILE* fp);

Back to the top of Element


Element* NewElement() ;

Returns a pointer to a new Element

  virtual Element* NewElement()                 
;

Function is currently defined inline.


Back to the top of Element


Boolean Init(char*, int, FILE*) ;

Initilization with the information which is given through a file.

構成要素のクラス名をファイルから読みとってつくりあげる部分系モデル で利用されるコンストラクタの補助関数。引数無しのコンストラクタで作 成したあとに呼ばれることを想定しています。 例えば、classname, objname, objnum がファイルから読み取られていると して、

        Element* p = new_element(classname);
        p->Init(objname, objnum, fp);
     

のようにして、構成要素を割り当てます。

構成要素のクラス名をファイルから読みとってつくりあげる部分系モデル で利用されるようにするためには、この関数を定義しておく必要がありま す。 Init(objname, objnum, fp) が未定義の構成要素が呼ばれたときにエラー メッセージを表示して停止するようにしておきます。

  virtual Boolean Init(char*, int, FILE*)
                                                                                   
;

Function is currently defined inline.


Back to the top of Element


Boolean Init(char* o_name, int o_num, int num_of_objs , char* p_str ) ;

  Boolean Init(char* o_name, int o_num,
                 int num_of_objs = 0, char* p_str = NULL)
                          ;

Function is currently defined inline.


Back to the top of Element


Boolean Init(char* o_name, int o_num, char* p_str) ;

  Boolean Init(char* o_name, int o_num, char* p_str)
                          ;

Function is currently defined inline.


Back to the top of Element


Element(char* o_name, int o_num, int num_of_objs , char* p_str );

  Element(char* o_name, int o_num,
            int num_of_objs = 0, char* p_str = NULL);

Back to the top of Element


Element(char* o_name, int o_num, char* p_str);

  Element(char* o_name, int o_num, char* p_str);

Back to the top of Element


Element(void);

  Element(void);

Back to the top of Element


~Element(void);

  ~Element(void);

Back to the top of Element


All Members

public:
char* Class_name(void) ;
char* Object_name(void) ;
int Object_number(void) ;
void* Owner(void) ;
Boolean Compare(char* c_name, char* o_name, int o_num);
Boolean Compare(char* o_name, int o_num);
Boolean Compare(Object* obj);
Boolean Set_owner(void* o);
void Cprint(FILE* fp_out, char* head);
void Cprint(FILE* fp_out) ;
void Cprint(char* head ) ;
void Oprint(FILE* fp_out, char* head);
void Oprint(FILE* fp_out) ;
void Oprint(char* head ) ;
void Absname( char* absname );
Boolean Init(char* o_name, int o_num);
enum OperationFlag ;
Boolean Register(void* obj, int num);
Boolean Construct(void);
void* Get_receive_port(char* c_name, char* o_name, int o_num );
void* Get_send_port(char* c_name, char* o_name, int o_num );
void* Get_receive_port(char* o_name, int o_num );
void* Get_send_port(char* o_name, int o_num );
void* Get_object(char* c_name, char* o_name, int o_num );
void* Get_component(char* c_name, char* o_name, int o_num ) ;
void* Get_component(char* o_name, int o_num ) ;
Boolean Switch(void);
Boolean Are_you_ready(void);
Boolean Set_data_string(char* d_str, int d_strlen );
void Clear_data_string(void);
Boolean Get_data_string(char* d_str);
void Set_parameter(FILE* fp) ;
void Parameter(FILE* fp, char*& buffer, int buflen, Boolean& stock_p);
void Set_initial_state(FILE* fp) ;
void Initial_state(FILE* fp, char*& buffer, int buflen, Boolean& stock_p);
Boolean Share_info(void) ;
void Save_send_port_stock(FILE* fp);
void Restore_send_port_stock(void);
time_t Current_time(void) ;
time_t Time_step(void) ;
time_t Next_time(void) ;
time_t Terminal_time(void) ;
time_t MediumTermTargetTime(void) ;
time_t Fixed_time(void) ;
time_t Target_time(void) ;
void Rewind_current_time(void);
void Renew_fixed_time(void);
void Initialize_target_time(void) ;
void Renew_target_time(time_t itrs);
time_t Calculate_iteration_step(void);
time_t Necessary_time_from(Receive_port* rp);
time_t Necessary_time_to(Receive_port* rp);
Boolean Initial_time(time_t i_time);
Boolean Initial_work(void);
Boolean Can_you_calculate(void) ;
Boolean Record_status(void);
Boolean Work(void) ;
Boolean Do_you_reach_target_time(void);
void Flush_data(void);
void Creq(void) ;
void Print_receive_ports(FILE* fp , char* head ) ;
void Print_send_ports(FILE* fp , char* head ) ;
void Print_connection(FILE* fp , char* head );
void Save_terminal_state(FILE* fp) ;
void Terminal_state(FILE* fp);
Element* NewElement() ;
Boolean Init(char*, int, FILE*) ;
Boolean Init(char* o_name, int o_num, int num_of_objs , char* p_str ) ;
Boolean Init(char* o_name, int o_num, char* p_str) ;
protected:
char* class_name;
char* object_name;
int object_number;
void* owner;
Boolean initialworkdone_p;
Boolean shareinfodone_p;
List* object_list;
void** receive_port_array;
int number_of_receive_ports;
void** send_port_array;
int number_of_send_ports;
void** object_array;
int number_of_objects;
char* data_string;
time_t current_time;
time_t time_step;
time_t fixed_time;
time_t target_time;
Boolean mCreqp;
void* Get_from_list(char* c_name, char* o_name, int o_num);
void* Get_from_list(char* o_name, int o_num);
Boolean Register(void* obj);
void Register_receive_ports(void) ;
void Register_send_ports(void) ;
Boolean Make_object_array(void**& obj_array, int& num_of_objs);
Boolean Set_object_array(int num_of_objs);
void* Get_from_array(char* c_name, char* o_name, int o_num, void** obj_array, int num_of_objs);
void* Get_from_array(char* o_name, int o_num, void** obj_array, int num_of_objs);
Boolean Look_data_string(char*& buffer);
char* Get_line(FILE* fp, char* buffer, int buflen, Boolean& stock_p, int& iflag);
void Get_line(FILE*fp, char* buffer, int buflen, char* fname, int line_number);
void Cur2fix2tar(void) ;
Boolean Renew_current_time(void) ;
Boolean Initial_output(void) ;
time_t Calculate_time_step(void) ;
Boolean Can_you_calculate0(void);
Boolean Can_you_calculate1(void);
Boolean Calculate(void) ;
void Set_data_pack_array(void);
void Reduce_data_pack_stock(void);
Boolean Print_status(void) ;
Boolean Work0(void);
Boolean Work1(void);
Boolean Work2(void);
Boolean Work3(void);
void Send_stocked_data(void);
void Print_objects(FILE* fp, char* head, char* title, void** obj_array, int number_of_objs);

Back to the top of Element


Ancestors

Inheritance chain for Element:

Back to the top of Element


Descendants

Back to the top of Element


Generated from source by the Cocoon utilities on Sun Sep 3 22:52:01 2000 .

Report problems to jkotula@stratasys.com