本文整理汇总了C++中dispose函数的典型用法代码示例。如果您正苦于以下问题:C++ dispose函数的具体用法?C++ dispose怎么用?C++ dispose使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dispose函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: test_resize
void test_resize(){
ArrayUtil util = create(4, 5);
int * list_array = (int *)(util.base);
list_array[0] = 10;
list_array[1] = 20;
list_array[2] = 30;
list_array[3] = 40;
list_array[4] = 50;
assert(util.length == 5);
ArrayUtil resized_util = resize(util, 7);
assert(resized_util.length = 7);
int * resized_list_array = (int *)(resized_util.base);
assert(resized_list_array[4] == 50);
assert(resized_list_array[5] == 0);
assert(util.length == 5);
assert(list_array[4] == 50);
printf("Array element is not changed\n");
dispose(util);
}
开发者ID:PrasunPK,项目名称:C,代码行数:24,代码来源:array_utils_test.c
示例2: ev_vbuff_set_capacity
ev_err_t ev_vbuff_set_capacity(ev_vbuff *v, size_t num_bytes)
{
if( v && num_bytes ) {
if( v->size < num_bytes ) {
dispose(v);
}
glGenBuffers(1, &v->id);
if( !v->id )
return EV_FAIL;
ev_vbuff_bind(v);
v->buff = ev_malloc(num_bytes);
if(!v->buff)
return EV_NOMEM;
memset(v->buff, 0, num_bytes);
glBufferData( GL_ARRAY_BUFFER, num_bytes, v->buff, GL_DYNAMIC_DRAW);
v->size = num_bytes;
return EV_OK;
}
return EV_FAIL;
}
开发者ID:ibawt,项目名称:ev,代码行数:24,代码来源:vertex_buffer.c
示例3: SiegeThrow
void AspModel::initFromFile(std::string filename, const uint32_t importFlags)
{
if (filename.empty())
{
SiegeThrow(Exception, "No filename provided for AspModel::initFromFile()!");
}
std::ifstream file;
if (!utils::filesys::tryOpen(file, filename, std::ifstream::binary))
{
SiegeThrow(Exception, "Failed to open ASP file \""
<< filename << "\": '" << utils::filesys::getLastFileError() << "'.");
}
size_t fileSizeBytes = 0;
utils::filesys::queryFileSize(filename, fileSizeBytes);
if (fileSizeBytes == 0)
{
SiegeWarn("ASP file \"" << filename << "\" appears to be empty...");
// Make this an empty model.
// NOTE: Should this be changed to an error instead?
dispose();
srcFileName = std::move(filename);
return;
}
ByteArray fileContents(fileSizeBytes);
if (!file.read(reinterpret_cast<char *>(fileContents.data()), fileContents.size()))
{
SiegeThrow(Exception, "Failed to read " << utils::formatMemoryUnit(fileContents.size())
<< " from ASP mode file \"" << filename << "\"!");
}
initFromMemory(std::move(fileContents), importFlags, std::move(filename));
}
开发者ID:glampert,项目名称:reverse-engineering-dungeon-siege,代码行数:36,代码来源:asp_model.cpp
示例4: set_ttydev
static int set_ttydev(struct cfgdata_t *cfgdata, char *value)
{
const char str_dev[] = "/dev/";
char *p;
/* Check value for 'tty[0-9]' */
if ( ! ( ('t' == value[0]) && ('t' == value[1]) && ('y' == value[2]) &&
(value[3] > '0') && (value[3] < '9') )
) return 0;
/* Prepend '/dev/' to tty name (value) */
p = malloc(sizeof(str_dev)+strlen(value));
if (NULL == p) {
DPRINTF("Can't allocate memory to store tty device name '/dev/%s'", value);
return -1;
}
dispose(cfgdata->ttydev);
cfgdata->ttydev = p;
strcpy(cfgdata->ttydev, str_dev);
strcat(cfgdata->ttydev, value);
return 0;
}
开发者ID:EnJens,项目名称:kexecboot,代码行数:24,代码来源:cfgparser.c
示例5: dispose
CL_GL1FrameBufferProvider::~CL_GL1FrameBufferProvider()
{
dispose();
CL_SharedGCData::remove_disposable(this);
}
开发者ID:PaulFSherwood,项目名称:cplusplus,代码行数:5,代码来源:gl1_frame_buffer_provider.cpp
示例6: dispose
DocumentSourceCursor::~DocumentSourceCursor() {
dispose();
}
开发者ID:Krolcom,项目名称:mongo,代码行数:3,代码来源:document_source_cursor.cpp
示例7: dispose
MWInfoPage::~MWInfoPage()
{
dispose();
}
开发者ID:Alasaad,项目名称:Desurium,代码行数:4,代码来源:ModWizardInfoPage.cpp
示例8: dispose
WorkerContextExecutionProxy::~WorkerContextExecutionProxy()
{
dispose();
}
开发者ID:325116067,项目名称:semc-qsd8x50,代码行数:4,代码来源:WorkerContextExecutionProxy.cpp
示例9: dispose
Viewport::~Viewport()
{
dispose();
}
开发者ID:Alex223124,项目名称:mkxp,代码行数:4,代码来源:viewport.cpp
示例10:
virtual ~MPSegment(){dispose();};
开发者ID:fc13240,项目名称:cppjieba,代码行数:1,代码来源:MPSegment.hpp
示例11: dispose
SpatialReference::~SpatialReference()
{
dispose();
}
开发者ID:drownedout,项目名称:datamap,代码行数:4,代码来源:gdal_spatial_reference.cpp
示例12: dispose
InputDeviceProvider_Win32Hid::~InputDeviceProvider_Win32Hid()
{
dispose();
}
开发者ID:ArtHome12,项目名称:ClanLib,代码行数:4,代码来源:input_device_provider_win32hid.cpp
示例13: dispose
SpriteNumber::~SpriteNumber(){
dispose();
}
开发者ID:pjc0247,项目名称:Cppie,代码行数:3,代码来源:SpriteNumber.cpp
示例14: Send_new_packets
/* ### Pack: this routine has changed */
static int Send_new_packets( int num_allowed )
{
packet_header *pack_ptr;
scatter *scat_ptr;
int pack_entry;
int num_sent;
int ret;
num_sent = 0;
while( num_sent < num_allowed )
{
/* check if down queue is empty */
if( Down_queue_ptr->num_mess == 0 ) break;
/* initialize packet_header */
pack_ptr = new(PACK_HEAD_OBJ);
scat_ptr = Down_queue_ptr->first->mess;
pack_ptr->type = Down_queue_ptr->first->type;
pack_ptr->proc_id = My.id;
pack_ptr->memb_id = Memb_id();
pack_ptr->seq = Highest_seq+1;
Highest_seq++;
pack_ptr->fifo_seq = Highest_fifo_seq+1;
Highest_fifo_seq++;
pack_ptr->data_len = scat_ptr->elements[
Down_queue_ptr->cur_element].len;
Send_pack.elements[1].buf = scat_ptr->elements[
Down_queue_ptr->cur_element].buf;
Down_queue_ptr->cur_element++;
if( Down_queue_ptr->cur_element < scat_ptr->num_elements )
{
/* not last packet in message */
pack_ptr->packet_index = Down_queue_ptr->cur_element;
}else if( Down_queue_ptr->cur_element == scat_ptr->num_elements ){
down_link *tmp_down;
/* last packet in message */
pack_ptr->packet_index = -scat_ptr->num_elements;
tmp_down = Down_queue_ptr->first;
Down_queue_ptr->first = Down_queue_ptr->first->next;
Down_queue_ptr->cur_element = 0;
Down_queue_ptr->num_mess--;
dispose( tmp_down->mess );
dispose( tmp_down );
if( Down_queue_ptr->num_mess < WATER_MARK )
Sess_unblock_users_level();
}else{
Alarm( EXIT,
"Send_new_packets: error in packet index: %d %d\n",
Down_queue_ptr->cur_element,scat_ptr->num_elements );
}
Send_pack.elements[0].buf = (char *) pack_ptr;
Send_pack.elements[1].len = pack_ptr->data_len;
#if 1
ret = Net_queue_bcast( &Send_pack );
#else
ret = Net_bcast( &Send_pack );
#endif
if( ret > 0 )
{
num_sent++;
}
pack_entry = pack_ptr->seq & PACKET_MASK;
if( Packets[pack_entry].exist )
Alarm( EXIT,
"Send_new_packets: created packet %d already exist %d\n",
pack_ptr->seq, Packets[pack_entry].exist );
/* insert new created packet */
Packets[pack_entry].head = pack_ptr;
Packets[pack_entry].body = (packet_body *)Send_pack.elements[1].buf;
Packets[pack_entry].exist = 1;
Packets[pack_entry].proc_index = My_index;
Alarm( PROTOCOL,
"Send_new_packets: packet %d sent and inserted \n",
pack_ptr->seq );
}
ret = Net_flush_bcast();
if( ret > 0 )
{
num_sent++;
}
return ( num_sent );
}
开发者ID:liyu1981,项目名称:postgresql-r-hack,代码行数:93,代码来源:protocol.c
示例15: Prot_handle_token
//.........这里部分代码省略.........
{
Token->aru = My_aru;
Token->aru_last_id = My.id;
if( My_aru < Highest_seq ) Set_aru = My_aru;
else Set_aru = -1;
}else if( Token->aru > My_aru ) {
Token->aru = My_aru;
Token->aru_last_id = My.id;
Set_aru = My_aru;
}else{
Set_aru = -1;
}
Token->proc_id = My.id;
if( Memb_state() != EVS ) Token->seq = Highest_seq;
if( Conf_leader( Memb_active_ptr() ) == My.id )
{
val = Get_arq( Token->type );
val = (val + 1)% 0x10;
Token->type = Set_arq( Token->type, val );
Token->type = Set_retrans( Token->type, 0 );
}
/* Send token */
if( ! ( Conf_leader( Memb_active_ptr() ) == My.id &&
To_hold_token() ) )
{
/* sending token */
Net_send_token( &New_token );
/* ### Bug fix for SGIs */
#ifdef ARCH_SGI_IRIX
Net_send_token( &New_token );
#endif /* ARCH_SGI_IRIX */
if( Get_retrans( Token->type ) > 1 )
{
/* problems */
Net_send_token( &New_token );
Net_send_token( &New_token );
}
}
Token_rounds++;
if( Conf_leader( Memb_active_ptr() ) == My.id )
E_queue( Prot_token_hurry, 0, NULL, Hurry_timeout );
E_queue( Memb_token_loss, 0, NULL, Token_timeout );
/* calculating Aru */
if( Token->aru > Last_token->aru )
Aru = Last_token->aru;
else
Aru = Token->aru;
if( Highest_seq == Aru ) Token_counter++;
else Token_counter = 0;
dispose( Last_token );
Last_token = Token;
New_token.elements[0].buf = (char *) new(TOKEN_HEAD_OBJ);
New_token.elements[1].len = sizeof(token_body);
Token = (token_header *)New_token.elements[0].buf;
/* Deliver & discard packets */
Discard_packets();
Deliver_agreed_packets();
Deliver_reliable_packets( Highest_seq-num_sent+1, num_sent );
if( Memb_state() == EVS && Token_rounds > MAX_EVS_ROUNDS )
{
Alarmp( SPLOG_ERROR, PRINT, "Prot_handle_token: BUG WORKAROUND: Too many rounds in EVS state; swallowing token; state:\n" );
Alarmp( SPLOG_ERROR, PRINT, "\tAru: %d\n", Aru );
Alarmp( SPLOG_ERROR, PRINT, "\tMy_aru: %d\n", My_aru );
Alarmp( SPLOG_ERROR, PRINT, "\tHighest_seq: %d\n", Highest_seq );
Alarmp( SPLOG_ERROR, PRINT, "\tHighest_fifo_seq: %d\n", Highest_fifo_seq );
Alarmp( SPLOG_ERROR, PRINT, "\tLast_discarded: %d\n", Last_discarded );
Alarmp( SPLOG_ERROR, PRINT, "\tLast_delivered: %d\n", Last_delivered );
Alarmp( SPLOG_ERROR, PRINT, "\tLast_seq: %d\n", Last_seq );
Alarmp( SPLOG_ERROR, PRINT, "\tToken_rounds: %d\n", Token_rounds );
Alarmp( SPLOG_ERROR, PRINT, "Last Token:\n" );
Alarmp( SPLOG_ERROR, PRINT, "\ttype: 0x%x\n", Last_token->type );
Alarmp( SPLOG_ERROR, PRINT, "\ttransmiter_id: %d\n", Last_token->transmiter_id );
Alarmp( SPLOG_ERROR, PRINT, "\tseq: %d\n", Last_token->seq );
Alarmp( SPLOG_ERROR, PRINT, "\tproc_id: %d\n", Last_token->proc_id );
Alarmp( SPLOG_ERROR, PRINT, "\taru: %d\n", Last_token->aru );
Alarmp( SPLOG_ERROR, PRINT, "\taru_last_id: %d\n", Last_token->aru_last_id );
Alarmp( SPLOG_ERROR, PRINT, "\tflow_control: %d\n", Last_token->flow_control );
Alarmp( SPLOG_ERROR, PRINT, "\trtr_len: %d\n", Last_token->rtr_len );
Alarmp( SPLOG_ERROR, PRINT, "\tconf_hash: %d\n", Last_token->conf_hash );
Memb_token_loss();
}
GlobalStatus.highest_seq = Highest_seq;
GlobalStatus.aru = Aru;
GlobalStatus.token_rounds = Token_rounds;
}
开发者ID:liyu1981,项目名称:postgresql-r-hack,代码行数:101,代码来源:protocol.c
示例16: keyboard
void keyboard(uchar key, int x, int y){
if(key == 'q'){
dispose();
exit(0);
}
}
开发者ID:domitry,项目名称:exp_c,代码行数:6,代码来源:ex63.c
示例17: teardown
void teardown(){
dispose(queue);
}
开发者ID:samiksha123,项目名称:DSA,代码行数:3,代码来源:queueTest.c
示例18: dispose
Window::~Window()
{
if (valid())
dispose();
}
开发者ID:kjk,项目名称:ars-framework,代码行数:5,代码来源:Window.cpp
示例19:
PacketManager::~PacketManager()
{
if(!_disposing) dispose();
if(_workerThread.joinable()) _workerThread.join();
}
开发者ID:marerh,项目名称:Homegear,代码行数:5,代码来源:PacketManager.cpp
示例20: dispose
MemoryHeapBase::~MemoryHeapBase()
{
dispose();
}
开发者ID:triphop,项目名称:AndroidDemo,代码行数:4,代码来源:MemoryHeapBase.cpp
注:本文中的dispose函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论