当前位置: 首页>>代码示例>>C++>>正文


C++ OK函数代码示例

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


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


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