NODULE クラス共通定義

NODULE クラス共通定義

COMMONHEADERBASIC(BASECLASS, CLASSNAME, CID, VSLOTS)
No. scope return value function name parameters process macro
1 virtual char* classname void #CLASSNAMEの取得 基本
2 static unsigned short classid void CIDの取得 基本
3 int getclasssize void sizeof(CLASSNAME)の取得 基本
4 unsigned short getcid void cidの取得 基本
5 nodule ** VSLOT void noduleポインタのアドレス→(BPTR)this + sizeof(BASECLASS)) 基本
6 nodule *& _SLOT int edan int bases=BASECLASS::_vslotsize();
if (edan <= bases)
return BASECLASS:_SLOT(edan);
else {
nodule **vslot=CLASSNAME::VSLOT();
if (vslot) return vslot[edan – bases – 1];
else return null; }
基本
7 virtual nodule *& SLOT int edan if (edan == EXTRASLOT) return extraslot();
else if (edan == REFERIST) return referlist();
int xtotal=vslotsize();
if (edan > xtotal) {
if (IsNotVital())
return NODULE::SLOT(edan);
else return null; }
return CLASSNAME:_SLOT(edan);
基本
8 int _slotsize void VSLOTS 基本
9 int _vslotsize void CLASSNAME::_slotsize() + BASECLASS::_vslotsize() 基本
10 int vslotsize void CLASSNAME::_vslotsize() 基本
11 void * dataptr void (BPTR)this + sizeof(BASECLASS) + VSLOTS * sizeof(long) 基本
12 static long datalen void sizeof(CLASSNAME) – sizeof(BASECLASS) – VSLOTS * sizeof(long) 基本
13 void dataclean void memset(dataptr(), 0, datalen()) 基本
14 void * dataPtr void dataptr() 基本
15 static long dataLen void datalen() 基本
16 void dataClean void memset(dataPtr(), 0, dataLen()) 基本
17 void CleanSlot bool refclear=false int start=BASECLASS::_vslotsize() + 1;
int slotsu=CLASSNAME::_slotsize();
for (int i=start; slotsu–; i++)
clearSlot(i, refclear);
基本
18 void Clean void doClean();
int slotsu=CLASSNAME::vslotsize() + 1;
for (int i=0; slotsu–; i++) {
nodule *snod=SLOT(i);
if (snod && snod->getpnode() == this  && snod->getpnum() == i && snod-
>IsVital() && !snod->IsEmbedded())    snod->Clean(); }
基本
19 void setpid void vslots()=CLASSNAME::_vslotsize();
if (!pclassid[CID]) {
pclassid[CID]=(unsigned short)
BASECLASS::classid();
vsfunctable[CID] =
(VSLOTFUNC)&CLASSNAME::_SLOT; }
基本
COMMONHEADERPART(BASECLASS, CLASSNAME, CID, VSLOTS)
20 int CleanSansyo nodule *object 固有
21 virtual void Dispose void 固有
22 virtual char * dump char *buff 固有

上記2つの共通マクロの他にCOMMONHEADERSHORTが定義されている.COMMONHEADERSHORTにはCOMMONHEADERBASICが含まれる.COMMONHEADERPARTは,COMMONHEADERSHORTに上記3関数の宣言を追加したものである.関数本体は別途記述されなくてはならない.

#define COMMONHEADERSHORT(BASECLASS, CLASSNAME, CID, VSLOTS) \
COMMONHEADERBASIC(BASECLASS, CLASSNAME, CID, VSLOTS) \
void *operator new (size_t size, nodule *moto=NULL, int eda=0, long ds=0, int addslot=0, short cid=CID, char *namstr=#CLASSNAME){ \
return nodule::operator new (size, moto, eda, ds, addslot, cid, namstr); } \
void operator delete(void *nod, nodule *moto, int eda, long ds, int addslot, short cid, char *namstr){ \
nodule::operator delete(nod, moto, eda, ds, addslot, cid, namstr); } \
void operator delete(void *nod){ nodule::operator delete(nod); }

#define COMMONHEADERSHORT(BASECLASS, CLASSNAME, CID, VSLOTS) \
COMMONHEADERBASIC(BASECLASS, CLASSNAME, CID, VSLOTS) \
void *operator new (size_t size, nodule *moto=NULL, int eda=0, long ds=0, int addslot=0, short cid=CID, char *namstr=#CLASSNAME){ \
return nodule::operator new (size, moto, eda, ds, addslot, cid, namstr); } \
void operator delete(void *nod, nodule *moto, int eda, long ds, int addslot, short cid, char *namstr){ \
nodule::operator delete(nod, moto, eda, ds, addslot, cid, namstr); } \
void operator delete(void *nod){ nodule::operator delete(nod); }

  1. COMMONHEADERBASIC 1(nodule)
  2. COMMONHEADERSHORT 7(ARRAY, BASETABLE, COUPLING, NODEREFLIST, nlist, NLIST, KAKEIZU, PSCLASS)
  3. COMMONHEADERPART 38(CARDLINK, MARGLINK, CARDTABLE, MARGTABLE, longtable, Bobject, DATALIST, LIST, REFLINK, PARTIALNAME, LINKTABLE, TOPOLOGY, FAMILYTREE, GENEBOX, GENELIST, PAIRBOX, …)
仮想関数
No. scope return value function name parameters process N/n
B/P
1 virtual nodule *& SLOT int edan NB
2 virtual char * classname void “NODULE” NB
3 virtual long getsize void size N
4 virtual char * dump char *buff NP
5 virtual char * Dump void N
6 pure virtual void Dispose void NP
7 virtual int getclasssize void sizeof(NODULE) NB
8 virtual int getSlots void vslotsize() N
9 virtual int CleanSansyo nodule *object refcnt NP
10 virtual int vslotsize void NB
11 virtual void print void N
12 virtual void clean void N
13 virtual void Clean void clean() NB#18
14 virtual void * dataPtr void (BPTR)this + sizeof(NODULE) NB
15 virtual long dataLen void NB
16 virtual void dataClean void memset(dataPtr(), 0, dataLen()) NB
17 virtual int Sansyo int slots, nodule *object=NULL n

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA