• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ OK函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中OK函数的典型用法代码示例。如果您正苦于以下问题:C++ OK函数的具体用法?C++ OK怎么用?C++ OK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了OK函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: getCurrentSourceIndex

    int getCurrentSourceIndex (bool input) const
    {
        OSType currentSourceID = 0;
        UInt32 size = sizeof (currentSourceID);
        int result = -1;

        AudioObjectPropertyAddress pa;
        pa.mSelector = kAudioDevicePropertyDataSource;
        pa.mScope = input ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput;
        pa.mElement = kAudioObjectPropertyElementMaster;

        if (deviceID != 0)
        {
            if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, 0, &size, &currentSourceID)))
            {
                HeapBlock <OSType> types;
                const int num = getAllDataSourcesForDevice (deviceID, types);

                for (int i = 0; i < num; ++i)
                {
                    if (types[num] == currentSourceID)
                    {
                        result = i;
                        break;
                    }
                }
            }
        }

        return result;
    }
开发者ID:AndyBrown91,项目名称:JuceMonome,代码行数:31,代码来源:juce_mac_CoreAudio.cpp


示例2: TEST_F

TEST_F(MesosSchedulerDriverTest, MetricsEndpoint)
{
  Try<Owned<cluster::Master>> master = StartMaster();
  ASSERT_SOME(master);

  MockScheduler sched;
  MesosSchedulerDriver driver(
      &sched, DEFAULT_FRAMEWORK_INFO, master.get()->pid, DEFAULT_CREDENTIAL);

  Future<Nothing> registered;
  EXPECT_CALL(sched, registered(&driver, _, _))
    .WillOnce(FutureSatisfy(&registered));

  ASSERT_EQ(DRIVER_RUNNING, driver.start());

  AWAIT_READY(registered);

  Future<process::http::Response> response =
    process::http::get(process::metrics::internal::metrics, "snapshot");

  AWAIT_EXPECT_RESPONSE_STATUS_EQ(OK().status, response);
  AWAIT_EXPECT_RESPONSE_HEADER_EQ(APPLICATION_JSON, "Content-Type", response);

  Try<JSON::Object> parse = JSON::parse<JSON::Object>(response->body);

  ASSERT_SOME(parse);

  JSON::Object metrics = parse.get();

  EXPECT_EQ(1u, metrics.values.count("scheduler/event_queue_messages"));
  EXPECT_EQ(1u, metrics.values.count("scheduler/event_queue_dispatches"));

  driver.stop();
  driver.join();
}
开发者ID:ChrisPaprocki,项目名称:mesos,代码行数:35,代码来源:scheduler_driver_tests.cpp


示例3: getSources

    //==============================================================================
    StringArray getSources (bool input)
    {
        StringArray s;
        HeapBlock <OSType> types;
        const int num = getAllDataSourcesForDevice (deviceID, types);

        for (int i = 0; i < num; ++i)
        {
            AudioValueTranslation avt;
            char buffer[256];

            avt.mInputData = &(types[i]);
            avt.mInputDataSize = sizeof (UInt32);
            avt.mOutputData = buffer;
            avt.mOutputDataSize = 256;

            UInt32 transSize = sizeof (avt);

            AudioObjectPropertyAddress pa;
            pa.mSelector = kAudioDevicePropertyDataSourceNameForID;
            pa.mScope = input ? kAudioDevicePropertyScopeInput : kAudioDevicePropertyScopeOutput;
            pa.mElement = kAudioObjectPropertyElementMaster;

            if (OK (AudioObjectGetPropertyData (deviceID, &pa, 0, 0, &transSize, &avt)))
            {
                DBG (buffer);
                s.add (buffer);
            }
        }

        return s;
    }
开发者ID:AndyBrown91,项目名称:JuceMonome,代码行数:33,代码来源:juce_mac_CoreAudio.cpp


示例4: cxn_msg_rx

static void
cxn_msg_rx(indigo_cxn_id_t cxn_id, of_object_t *obj)
{
    printf("Got msg from %d: type %d\n", cxn_id, obj->object_id);

    /* Just respond to echo request */
    if (obj->object_id == OF_ECHO_REQUEST) {
        of_echo_request_t *echo;
        of_echo_reply_t *reply;
        of_octets_t data;
        uint32_t xid;

        echo = (of_echo_request_t *)obj;
        of_echo_request_xid_get(echo, &xid);
        printf("Respond to echo with xid 0x%x\n", xid);
        if ((reply = of_echo_reply_new(echo->version)) == NULL) {
            printf("Could not allocate echo response obj\n");
            goto done;
        }

        of_echo_request_data_get(echo, &data);
        if (data.bytes) {
            OK(of_echo_reply_data_set(reply, &data));
        }

        of_echo_reply_xid_set(reply, xid);

        indigo_cxn_send_controller_message(cxn_id, reply);
    }

 done:
    of_object_delete(obj);
    got_cxn_msg = 1;
}
开发者ID:Sovietaced,项目名称:indigo,代码行数:34,代码来源:main.c


示例5: Enable

bool CShaderProgram::Enable()
{
  if (OK())
  {
    glUseProgram(m_shaderProgram);
    if (OnEnabled())
    {
      if (!m_validated)
      {
        // validate the program
        GLint params[4];
        glValidateProgram(m_shaderProgram);
        glGetProgramiv(m_shaderProgram, GL_VALIDATE_STATUS, params);
        if (params[0] != GL_TRUE)
        {
          GLchar log[LOG_SIZE];
          kodi::Log(ADDON_LOG_ERROR, "GL: Error validating shader");
          glGetProgramInfoLog(m_shaderProgram, LOG_SIZE, nullptr, log);
          kodi::Log(ADDON_LOG_ERROR, "%s", log);
        }
        m_validated = true;
      }
      return true;
    }
    else
    {
      glUseProgram(0);
      return false;
    }
    return true;
  }
  return false;
}
开发者ID:notspiff,项目名称:screensaver.asteroids,代码行数:33,代码来源:Shader.cpp


示例6: m_filename

cRamp::cRamp( const char* fileName,bool declaredScansOnly ) : 
  m_filename(fileName), m_declaredScansOnly(declaredScansOnly), m_runInfo()
{
   m_handle = rampOpenFile(fileName);
   m_scanOffsets = NULL;
   m_runInfo = NULL;
   m_lastScan = 0;   
   if (!OK()) {
     // HENRY -- I would prefer this to be silent, and let the caller deals with it
     // cout << "Error: Could not open file " << fileName << ": " << strerror(errno) << endl;
     // END HENRY
   } else {

      m_runInfo = getRunInfo();

      // HENRY -- always read index to set scan count, since scan count
      // declared at the top of the mzXML file is unreliable now that
      // there are missing scans.
      // This will also set the structs m_scanOffsets, and the value m_lastScan
      
      //      if (m_runInfo->m_data.scanCount < 0) { // undeclared scan count
         // this will provoke reading of index, which sets scan count
         rampScanInfo* tmp = getScanHeaderInfo ( 1 );
         free(tmp);
	 // }
      // END HENRY
   }
}
开发者ID:byronyi-deprecated,项目名称:SpectraST,代码行数:28,代码来源:SpectraST_cramp.cpp


示例7: do_load

static void do_load()
{
	input_stop();
	conf_load();
	OK();
	input_calibrate(CHANNELS);
	input_start();
}
开发者ID:modul,项目名称:iris,代码行数:8,代码来源:cli.c


示例8: netlib___alloc_ctx

/*
**++
**  ROUTINE:	netlib___alloc_ctx
**
**  FUNCTIONAL DESCRIPTION:
**
**  	Allocates some memory.
**
**  RETURNS:	cond_value
**
**  PROTOTYPE:
**
**  	netlib___alloc_ctx(unsigned int size, void *ptr)
**
**  IMPLICIT INPUTS:	None.
**
**  IMPLICIT OUTPUTS:	None.
**
**  COMPLETION CODES:	None.
**
**  SIDE EFFECTS:   	None.
**
**--
*/
unsigned int netlib___alloc_ctx (struct CTX **ctxp, unsigned int specsize) {

    struct CTX *ctx;
    unsigned int status, fullsize, aststat;

    BLOCK_ASTS(aststat);
    if (netlib_synch_efn == 0xffffffff) {
    	status = lib$get_ef(&netlib_synch_efn);
    	if (!OK(status)) {
    	    UNBLOCK_ASTS(aststat);
    	    return status;
    	}
    }
    if (netlib_asynch_efn == 0xffffffff) {
    	status = lib$get_ef(&netlib_asynch_efn);
    	if (!OK(status)) {
    	    UNBLOCK_ASTS(aststat);
    	    return status;
    	}
    }

    fullsize = specsize + CTX_S_CTXDEF;
    if (ctxzone == 0) {
    	unsigned int algorithm=LIB$K_VM_FIXED;
    	unsigned int flags=LIB$M_VM_GET_FILL0|LIB$M_VM_EXTEND_AREA;
    	status = lib$create_vm_zone(&ctxzone, &algorithm, &fullsize, &flags);
    	if (!OK(status)) {
    	    UNBLOCK_ASTS(aststat);
    	    return status;
    	}
    }

    status = lib$get_vm(&fullsize, &ctx, &ctxzone);
    if (OK(status)) {
    	ctx->specctx = ctx + 1;
    	ctx->specctx_size = specsize;
    	if (!OK(status)) lib$free_vm(&fullsize, &ctx, &ctxzone);
    	*ctxp = ctx;

    }

    UNBLOCK_ASTS(aststat);

    return status;

} /* netlib___alloc_ctx */
开发者ID:SysMan-One,项目名称:netlib,代码行数:70,代码来源:mem.c


示例9: CFCTest_parse_class

struct CFCClass*
CFCTest_parse_class(CFCTest *test, CFCParser *parser, const char *src) {
    CFCBase *result = CFCParser_parse(parser, src);
    OK(test, result != NULL, "parse class");
    STR_EQ(test, CFCBase_get_cfc_class(result),
           "Clownfish::CFC::Model::Class", "result class");
    return (struct CFCClass*)result;
}
开发者ID:leckie711,项目名称:lucy-clownfish,代码行数:8,代码来源:CFCTest.c


示例10: CFCTest_parse_method

struct CFCMethod*
CFCTest_parse_method(CFCTest *test, CFCParser *parser, const char *src) {
    CFCBase *result = CFCParser_parse(parser, src);
    OK(test, result != NULL, "parse '%s'", src);
    STR_EQ(test, CFCBase_get_cfc_class(result),
           "Clownfish::CFC::Model::Method", "result class of '%s'", src);
    return (struct CFCMethod*)result;
}
开发者ID:leckie711,项目名称:lucy-clownfish,代码行数:8,代码来源:CFCTest.c


示例11: open

 bool open (const double newSampleRate, const BitArray& newChannels)
 {
     reservoirSize = 0;
     reservoirCapacity = 16384;
     reservoir.setSize (actualNumChannels * reservoirCapacity * sizeof (float));
     return openClient (newSampleRate, newChannels)
             && (numChannels == 0 || OK (client->GetService (__uuidof (IAudioCaptureClient), (void**) &captureClient)));
 }
开发者ID:alessandropetrolati,项目名称:juced,代码行数:8,代码来源:juce_win32_WASAPI.cpp


示例12: Disable

void CShaderProgram::Disable()
{
  if (OK())
  {
    glUseProgram(0);
    OnDisabled();
  }
}
开发者ID:notspiff,项目名称:screensaver.asteroids,代码行数:8,代码来源:Shader.cpp


示例13: setLevel

int GameMapSet::setLevel(int l) {
  if (l != m_level && OK(l)) {
    m_level = l;
    emit levelChanged();
  }

  return m_level;
}
开发者ID:Summeli,项目名称:Heebo-BB10,代码行数:8,代码来源:gamemapset.cpp


示例14: test_inside

static void
test_inside (int * test)
{
    int cell;
    int direction;
    cell = 0;
    direction = 4;
    OK (inside (cell, direction), (*test), "%d %d is inside", cell, direction);
    cell = 0;
    direction = 0;
    OK (! inside (cell, direction), (*test), "%d %d is not inside", cell, direction);
    cell = 80;
    direction = 0;
    OK (inside (cell, direction), (*test), "%d %d is inside", cell, direction);
    cell = 80;
    direction = 7;
    OK (! inside (cell, direction), (*test), "%d %d is not inside", cell, direction);
}
开发者ID:benkasminbullock,项目名称:image-similar,代码行数:18,代码来源:similar-image-test.c


示例15: Size

bool Data_Buffer::Size (size_t num) 
{
	if (num > 0 && (num > max_size || !OK ())) {
		if (!Max_Size (num)) return (false);
	}
	size = num; 
	get_ptr = buffer;
	return (true);
}
开发者ID:kravitz,项目名称:transims5,代码行数:9,代码来源:Data_Buffer.cpp


示例16: teardown

/* Called after every test to clean up */
static int teardown(void **state)
{
    uc_engine *uc = *state;

    OK(uc_close(uc));

    *state = NULL;
    return 0;
}
开发者ID:CTF-Thanos,项目名称:unicorn,代码行数:10,代码来源:test_x86.c


示例17: setup32

/* Called before every test to set up a new instance */
static int setup32(void **state)
{
    uc_engine *uc;

    OK(uc_open(UC_ARCH_X86, UC_MODE_32, &uc));

    *state = uc;
    return 0;
}
开发者ID:CTF-Thanos,项目名称:unicorn,代码行数:10,代码来源:test_x86.c


示例18: netlib_bind

/*
**++
**  ROUTINE:	netlib_bind
**
**  FUNCTIONAL DESCRIPTION:
**
**  	tbs
**
**  RETURNS:	cond_value, longword (unsigned), write only, by value
**
**  PROTOTYPE:
**
**  	tbs
**
**  IMPLICIT INPUTS:	None.
**
**  IMPLICIT OUTPUTS:	None.
**
**  COMPLETION CODES:
**
**
**  SIDE EFFECTS:   	None.
**
**--
*/
unsigned int netlib_bind (struct CTX **xctx, struct SINDEF *sa,
    	    	    	    unsigned int *salen, struct NETLIBIOSBDEF *iosb,
    	    	    	    void (*astadr)(), void *astprm) {

    struct CTX *ctx;
    unsigned int status;
    ITMLST2 sockdsc;
    int argc;
    static unsigned int one = 1;

    VERIFY_CTX(xctx, ctx);
    SETARGCOUNT(argc);

    if (argc < 3) return SS$_INSFARG;
    if (sa == 0 || salen == 0) return SS$_BADPARAM;
    if (*salen < sizeof(struct SINDEF)) return SS$_BADPARAM;

    if (!(ctx->flags & CTX_M_USER_SET_REUSEADDR)) {
    	ITMLST2 rulst, sockopt;
    	ITMLST2_INIT(rulst, UCX$C_SOCKOPT, sizeof(sockopt), &sockopt);
    	ITMLST2_INIT(sockopt, NETLIB_K_OPTION_REUSEADDR, sizeof(one), &one);
    	sys$qiow(netlib_synch_efn, ctx->chan, IO$_SETMODE, 0, 0, 0,
    	    	    0, 0, 0, 0, &rulst, 0);
    }

    ITMLST2_INIT(sockdsc, 0, *salen, sa);

    if (argc > 4 && astadr != 0) {
    	struct IOR *ior;
    	GET_IOR(ior, ctx, iosb, astadr, (argc > 5) ? astprm : 0);
    	status = sys$qio(netlib_asynch_efn, ctx->chan, IO$_SETMODE, &ior->iosb,
    	    	    	    io_completion, ior, 0, 0, &sockdsc, 0, 0, 0);
    	if (!OK(status)) FREE_IOR(ior);
    } else {
    	struct NETLIBIOSBDEF myiosb;
    	status = sys$qiow(netlib_synch_efn, ctx->chan, IO$_SETMODE, &myiosb,
    	    	    	    0, 0, 0, 0, &sockdsc, 0, 0, 0);
    	if (OK(status)) status = netlib___cvt_status(&myiosb);
    	if (argc > 3 && iosb != 0) netlib___cvt_iosb(iosb, &myiosb);
    }

    return status;

} /* netlib_bind */
开发者ID:SysMan-One,项目名称:netlib,代码行数:69,代码来源:netlib_ucx.c


示例19: cubeb_init

int
cubeb_init(cubeb ** context, char const * context_name)
{
  int (* init[])(cubeb **, char const *) = {
#if defined(USE_JACK)
    jack_init,
#endif
#if defined(USE_PULSE)
    pulse_init,
#endif
#if defined(USE_ALSA)
    alsa_init,
#endif
#if defined(USE_AUDIOUNIT)
    audiounit_init,
#endif
#if defined(USE_WASAPI)
    wasapi_init,
#endif
#if defined(USE_WINMM)
    winmm_init,
#endif
#if defined(USE_SNDIO)
    sndio_init,
#endif
#if defined(USE_OPENSL)
    opensl_init,
#endif
#if defined(USE_AUDIOTRACK)
    audiotrack_init,
#endif
#if defined(USE_KAI)
    kai_init,
#endif
  };
  int i;

  if (!context) {
    return CUBEB_ERROR_INVALID_PARAMETER;
  }

  for (i = 0; i < NELEMS(init); ++i) {
    if (init[i](context, context_name) == CUBEB_OK) {
      /* Assert that the minimal API is implemented. */
#define OK(fn) assert((* context)->ops->fn)
      OK(get_backend_id);
      OK(destroy);
      OK(stream_init);
      OK(stream_destroy);
      OK(stream_start);
      OK(stream_stop);
      OK(stream_get_position);
      return CUBEB_OK;
    }
  }

  return CUBEB_ERROR;
}
开发者ID:bitwiseworks,项目名称:mozilla-os2,代码行数:58,代码来源:cubeb.c


示例20: sp_receive

/*
**++
**  ROUTINE:	sp_receive
**
**  FUNCTIONAL DESCRIPTION:
**
**  	Get some output from the subprocess, if any.  Uses IO$M_NOW modifier
**  so that if there isn't anything available, we return an error status
**  rather than blocking until something comes up.
**
**  RETURNS:	cond_value, longword (unsigned), write only, by value
**
**  PROTOTYPE:
**
**  	sp_receive(SPHANDLE *ctxpp, struct dsc$descriptor *rcvstr,
**  	    	    	int *rcvlen)
**
**  IMPLICIT INPUTS:	None.
**
**  IMPLICIT OUTPUTS:	None.
**
**  COMPLETION CODES:
**  	    SS$_NORMAL:  normal successful completion
**  	    SS$_NONEXPR: subprocess doesn't exist any more
**
**  SIDE EFFECTS:   	None.
**
**--
*/
unsigned int sp_receive (SPHANDLE *ctxpp, void *rcvstr, int *rcvlen) {

    SPHANDLE ctx;
    unsigned int status, efstate;

    ctx = *ctxpp;
    if (sys$readef(ctx->termefn, &efstate) != SS$_WASCLR) return SS$_NONEXPR;

    status = sys$qiow(0, ctx->outchn, IO$_READVBLK|IO$M_NOW, ctx->iosb,
    	    	0, 0, ctx->bufptr, ctx->bufsiz, 0, 0, 0, 0);
    if (OK(status)) status = ctx->iosb[0];
    if (OK(status)) {
    	str$copy_r(rcvstr, &ctx->iosb[1], ctx->bufptr);
    	if (rcvlen) *rcvlen = ctx->iosb[1];
    }

    return status;

} /* sp_receive */
开发者ID:SysMan-One,项目名称:mmk,代码行数:48,代码来源:sp_mgr.c



注:本文中的OK函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ OLC_MODE函数代码示例发布时间:2022-05-30
下一篇:
C++ OIC_LOG_V函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap