The template & lt; The class SAsync>
The class CVQueueAsync
{
Public:
CVQueueAsync (void);
~ CVQueueAsync (void);
Public:
SAsync * QAlloc ();
SAsync * QGetFirst ();
SAsync * QGetAt (int index);
Public:
Int QSkip ();
Int QCount ();
Private:
SAsync m_asyncs [VTCP_ASYNC_MAX_COUNT];
Int m_s;//index
Int m_c;//the number of
};
The template & lt; The class SAsync>
CVQueueAsync
{
M_s=0;
M_c=0;
}
The template & lt; The class SAsync>
CVQueueAsync
{
}
The template & lt; The class SAsync>
SAsync * CVQueueAsync
{
If (m_c==VTCP_ASYNC_MAX_COUNT)
{
ASSERT (FALSE); return NULL;
}
Int index=(m_s + m_c) & amp; VTCP_ASYNC_MAX_COUNT_MASK;
M_c + +;
Return & amp; M_asyncs [index];
}
The template & lt; The class SAsync>
SAsync * CVQueueAsync
{
If (0 & gt;=m_c)
{
return NULL;
}
Return & amp; M_asyncs [m_s];
}
The template & lt; The class SAsync>
SAsync * CVQueueAsync
{
If (index & gt;=m_c)
{
ASSERT (FALSE); return NULL;
}
Return & amp; M_asyncs [(m_s + index) & amp; VTCP_ASYNC_MAX_COUNT_MASK];
}
The template & lt; The class SAsync>
Int CVQueueAsync
{
If (m_c==0)
{
ASSERT (FALSE); Return ERROR_OBJECT_NOT_FOUND;
}
M_s=(m_s + 1) & amp; VTCP_ASYNC_MAX_COUNT_MASK;
M_c -;
return 0;
}
The template & lt; The class SAsync>
Int CVQueueAsync
{
Return m_c;
}
Please convert VC to DELPHI version
//key is
Public:
SAsync * QAlloc ();
SAsync * QGetFirst ();
SAsync * QGetAt (int index);
This I don't know how to convert
CodePudding user response:
It's like an array?Have to do is to define an array, or use TList, such as TStringlist object list
CodePudding user response:
If only to turn out the Delphi code:Type
CVQueueAsync=class
Private
M_asyncs: array [0.. VTCP_ASYNC_MAX_COUNT - 1] of SAsync;
Protected
Public
The constructor the Create ();
The destructor Destroy; override;
The function QAlloc () : SAsync;
end;
.
The function CVQueueAsync. QAlloc () : SAsync;
The begin
Result:=nil;
end;
Delphi object is a pointer.