#include "dkcQueue.h"
#include "dkcStdio.h"
dkcQueue.cのインクルード依存関係図
マクロ定義 | |
#define | DKUTIL_C_QUEUE_C |
関数 | |
DKC_QUEUE *WINAPI | dkcAllocQueue (size_t numof__, size_t offsetof__) |
キュー領域を得る。 | |
int WINAPI | dkcFreeQueue (DKC_QUEUE **ptr) |
dkcAllocNewQueueと対。 | |
int WINAPI | dkcQueuePush (DKC_QUEUE *ptr, const void *data) |
int WINAPI | dkcQueueDynamicPush (DKC_QUEUE *ptr, const void *data) |
void WINAPI | dkcQueuePop (DKC_QUEUE *ptr) |
int WINAPI | dkcQueueTop (DKC_QUEUE *ptr, void *get_data) |
void WINAPI | dkcQueueClear (DKC_QUEUE *ptr) |
size_t WINAPI | dkcQueueSize (DKC_QUEUE *ptr) |
BOOL WINAPI | dkcQueueIsEmpty (DKC_QUEUE *ptr) |
int WINAPI | dkcQueueSerialize (const DKC_QUEUE *ptr, DKC_SERIALIZE *se) |
DKC_QUEUE *WINAPI | dkcAllocQueueDeserialize (DKC_DESERIALIZE *se) |
dkcQueue.c で定義されています。
|
dkcQueue.c の 7 行で定義されています。 |
|
キュー領域を得る。
dkcQueue.c の 12 行で定義されています。 参照先 BYTE, DKC_QUEUE, dkcAllocate(), dkcFree(), dkc_Queue::mBuffer, dkc_Queue::mCounter, dkc_Queue::mEntrance, dkc_Queue::mExit, dkc_Queue::mOffsetOf, dkc_Queue::mSize, と NULL. 参照元 dkcAllocQueueDeserialize().
00012 { 00013 DKC_QUEUE *p; 00014 size_t size = (numof__) * offsetof__; 00015 if(0==size) return NULL; 00016 p = (DKC_QUEUE *)dkcAllocate(sizeof(DKC_QUEUE)); 00017 if(NULL==p) return NULL; 00018 p->mBuffer = (BYTE *)dkcAllocate(size); 00019 00020 if(NULL==p->mBuffer) goto Error; 00021 00022 p->mExit = 0; 00023 p->mEntrance = 0; 00024 p->mSize = size; 00025 p->mOffsetOf = offsetof__; 00026 p->mCounter = 0; 00027 00028 return p; 00029 Error: 00030 dkcFree((void **)&p); 00031 return NULL; 00032 } |
|
dkcQueue.c の 178 行で定義されています。 参照先 DKC_DESERIALIZE, DKC_QUEUE, dkcAllocQueue(), dkcDeserializeRead(), dkcmNOT_ASSERT, edkcSerializeIDQueue, dkc_Queue::mBuffer, dkc_Queue::mEntrance, dkc_Queue::mExit, dkc_Queue::mSize, と NULL.
00178 { 00179 DKC_QUEUE *p; 00180 DKC_QUEUE t; 00181 size_t read; 00182 int id; 00183 00184 dkcDeserializeRead(se,&id,sizeof(id),&read); 00185 if(id != edkcSerializeIDQueue) 00186 { 00187 return NULL; 00188 } 00189 dkcDeserializeRead(se,&t,sizeof(t),&read); 00190 00191 p = dkcAllocQueue(t.mSize,t.mOffsetOf); 00192 if(NULL==p) return NULL; 00193 00194 p->mEntrance = t.mEntrance; 00195 p->mExit = t.mExit; 00196 dkcDeserializeRead(se,p->mBuffer,p->mSize,&read); 00197 00198 dkcmNOT_ASSERT(read != p->mSize); 00199 00200 return p; 00201 } |
|
dkcAllocNewQueueと対。 DKC_QUEUEをデリート
dkcQueue.c の 33 行で定義されています。 参照先 DKC_QUEUE, dkcFree(), と NULL.
|
|
キューをクリアする。 dkcQueue.c の 152 行で定義されています。 参照先 DKC_QUEUE, dkc_Queue::mCounter, dkc_Queue::mEntrance, dkc_Queue::mExit, と NULL.
|
|
dkcQueue.c の 92 行で定義されています。 参照先 BYTE, DKC_QUEUE, dkcQueuePush(), dkcReallocate(), dkcReallocateSizeFunction(), dkc_Queue::mBuffer, dkc_Queue::mOffsetOf, と dkc_Queue::mSize.
00093 { 00094 int result; 00095 void *NewPtr; 00096 size_t want_size; 00097 00098 result = dkcQueuePush(ptr,data); 00099 00100 if(DKUTIL_SUCCEEDED(result)) return result; 00101 00102 //メモリ再確保 00103 { 00104 want_size = dkcReallocateSizeFunction(ptr->mSize,ptr->mOffsetOf); 00105 if(DKUTIL_FAILED( 00106 dkcReallocate(&NewPtr,want_size,(void **)&ptr->mBuffer) 00107 )){ 00108 return edk_FAILED; 00109 } 00110 ptr->mBuffer =(BYTE *)NewPtr; 00111 ptr->mSize = want_size; 00112 } 00113 //もう一回行って見る。 00114 return dkcQueuePush(ptr,data); 00115 00116 } |
|
dkcQueue.c の 164 行で定義されています。 参照先 BOOL, DKC_QUEUE, と dkcQueueSize().
00164 { 00165 return (dkcQueueSize(ptr)==0); 00166 } |
|
dkcQueue.c の 117 行で定義されています。 参照先 DKC_QUEUE, dkcmNOT_ASSERT, と NULL.
|
|
dkcQueue.c の 42 行で定義されています。 参照先 BYTE, DKC_QUEUE, dkcmNOT_ASSERT, と NULL.
00042 { 00043 BYTE *tp; 00044 dkcmNOT_ASSERT(NULL==ptr); 00045 00046 tp = ptr->mBuffer; 00047 if(/*ptr->mEntrance <= ptr->mExit &&*/ 00048 ptr->mCounter >= ptr->mSize / ptr->mOffsetOf) 00049 {//MAX... 00050 return edk_FAILED; 00051 } 00052 else if(ptr->mEntrance >= ptr->mSize) 00053 { 00054 ptr->mEntrance = 0; 00055 } 00056 /*if(ptr->mSize < ptr->mOffsetOf + ptr->mEntrance) 00057 {//入り口が満杯 00058 if(ptr->mExit + ptr->mOffsetOf >= ptr->mSize) 00059 { //出口も入り口と一緒・・・。 00060 //と言う事は消せるね。 00061 dkcQueueClear(ptr); 00062 } 00063 else if(ptr->mExit > ptr->mOffsetOf) 00064 {//前まで出口だった使用していない領域が使えるかも? 00065 if(ptr->mEntrance < ptr->mExit) 00066 {//出口の方がオフセットが上だった 00067 //つまり、すでに**----*** こんな感じになっている。 00068 ptr->mEntrance += ptr->mOffsetOf; 00069 }else{//下だった 00070 //こんな感じ:-----** 00071 ptr->mEntrance = 0; 00072 } 00073 }else 00074 {//ダメだ完全満席 00075 return edk_FAILED; 00076 } 00077 }else if(ptr->mEntrance < ptr->mExit && 00078 ptr->mEntrance+ ptr->mOffsetOf > ptr->mExit) 00079 { 00080 return edk_FAILED; 00081 }*/ 00082 00083 memcpy(&tp[ptr->mEntrance],data,ptr->mOffsetOf); 00084 00085 ptr->mEntrance += ptr->mOffsetOf; 00086 ptr->mCounter++; 00087 00088 return edk_SUCCEEDED; 00089 } |
|
dkcQueue.c の 168 行で定義されています。 参照先 DKC_QUEUE, DKC_SERIALIZE, dkcmNOT_ASSERT, dkcSerializeWrite(), edkcSerializeIDQueue, と NULL.
00169 { 00170 int id = edkcSerializeIDQueue; 00171 dkcmNOT_ASSERT(NULL==ptr); 00172 dkcSerializeWrite(se,&id,sizeof(id)); 00173 dkcSerializeWrite(se,ptr,sizeof(DKC_QUEUE)); 00174 return dkcSerializeWrite(se,ptr->mBuffer,ptr->mSize); 00175 } |
|
dkcQueue.c の 160 行で定義されています。 参照先 DKC_QUEUE, と dkc_Queue::mCounter. 参照元 dkcQueueIsEmpty().
00160 { 00161 return ptr->mCounter; 00162 } |
|
dkcQueue.c の 133 行で定義されています。 参照先 BYTE, DKC_QUEUE, dkcmNOT_ASSERT, dkc_Queue::mBuffer, dkc_Queue::mCounter, dkc_Queue::mExit, dkc_Queue::mOffsetOf, と NULL.
00133 { 00134 BYTE *tp; 00135 00136 dkcmNOT_ASSERT(NULL==ptr || NULL==get_data); 00137 00138 //データが無い。 00139 //if(ptr->mEntrance < ptr->mExit + ptr->mOffsetOf){ 00140 if(0==ptr->mCounter){ 00141 return edk_FAILED; 00142 } 00143 tp = ptr->mBuffer; 00144 00145 memcpy(get_data,&tp[ptr->mExit],ptr->mOffsetOf); 00146 00147 return edk_SUCCEEDED; 00148 00149 00150 } |