www.pudn.com > apdb2ndb.rar > atn_sfx.h
/* Copyright (C) FUJITSU LIMITED 2000 */ /* $Id: atn_sfx.h,v 1.1 2001/02/13 10:31:16 JST rad1 Exp $ */ /* This header file is protected for developers */ /* * $Log: atn_sfx.h,v $ * Revision 1.1 2001/02/13 10:31:16 JST rad1 * $B:eK\(B(TSL) * * $Com: 阪本(TSL) */ /* * サフィックスのついたオブジェクトをソート * */ #include#include #include #include #include #include /* * サフィックスのレコード */ class atn_sfx_rec { friend class atn_sfx; private: bool digit_flag; /* サフィックスが数字のときtrue */ int val; /* サフィックスが数字のとき、値を格納 */ public: char *suffix; int64_t aid; /* APDBのID */ int idx; /* ポート、ネットの配列のインデックス */ atn_sfx_rec(void) { suffix = NULL, val = 0, aid =0LL, idx =-1; } ; ~atn_sfx_rec(void) { if(suffix) free(suffix); }; }; /* * ソート用の構造体 */ class atn_sfx { public: atn_sfx(void); private: bool ascending_1; /* 昇順かつ連続 */ bool descending_1; /* 降順かつ連続 */ bool ascending; /* 昇順かつ連続 */ bool descending; /* 降順かつ連続 */ int num_of_sfx_rec ; /* オリジナルのサフィックスの個数 */ int cur_num_of_sfx_rec ; /* */ int num_of_digits; /* 数字サフィックスの個数 */ // int cur_num_of_sorted_rec; /* ソート後のサフィックスレコードの個数 */ struct atn_sfx_rec *sfx_rec; /* ソート前のレコード */ int min_sfx,max_sfx; /* 数字型サフィックスの最小、最大 */ public: struct atn_sfx_rec **sorted_sfx_rec; /* ソート前のレコード */ int num_of_alpha_num; /* 英数字サフィックスの個数 */ int num_of_sorted_rec; /* ソート後のサフィックスレコードの個数 */ int *pnidx; /* ソート後のポート、ネットのインデックス public: /* { ascending_1 = false; descending_1 = false; ascending = false; descending = false; num_of_sfx_rec =0; cur_num_of_sfx_rec =0; num_of_digits=0; cur_num_of_sorted_rec=0; sfx_rec = NULL; min_sfx,max_sfx = 0; sorted_sfx_rec = NULL; num_of_alpha_num = 0; num_of_sorted_rec = 0; pnidx = 0; }; */ ~atn_sfx() { if(sorted_sfx_rec) free(sorted_sfx_rec); if(sfx_rec) { delete [] sfx_rec; }; }; /* デストラクタ */ int clear(void); int sort(void); sort(AirComponentPortInfo *,int); /* コンストラクタ */ sort(AirNetInfo *,int); /* コンストラクタ */ int set_num(int); int entry1(const char *suffix,int64_t aid,int idx); void dump(); void dump_after_sort(); int get_num_of_sorted_rec() { return num_of_sorted_rec; } int get_range(int &left,int &right); sort(int,AirComponentPortInfo *); sort(int,AirNetInfo *); /* 低レベル登録関数 */ /* * サフィックス、APDBのレコードID,マルチストリング内の番号を与える */ private: bool chk_all_digits(void) ; bool chk_ascending_1(void) ; bool chk_descending_1(void) ; bool chk_ascending(void) ; bool chk_descending(void) ; };