static void _testDeliveryRetry(CIMClient &client) { try { cout << "Testing DeliveryRetry functionality..." << endl; _setup(client); _resetIdentfier(client); _testIndicationsWithListenerRunning(client); #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT _testIndicationsWithListenerNotRunning(client); // Run again the same test, this time SequenceNumber should change cout << "Test listener with next sequence ID..." << endl; _testIndicationsWithListenerNotRunning(client); _testRetryAttemptsExceededIndications(client); #endif _cleanup(client); #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT // There should not be any queues after cleanup Array<CIMInstance> queues = _getDestinationQueues(client); PEGASUS_TEST_ASSERT(queues.size() == 0); #endif } catch (Exception& e) { cerr << "Error: " << e.getMessage() << endl; exit(1); } }
void CapsuleShapeSW::set_data(const Variant &p_data) { Dictionary d = p_data; ERR_FAIL_COND(!d.has("radius")); ERR_FAIL_COND(!d.has("height")); _setup(d["height"], d["radius"]); }
void ipmi_ping_setup(int argc, char **argv, unsigned int min_sequence_number, unsigned int max_sequence_number, char *options) { char *valid_options = "hVciItvrsd:"; char *ptr; char c; if (argc <= 0 || !argv || !options) { fprintf(stderr, "ipmi_ping_setup: called improperly\n"); exit(1); } /* Check for valid options */ ptr = options; while ((c = *ptr)) { if (!strchr(valid_options, c)) { fprintf(stderr, "ipmi_ping_setup: invalid options listed"); exit(1); } ptr++; } _err_init(argv[0]); _cmdline_parse(argc, argv, min_sequence_number, max_sequence_number, options); _setup(); }
void ipmi_ping_setup (int argc, char **argv, unsigned int min_sequence_number, unsigned int max_sequence_number, const char *options) { char *valid_options = "hVciItvrsd:"; char *ptr; char c; assert (argc >= 0); assert (argv); assert (options); /* Check for valid options */ ptr = (char *)options; while ((c = *ptr)) { if (!strchr (valid_options, c)) { fprintf (stderr, "ipmi_ping_setup: invalid options listed"); exit (EXIT_FAILURE); } ptr++; } _err_init (argv[0]); _cmdline_parse (argc, argv, min_sequence_number, max_sequence_number, options); _setup (); }
void BunBunApplication::go(){ try { _setup(); mRoot->startRendering(); destroyScene(); } catch( Ogre::Exception& e ) { MessageBox( NULL, e.getFullDescription().c_str(), "An exception has occured!", MB_OK | MB_ICONERROR | MB_TASKMODAL); } }
GameClient::GameClient(string host, int port) :m_szHost(host), m_nPort(port) { #ifdef WIN32 WSADATA wsaData; WSAStartup(MAKEWORD(2,2),&wsaData); #endif _setup(); }
int _test(CIMClient& client, const char* opt, String& qlang) { if (String::equalNoCase (opt, "setup")) { _setup (client, qlang); } else if (String::equalNoCase (opt, "setup2")) { _setup2 (client, qlang); } else if (String::equalNoCase (opt, "create")) { _create (client); } else if (String::equalNoCase (opt, "create2")) { _create2 (client); } else if (String::equalNoCase (opt, "sendSucceed")) { _sendSucceed (client); } else if (String::equalNoCase (opt, "sendFail")) { _sendFail (client); } else if (String::equalNoCase (opt, "sendBlock")) { _sendBlock (client); } else if (String::equalNoCase (opt, "delete")) { _delete (client); } else if (String::equalNoCase (opt, "delete2")) { _delete2 (client); } else if (String::equalNoCase (opt, "cleanup")) { _cleanup (client); } else if (String::equalNoCase (opt, "cleanup2")) { _cleanup2 (client); } else { PEGASUS_STD (cerr) << "Invalid option: " << opt << PEGASUS_STD (endl); _usage (); return -1; } return 0; }
virtual void play() { _THREAD_SAFE_METHOD_ _setup(channels, freq, 256); stream_rid=AudioServer::get_singleton()->audio_stream_create(get_audio_stream()); AudioServer::get_singleton()->stream_set_active(stream_rid,true); AudioServer::get_singleton()->stream_set_volume_scale(stream_rid,1); playing = true; paused = false; };
//-------------------------------------------------------------- // pass in floats for delay and duration as seconds // Tween::Tween(float* a_property, int a_millis, float a_begin, float a_end, float a_delay, float a_duration, int a_easeType, float a_p, float a_a) { _useSeconds = true; // convert seconds to millis // a_delay = a_delay * 1000.f; a_duration = a_duration * 1000.f; _startTime = a_millis; _time = 0.f; _setup(a_property, a_begin, a_end, a_delay, a_duration, a_easeType, a_p, a_a); }
void CrossDelegate::performSetup() { if (!setup_ && initialized_) { _setup(); // --- setup_ = true; } }
int shell_loop(char * line, char cmd[255][255]) { _setup(cmd); _prompt(); if(_read(line)){ _parse(line, cmd); if (exec) _execute(cmd); } else { run = 0; } return 0; }
template<typename VALUE_T>bool Document_t<VALUE_T>::_new(const countbase_t *cbase) { nnodes = cbase->nnodes; szstrings = cbase->szstrings; uint32_t total_size = sizeof(header_t) + nnodes; if (total_size % sizeof(VALUE_T) > 0) total_size += sizeof(VALUE_T) - total_size % sizeof(VALUE_T); total_size += nnodes * sizeof(VALUE_T) + szstrings; body = (header_t *)malloc(total_size); if (body == NULL) return false; body->setup(VALUE_T().magic(), nnodes); _setup(); return true; }
void AccumBufferObject::accum( const GLfloat value ) { _texture->copyFromFrameBuffer( _texture->getInternalFormat(), _pvp ); const PixelViewport pvp( 0, 0, getWidth(), getHeight( )); _setup( pvp ); EQ_GL_CALL( glEnable( GL_BLEND )); EQ_GL_CALL( glBlendFunc( GL_ONE, GL_ONE )); _drawQuadWithTexture( _texture, pvp, value ); EQ_GL_CALL( glBlendFunc( GL_ONE, GL_ZERO )); EQ_GL_CALL( glDisable( GL_BLEND )); _reset(); }
MetisTlvName * metisTlvName_Create(const uint8_t *memory, size_t memoryLength) { MetisTlvName *name = parcMemory_AllocateAndClear(sizeof(MetisTlvName)); assertNotNull(name, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(MetisTlvName)); name->memory = parcMemory_Allocate(memoryLength); assertNotNull(name->memory, "parcMemory_Allocate(%zu) returned NULL", memoryLength); memcpy(name->memory, memory, memoryLength); name->memoryLength = memoryLength; _setup(name); return name; }
MetisTlvName * metisTlvName_CreateFromCCNxName(const CCNxName *ccnxName) { // to avoid reallocs, calculate the exact size we need size_t memoryLength = 0; for (size_t i = 0; i < ccnxName_GetSegmentCount(ccnxName); i++) { CCNxNameSegment *segment = ccnxName_GetSegment(ccnxName, i); memoryLength += 4 + ccnxNameSegment_Length(segment); } MetisTlvName *name = parcMemory_AllocateAndClear(sizeof(MetisTlvName)); assertNotNull(name, "parcMemory_AllocateAndClear(%zu) returned NULL", sizeof(MetisTlvName)); name->memoryLength = memoryLength; name->memory = parcMemory_Allocate(memoryLength); assertNotNull(name->memory, "parcMemory_Allocate(%zu) returned NULL", memoryLength); uint8_t *p = name->memory; uint8_t *end = p + memoryLength; for (size_t i = 0; i < ccnxName_GetSegmentCount(ccnxName); i++) { CCNxNameSegment *segment = ccnxName_GetSegment(ccnxName, i); uint16_t type = ccnxNameSegment_GetType(segment); uint16_t length = ccnxNameSegment_Length(segment); *(uint16_t *) p = htons(type); p += 2; *(uint16_t *) p = htons(length); p += 2; if (length >0) { PARCBuffer *buffer = ccnxNameSegment_GetValue(segment); uint8_t *overlay = parcBuffer_Overlay(buffer, 0); memcpy(p, overlay, length); p += length; } // sanity check assertTrue(p <= end, "Wrote past the end of buffer, now at %p end at %p", p, end); } _setup(name); return name; }
int main(int argc, char **argv) { _setup(); _test_persist_name(); _test_stats_name(); _test_uri_correct(); _test_uri_error(); #if SYSLOG_NG_ENABLE_LEGACY_MONGODB_OPTIONS _test_legacy_correct(); _test_legacy_error(); #endif _teardown(); return _tests_failed; }
void HeightMapShapeSW::set_data(const Variant &p_data) { ERR_FAIL_COND(p_data.get_type() != Variant::DICTIONARY); Dictionary d = p_data; ERR_FAIL_COND(!d.has("width")); ERR_FAIL_COND(!d.has("depth")); ERR_FAIL_COND(!d.has("cell_size")); ERR_FAIL_COND(!d.has("heights")); int width = d["width"]; int depth = d["depth"]; real_t cell_size = d["cell_size"]; PoolVector<real_t> heights = d["heights"]; ERR_FAIL_COND(width <= 0); ERR_FAIL_COND(depth <= 0); ERR_FAIL_COND(cell_size <= CMP_EPSILON); ERR_FAIL_COND(heights.size() != (width * depth)); _setup(heights, width, depth, cell_size); }
int ili9340_init(void) { int i; bcm2835_spi_begin(); bcm2835_spi_setDataMode(BCM2835_SPI_MODE0); bcm2835_spi_setClockDivider(8); bcm2835_spi_chipSelect(BCM2835_SPI_CS0); bcm2835_spi_setChipSelectPolarity(BCM2835_SPI_CS0, LOW); _reset(); _setup(); uint32_t *p = (uint32_t *)buffer; for (i = 0; i < sizeof(buffer) / sizeof(buffer[0] / 2); i++) { *p++ = cur_back << 16 | cur_back; } ili9340_clear(); return 0; }
void AccumBufferObject::load( const GLfloat value ) { EQ_GL_ERROR( "before AccumBufferObject::load" ); _texture->copyFromFrameBuffer( _texture->getInternalFormat(), _pvp ); const PixelViewport pvp( 0, 0, getWidth(), getHeight( )); _setup( pvp ); _drawQuadWithTexture( _texture, pvp, value ); _reset(); EQ_GL_ERROR( "after AccumBufferObject::load" ); #if 0 static a_int32_t i; std::ostringstream os; os << "abo" << ++i; getColorTextures()[0]->writeRGB( os.str( )); os << "tex"; _texture->writeRGB( os.str( )); #endif }
void FNAME(void) { ui_func_set(_key, _loop); _setup(); }
void ConvexPolygonShapeSW::set_data(const Variant& p_data) { _setup(p_data); }
void BoxShapeSW::set_data(const Variant& p_data) { _setup(p_data); }
void SphereShapeSW::set_data(const Variant& p_data) { _setup(p_data); }
void PlaneShapeSW::set_data(const Variant& p_data) { _setup(p_data); }
//-------------------------------------------------------------- // pass in ints for delay and duration as number of frames // Tween::Tween(float* a_property, float a_begin, float a_end, int a_delay, int a_duration, int a_easeType, float a_p, float a_a) { _useSeconds = false; _time = 0.f; _setup(a_property, a_begin, a_end, (float)a_delay, (float)a_duration, a_easeType, a_p, a_a); }
static void setup(void) { _setup(HDFS_NN_v1); }
void resetOutputSampleRate(double sampleRate) { _setup(sampleRate); }
void VideoStreamTheora::set_file(const String& p_file) { ogg_packet op; th_setup_info *ts = NULL; file_name = p_file; if (file) { memdelete(file); } file = FileAccess::open(p_file, FileAccess::READ); ERR_FAIL_COND(!file); audio_frames_wrote = 0; ogg_sync_init(&oy); /* init supporting Vorbis structures needed in header parsing */ vorbis_info_init(&vi); vorbis_comment_init(&vc); /* init supporting Theora structures needed in header parsing */ th_comment_init(&tc); th_info_init(&ti); /* Ogg file open; parse the headers */ /* Only interested in Vorbis/Theora streams */ int stateflag = 0; while(!stateflag){ int ret=buffer_data(); if(ret==0)break; while(ogg_sync_pageout(&oy,&og)>0){ ogg_stream_state test; /* is this a mandated initial header? If not, stop parsing */ if(!ogg_page_bos(&og)){ /* don't leak the page; get it into the appropriate stream */ queue_page(&og); stateflag=1; break; } ogg_stream_init(&test,ogg_page_serialno(&og)); ogg_stream_pagein(&test,&og); ogg_stream_packetout(&test,&op); /* identify the codec: try theora */ if(!theora_p && th_decode_headerin(&ti,&tc,&ts,&op)>=0){ /* it is theora */ copymem(&to,&test,sizeof(test)); theora_p=1; }else if(!vorbis_p && vorbis_synthesis_headerin(&vi,&vc,&op)>=0){ /* it is vorbis */ copymem(&vo,&test,sizeof(test)); vorbis_p=1; }else{ /* whatever it is, we don't care about it */ ogg_stream_clear(&test); } } /* fall through to non-bos page parsing */ } /* we're expecting more header packets. */ while((theora_p && theora_p<3) || (vorbis_p && vorbis_p<3)){ int ret; /* look for further theora headers */ while(theora_p && (theora_p<3) && (ret=ogg_stream_packetout(&to,&op))){ if(ret<0){ fprintf(stderr,"Error parsing Theora stream headers; " "corrupt stream?\n"); clear(); return; } if(!th_decode_headerin(&ti,&tc,&ts,&op)){ fprintf(stderr,"Error parsing Theora stream headers; " "corrupt stream?\n"); clear(); return; } theora_p++; } /* look for more vorbis header packets */ while(vorbis_p && (vorbis_p<3) && (ret=ogg_stream_packetout(&vo,&op))){ if(ret<0){ fprintf(stderr,"Error parsing Vorbis stream headers; corrupt stream?\n"); clear(); return; } ret = vorbis_synthesis_headerin(&vi,&vc,&op); if(ret){ fprintf(stderr,"Error parsing Vorbis stream headers; corrupt stream?\n"); clear(); return; } vorbis_p++; if(vorbis_p==3)break; } /* The header pages/packets will arrive before anything else we care about, or the stream is not obeying spec */ if(ogg_sync_pageout(&oy,&og)>0){ queue_page(&og); /* demux into the appropriate stream */ }else{ int ret=buffer_data(); /* someone needs more data */ if(ret==0){ fprintf(stderr,"End of file while searching for codec headers.\n"); clear(); return; } } } /* and now we have it all. initialize decoders */ if(theora_p){ td=th_decode_alloc(&ti,ts); printf("Ogg logical stream %lx is Theora %dx%d %.02f fps", to.serialno,ti.pic_width,ti.pic_height, (double)ti.fps_numerator/ti.fps_denominator); px_fmt=ti.pixel_fmt; switch(ti.pixel_fmt){ case TH_PF_420: printf(" 4:2:0 video\n"); break; case TH_PF_422: printf(" 4:2:2 video\n"); break; case TH_PF_444: printf(" 4:4:4 video\n"); break; case TH_PF_RSVD: default: printf(" video\n (UNKNOWN Chroma sampling!)\n"); break; } if(ti.pic_width!=ti.frame_width || ti.pic_height!=ti.frame_height) printf(" Frame content is %dx%d with offset (%d,%d).\n", ti.frame_width, ti.frame_height, ti.pic_x, ti.pic_y); th_decode_ctl(td,TH_DECCTL_GET_PPLEVEL_MAX,&pp_level_max, sizeof(pp_level_max)); pp_level=pp_level_max; th_decode_ctl(td,TH_DECCTL_SET_PPLEVEL,&pp_level,sizeof(pp_level)); pp_inc=0; /*{ int arg = 0xffff; th_decode_ctl(td,TH_DECCTL_SET_TELEMETRY_MBMODE,&arg,sizeof(arg)); th_decode_ctl(td,TH_DECCTL_SET_TELEMETRY_MV,&arg,sizeof(arg)); th_decode_ctl(td,TH_DECCTL_SET_TELEMETRY_QI,&arg,sizeof(arg)); arg=10; th_decode_ctl(td,TH_DECCTL_SET_TELEMETRY_BITS,&arg,sizeof(arg)); }*/ int w; int h; w=(ti.pic_x+ti.frame_width+1&~1)-(ti.pic_x&~1); h=(ti.pic_y+ti.frame_height+1&~1)-(ti.pic_y&~1); size.x = w; size.y = h; }else{ /* tear down the partial theora setup */ th_info_clear(&ti); th_comment_clear(&tc); } th_setup_free(ts); if(vorbis_p){ vorbis_synthesis_init(&vd,&vi); vorbis_block_init(&vd,&vb); fprintf(stderr,"Ogg logical stream %lx is Vorbis %d channel %ld Hz audio.\n", vo.serialno,vi.channels,vi.rate); _setup(vi.channels, vi.rate); }else{ /* tear down the partial vorbis setup */ vorbis_info_clear(&vi); vorbis_comment_clear(&vc); } playing = false; buffering=true; time=0; };
void procmonitor_t::work() { if (*&_state==CPS_NOTSET) _setup(_interval_sec); assert (*&_state!=CPS_NOTSET); // Hook case_setup(); eCPS astate = *&_state; int error = 0; struct timespec start; pthread_mutex_lock(&_mutex); clock_gettime(CLOCK_REALTIME, &start); struct timespec ts = start; static long const BILLION = 1000*1000*1000; while (true) { astate = *&_state; switch (astate) { case (CPS_RUNNING): case (CPS_PAUSE): // PAUSE behaves like RUNNING, but without recording data // Hook case_tick(); print_interval(); // Update secs/usecs ts = start; ts.tv_nsec += _interval_usec*1000; if(ts.tv_nsec > BILLION) { ts.tv_nsec -= BILLION; ts.tv_sec++; } // sleep periodically until next measurement while(true) { error = pthread_cond_timedwait(&_cond, &_mutex, &ts); clock_gettime(CLOCK_REALTIME, &start); if(start.tv_sec > ts.tv_sec || (start.tv_sec == ts.tv_sec && start.tv_nsec > ts.tv_nsec)) break; } start = ts; break; case (CPS_RESET): // Hook case_reset(); // clear _total_usage = 0; _num_usage_readings = 0; _avg_usage = 0; _state = CPS_RUNNING; break; case (CPS_STOP): // Hook case_stop(); return; case (CPS_NOTSET): default: assert(0); // invalid value break; } } }
static void setup22(void) { _setup(HDFS_NN_v2_2); }