本文整理汇总了C++中GetHeader函数的典型用法代码示例。如果您正苦于以下问题:C++ GetHeader函数的具体用法?C++ GetHeader怎么用?C++ GetHeader使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetHeader函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetHeader
void BeaconTransmitter::Configure(const std::string& name, unsigned int protocolID, unsigned int listenerPort, unsigned int serverPort, Serializable* userData)
{
GetHeader().GetData().SetName(name);
GetHeader().GetData().mProtocolID = protocolID;
mListenerPort = listenerPort;
GetHeader().GetData().mServerPort = serverPort;
mpUserData = userData;
mIsConfigured = true;
}
示例2: GetHeader
void STRING::assign(const char *cstr, int len) {
STRING_HEADER* this_header = GetHeader();
this_header->used_ = 0; // dont bother copying data if need to realloc
char* this_cstr = ensure_cstr(len + 1); // +1 for '\0'
this_header = GetHeader(); // for realloc
memcpy(this_cstr, cstr, len);
this_cstr[len] = '\0';
this_header->used_ = len + 1;
assert(InvariantOk());
}
示例3: memcpy
char* Packet::GetPacket(){
if (completebuffer){
if (!m_bSplitted)
memcpy(completebuffer,GetHeader(),6);
return completebuffer;
}
else{
delete[] tempbuffer;
tempbuffer = NULL; // 'new' may throw an exception
tempbuffer = new char[size+10];
memcpy(tempbuffer,GetHeader(),6);
memcpy(tempbuffer+6,pBuffer,size);
return tempbuffer;
}
}
示例4: FastCheck
bool FastCheck() const
{
if (Size < sizeof(RawHeader))
{
return false;
}
const RawHeader& header = GetHeader();
BOOST_STATIC_ASSERT(sizeof(header.ID) == sizeof(FDI_ID));
if (0 != std::memcmp(header.ID, FDI_ID, sizeof(FDI_ID)))
{
return false;
}
const std::size_t dataOffset = fromLE(header.DataOffset);
if (dataOffset < sizeof(header) ||
dataOffset > Size)
{
return false;
}
const uint_t cylinders = fromLE(header.Cylinders);
if (!Math::InRange(cylinders, MIN_CYLINDERS_COUNT, MAX_CYLINDERS_COUNT))
{
return false;
}
const uint_t sides = fromLE(header.Sides);
if (!Math::InRange(sides, MIN_SIDES_COUNT, MAX_SIDES_COUNT))
{
return false;
}
return true;
}
示例5: GetSchema
Tile *Tile::CopyTile(BackendType backend_type) {
auto schema = GetSchema();
bool tile_columns_inlined = schema->IsInlined();
auto allocated_tuple_count = GetAllocatedTupleCount();
// Create a shallow copy of the old tile
TileGroupHeader *new_header = GetHeader();
Tile *new_tile = TileFactory::GetTile(
backend_type, INVALID_OID, INVALID_OID, INVALID_OID, INVALID_OID,
new_header, *schema, tile_group, allocated_tuple_count);
PL_MEMCPY(static_cast<void *>(new_tile->data), static_cast<void *>(data),
tile_size);
// Do a deep copy if some column is uninlined, so that
// the values in that column point to the new pool
if (!tile_columns_inlined) {
auto uninlined_col_cnt = schema->GetUninlinedColumnCount();
// Go over each uninlined column, making a deep copy
for (oid_t col_itr = 0; col_itr < uninlined_col_cnt; col_itr++) {
auto uninlined_col_offset = schema->GetUninlinedColumn(col_itr);
// Copy the column over to the new tile group
for (oid_t tuple_itr = 0; tuple_itr < allocated_tuple_count;
tuple_itr++) {
type::Value val =
(new_tile->GetValue(tuple_itr, uninlined_col_offset));
new_tile->SetValue(val, tuple_itr, uninlined_col_offset);
}
}
}
return new_tile;
}
示例6: GetHeader
SubMediaPiecePtr Storage::GetSubPiece(UINT pieceIndex, UINT8 subPieceIndex) const
{
//SubMediaPiecePtr subPiece = m_unfinishedDataPieces.GetSubPiece(pieceIndex, subPieceIndex);
//if ( subPiece )
// return subPiece;
SubMediaPiecePtr subPiece;
PieceInfo pieceInfo = this->GetPieceInfo(pieceIndex);
if (pieceInfo.IsValid())
{
// 从piece中提取sub piece
subPiece = pieceInfo.GetSubPiece(subPieceIndex);
//LIVE_ASSERT( subPiece );
}
else
{
// 检查headers
//subPiece = m_unfinishedHeaderPieces.GetSubPiece(pieceIndex, subPieceIndex);
//if ( subPiece )
// return subPiece;
MediaHeaderPiecePtr headerPiece = GetHeader(pieceIndex);
if ( headerPiece )
{
subPiece = SubMediaPiecePtr(headerPiece->GetSubPiece(subPieceIndex));
//LIVE_ASSERT( subPiece );
}
}
return subPiece;
}
示例7: SetAttribute
void CListUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
{
if( _tcscmp(pstrName, _T("header")) == 0 ) GetHeader()->SetVisible(_tcscmp(pstrValue, _T("hidden")) != 0);
else if( _tcscmp(pstrName, _T("footer")) == 0 ) GetFooter()->SetVisible(_tcscmp(pstrValue, _T("hidden")) != 0);
else if( _tcscmp(pstrName, _T("expanding")) == 0 ) SetExpanding(_tcscmp(pstrValue, _T("true")) == 0);
else CVerticalLayoutUI::SetAttribute(pstrName, pstrValue);
}
示例8: GetHeader
size_t BindTransmitter::Size() const
{
const size_t size = GetHeader().Size() + systemId_.Size() + password_.Size() + systemType_.Size() \
+ interfaceVersion_.Size() + addrTon_.Size() + addrNpi_.Size() + addressRange_.Size();
return size;
}
示例9: GetHeader
bool YL_CHTTPRequest::GetHeaderItem( const string& strItemName,string& strContent )
{
long lHeadLen = 0;
unsigned char* pszHead = GetHeader( lHeadLen );
if( pszHead != NULL && lHeadLen > 0)
{
char* pTmpBuf = new char[lHeadLen+1];
memcpy(pTmpBuf,pszHead,lHeadLen);
pTmpBuf[lHeadLen] = '\0';
char* pPos = strstr( pTmpBuf,strItemName.c_str());
if( pPos == NULL )
{
delete pTmpBuf;
return false;
}
pPos = strstr( pPos+1,":");
if( pPos == NULL )
{
delete pTmpBuf;
return false;
}
while (*++pPos)
{
if (*pPos != ' ')
break;
}
char* pPos2 = strstr( pPos,"\r\n");
*pPos2 = '\0';
strContent = pPos;
delete[] pTmpBuf;
return true;
}
return false;
}
示例10: add_or_update_alarm
int add_or_update_alarm(uint8_t hour, uint8_t min, uint8_t mode,
uint8_t repeat_factor, char *name)
{
pthread_mutex_t *bucket_mtx = GetLock(hour, min);
pthread_mutex_lock(bucket_mtx);
AlarmClockInfo *header = GetHeader(hour, min);
AlarmClockInfo *temp = header;
// Check whether an existing entry should be updated
while (temp)
{
if (temp->hour == hour && temp->min == min)
{
temp->mode = mode;
temp->repeat_factor = repeat_factor;
strcpy(temp->name, name);
pthread_mutex_unlock(bucket_mtx);
return 0;
}
temp = temp->next;
}
// A new entry is inserted
AlarmClockInfo *naci = CreateNewInfo(hour,min,mode,repeat_factor,name);
naci->next = header;
*AC_TABLE_ENTRY(hour,min) = naci;
pthread_mutex_unlock(bucket_mtx);
return 1;
}
示例11: cancel_alarm
// Return 1 if found and removed, otherwise return 0
int cancel_alarm(uint8_t hour, uint8_t min, int play)
{
pthread_mutex_t *bucket_mtx = GetLock(hour, min);
pthread_mutex_lock(bucket_mtx);
AlarmClockInfo *cand = GetHeader(hour, min);
AlarmClockInfo *prev = NULL;
while (cand)
{
if (cand->hour == hour && cand->min == min)
{
// Optionally, play the alarm here before essentially removing it
// ...
if (play)
; // sound an alarm
if (!prev) *AC_TABLE_ENTRY(hour, min) = cand->next;
else prev->next = cand->next;
free(cand);
pthread_mutex_unlock(bucket_mtx);
return 1;
}
prev = cand;
cand = cand->next;
}
pthread_mutex_unlock(bucket_mtx);
return 0;
}
示例12: FastCheck
bool FastCheck() const
{
if (Size <= sizeof(RawHeader))
{
return false;
}
const RawHeader& header = GetHeader();
const uint_t endOfBlock = fromLE(header.LastSrcRestBytes) + 1;
const uint_t lastBytesAddr = endOfBlock - LAST_BYTES_COUNT;
const uint_t bitStreamAddr = lastBytesAddr - fromLE(header.SizeOfPacked);
const uint_t srcPacked = fromLE(header.SrcPacked);
if (bitStreamAddr == srcPacked)
{
//move forward
}
else if (lastBytesAddr == srcPacked + 1)
{
//move backward
}
else
{
return false;
}
const std::size_t usedSize = GetUsedSize();
return Math::InRange(usedSize, sizeof(header), Size);
}
示例13: GetHeader
//Draw the border and background, leave clip set to the windows client area
bool SummerfaceWindow::PrepareDraw ()
{
if(UseBorder)
{
ESVideo::SetClip(Area(0, 0, ESVideo::GetScreenWidth(), ESVideo::GetScreenHeight()));
//TODO: Make border color
ESVideo::FillRectangle(Area(Region.X, Region.Y, Region.Width, BorderWidth), 0xFFFFFFFF);
ESVideo::FillRectangle(Area(Region.X + BorderWidth, Region.Bottom(), Region.Width, BorderWidth), 0x00000080);
ESVideo::FillRectangle(Area(Region.X, Region.Bottom() - BorderWidth, Region.Width, BorderWidth), 0xFFFFFFFF);
ESVideo::FillRectangle(Area(Region.X, Region.Y + BorderWidth, BorderWidth, Region.Height - BorderWidth * 2), 0xFFFFFFFF);
ESVideo::FillRectangle(Area(Region.Right(), Region.Y + BorderWidth, BorderWidth, Region.Height - BorderWidth), 0x00000080);
ESVideo::FillRectangle(Area(Region.Right() - BorderWidth, Region.Y + BorderWidth, BorderWidth, Region.Height - BorderWidth * 2), 0xFFFFFFFF);
ESVideo::FillRectangle(Client, Colors::BackGround);
ESVideo::SetClip(Client);
std::string header = GetHeader();
if(!header.empty())
{
FontManager::GetBigFont()->PutString(header.c_str(), 1, 1, Colors::Normal, true);
ESVideo::FillRectangle(Area(0, FontManager::GetBigFont()->GetHeight() + 1, Client.Width, 1), 0xFFFFFFFF);
ESVideo::SetClip(Area(Client.X, Client.Y + FontManager::GetBigFont()->GetHeight() + 3, Client.Width, Client.Height - (FontManager::GetBigFont()->GetHeight() + 3)));
}
}
else
{
ESVideo::SetClip(Region);
}
return Draw();
}
示例14: GetHeader
SysStatus
MPMsgMgr::MsgSync::send(DispatcherID dspid)
{
MsgHeader *const hdr = GetHeader(this);
SysStatus rc;
MPMsgMgr *targetMgr;
rc = DREF(hdr->manager->getRegistry())->lookupMgr(dspid, targetMgr);
tassert(_SUCCESS(rc), err_printf("MPMsgAsync: lookupMgr failed.\n"));
hdr->sender = Scheduler::GetCurThread();
targetMgr->addPendingSend(hdr);
/*
* This is the trivial implementation, where we immediately block when
* sending a cross processor message. We have a more sophisticated
* algorithm which attempts to spin for a while and then blocks if
* information in the reply queue is not for us. FIXME, implement this
*/
while (hdr->sender != Scheduler::NullThreadID) {
Scheduler::Block();
}
/*
* With the message queue implementation, message returned is the same
* as message sent.
*/
return 0;
}
示例15: LOG_TRACE
// Return false if the tuple's table (tile group) is dropped.
// In such case, this recycled tuple can not be added to the recycled_list.
// Since no one will use it any more, keeping track of it is useless.
// Note that, if we drop a single tile group without dropping the whole table,
// such assumption is problematic.
bool GCManager::ResetTuple(const TupleMetadata &tuple_metadata) {
auto &manager = catalog::Manager::GetInstance();
auto tile_group = manager.GetTileGroup(tuple_metadata.tile_group_id);
// During the resetting, a table may deconstruct because of the DROP TABLE request
if (tile_group == nullptr) {
LOG_TRACE("Garbage tuple(%u, %u) in table %u no longer exists",
tuple_metadata.tile_group_id, tuple_metadata.tuple_slot_id,
tuple_metadata.table_id);
return false;
}
// From now on, the tile group shared pointer is held by us
// It's safe to set headers from now on.
auto tile_group_header = tile_group->GetHeader();
// Reset the header
tile_group_header->SetTransactionId(tuple_metadata.tuple_slot_id,
INVALID_TXN_ID);
tile_group_header->SetBeginCommitId(tuple_metadata.tuple_slot_id, MAX_CID);
tile_group_header->SetEndCommitId(tuple_metadata.tuple_slot_id, MAX_CID);
tile_group_header->SetPrevItemPointer(tuple_metadata.tuple_slot_id,
INVALID_ITEMPOINTER);
tile_group_header->SetNextItemPointer(tuple_metadata.tuple_slot_id,
INVALID_ITEMPOINTER);
PL_MEMSET(
tile_group_header->GetReservedFieldRef(tuple_metadata.tuple_slot_id), 0,
storage::TileGroupHeader::GetReservedSize());
LOG_TRACE("Garbage tuple(%u, %u) in table %u is reset",
tuple_metadata.tile_group_id, tuple_metadata.tuple_slot_id,
tuple_metadata.table_id);
return true;
}