本文整理汇总了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, ¤tSourceID)))
{
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;
}
示例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(®istered));
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();
}
示例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;
}
示例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;
}
示例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;
}
示例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
}
}
示例7: do_load
static void do_load()
{
input_stop();
conf_load();
OK();
input_calibrate(CHANNELS);
input_start();
}
示例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 */
示例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;
}
示例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;
}
示例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)));
}
示例12: Disable
void CShaderProgram::Disable()
{
if (OK())
{
glUseProgram(0);
OnDisabled();
}
}
示例13: setLevel
int GameMapSet::setLevel(int l) {
if (l != m_level && OK(l)) {
m_level = l;
emit levelChanged();
}
return m_level;
}
示例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);
}
示例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);
}