本文整理汇总了C++中C_TYPECHECK函数的典型用法代码示例。如果您正苦于以下问题:C++ C_TYPECHECK函数的具体用法?C++ C_TYPECHECK怎么用?C++ C_TYPECHECK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了C_TYPECHECK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: v_serviceNew
/**************************************************************
* constructor/destructor
**************************************************************/
v_service
v_serviceNew(
v_serviceManager manager,
const c_char *name,
const c_char *extStateName,
v_participantQos qos,
v_statistics stats)
{
v_kernel k;
v_service s;
v_participantQos q;
assert(C_TYPECHECK(manager, v_serviceManager));
/* Do not C_TYPECHECK qos parameter, since it might be allocated on heap! */
assert(name != NULL);
k = v_objectKernel(manager);
/* do no use cast method on qos parameter,
* it is most likely allocated on heap! */
q = v_participantQosNew(k, (v_participantQos)qos);
if (q == NULL) {
OS_REPORT(OS_ERROR, "v_serviceNew", 0,
"Service not created: inconsistent qos");
s = NULL;
} else {
s = v_service(v_objectNew(k, K_SERVICE));
v_serviceInit(s, manager, name, extStateName, q, stats);
c_free(q);
/* always add, even when s->state==NULL, since v_participantFree always
removes the participant.*/
v_addParticipant(k, v_participant(s));
if (s->state == NULL) {
v_serviceFree(s);
s = NULL;
}
}
return s;
}
示例2: v_cfElementInit
void
v_cfElementInit (
v_cfElement element,
v_configuration config,
const c_char *tagName)
{
c_type attrType;
c_type nodeType;
const c_char *keyList;
assert(C_TYPECHECK(element, v_cfElement));
assert(tagName != NULL);
v_cfNodeInit(v_cfNode(element), config, V_CFELEMENT, tagName);
attrType = c_resolve(c_getBase(element), "kernelModule::v_cfAttribute");
nodeType = c_resolve(c_getBase(element), "kernelModule::v_cfNode");
keyList = "name";
element->attributes = c_tableNew(attrType, keyList);
element->children = c_setNew(nodeType);
}
示例3: _v_writerSampleGetStatus
/* Precondition: protect the sample yourself */
v_writerSampleStatus
_v_writerSampleGetStatus(
v_writerSample sample)
{
v_writerSampleStatus result;
assert(sample);
assert(C_TYPECHECK(sample,v_writerSample));
if ((c_long)sample->resend == TRUE) {
/* Someone has rejected the sample, resend it */
result = V_SAMPLE_RESEND;
} else {
if ((c_long)sample->decayCount > 0) {
result = V_SAMPLE_KEEP;
} else {
result = V_SAMPLE_RELEASE;
}
}
return result;
}
示例4: v_listenerFlush
void
v_listenerFlush(
v_listener _this,
v_eventMask events,
c_voidp userData)
{
v_listenerEvent event, *prev;
if (_this == NULL) {
return;
}
assert(C_TYPECHECK(_this,v_listener));
c_mutexLock(&_this->mutex);
/* wakeup blocking threads to evaluate new condition. */
/* remove all events */
prev = &_this->eventList;
event = _this->eventList;
while (event != NULL) {
if (event->userData == userData) {
event->kind &= ~events;
}
if (event->kind == 0) {
if (event == _this->lastEvent) {
_this->lastEvent = c_keep(_this->lastEvent->next);
v_listenerEventDeinit(event);
c_free(event);
}
*prev = event->next;
v_listenerEventDeinit(event);
c_free(event);
event = *prev;
} else {
prev = &event->next;
event = event->next;
}
}
c_condBroadcast(&_this->cv);
c_mutexUnlock(&_this->mutex);
}
示例5: v_leaseManagerNew
/**************************************************************
* constructor/destructor
**************************************************************/
v_leaseManager
v_leaseManagerNew(
v_kernel k)
{
v_leaseManager _this;
assert(C_TYPECHECK(k, v_kernel));
_this = v_leaseManager(v_objectNew(k, K_LEASEMANAGER));
if(_this)
{
v_leaseManagerInit(_this);
} else
{
OS_REPORT(OS_ERROR, "v_leaseManager", 0,
"Failed to create a v_leaseManager object. "
"Most likely not enough shared memory available "
"to complete the operation.");
}
return _this;
}
示例6: v_handleInvalidate
/**
* This method will invalidate a handle and mark the resources as ready for reuse.
* Note that the info and handle musr correspond and that info is locked.
*/
static void
v_handleInvalidate (
v_handle handle,
v_handleInfo *info)
{
v_handleServer server;
c_object entity;
server = v_handleServer((c_object)handle.server);
assert(C_TYPECHECK(server,v_handleServer));
if (server) {
c_mutexLock(&server->mutex);
info->nextFree = server->firstFree;
server->firstFree = handle.index;
info->serial = (info->serial + 1) % MAXSERIAL;
entity = info->object;
info->object = NULL;
c_mutexUnlock(&server->mutex);
c_mutexUnlock(&info->mutex);
v_publicDispose(v_public(entity));
}
}
示例7: v_instanceWrite
v_writeResult
v_instanceWrite(
v_instance instance,
v_message message)
{
c_char *metaName;
assert(C_TYPECHECK(instance, v_instance));
switch (v_objectKind(instance)) {
case K_DATAREADERINSTANCE:
return v_dataReaderInstanceWrite(v_dataReaderInstance(instance),message);
default:
metaName = c_metaName(c_metaObject(c_getType(instance)));
OS_REPORT_1(OS_ERROR,
"v_instanceWrite",0,
"Unknown instance type <%s>",
metaName);
c_free(metaName);
return V_WRITE_PRE_NOT_MET;
}
}
示例8: v_listenerFree
void
v_listenerFree(
v_listener _this)
{
v_participant p;
v_listenerEvent event;
os_duration delay;
assert(_this != NULL);
assert(C_TYPECHECK(_this,v_listener));
p = v_participant(_this->participant);
assert(p != NULL);
c_mutexLock(&_this->mutex);
/* wakeup blocking threads to evaluate new condition. */
/* remove all events */
while (_this->eventList != NULL) {
event = _this->eventList;
_this->eventList = event->next;
v_listenerEventDeinit(event);
c_free(event);
}
_this->eventList = NULL;
c_free(_this->lastEvent);
_this->lastEvent = NULL;
_this->terminate = TRUE;
c_condBroadcast(&_this->cv);
c_mutexUnlock(&_this->mutex);
delay = OS_DURATION_INIT(0, 1000);
while (_this->waitCount > 0 && !p->processIsZombie) {
ospl_os_sleep(delay);
}
v_participantRemove(p, v_object(_this));
_this->participant = NULL;
v_publicFree(v_public(_this));
}
示例9: v_topicAdapterNewFromTopicInfo
v_topicAdapter
v_topicAdapterNewFromTopicInfo(
v_participant p,
const struct v_topicInfo *info,
c_bool announce)
{
v_topicAdapter adapter = NULL;
v_topicImpl topic;
v_kernel kernel;
assert(p != NULL);
assert(C_TYPECHECK(p,v_participant));
kernel = v_objectKernel(p);
topic = v_topicImplNewFromTopicInfo(kernel, info, announce);
if (topic) {
adapter = v_topicAdapterWrap(p, v_topic(topic));
}
return adapter;
}
示例10: v_networkReaderEntryWrite
v_writeResult
v_networkReaderEntryWrite(
v_networkReaderEntry entry,
v_message message,
v_networkId writingNetworkId)
{
v_writeResult result = V_WRITE_SUCCESS;
c_bool writeSucceeded;
static v_gid zeroAddressee = {0,0,0};
assert(C_TYPECHECK(entry, v_networkReaderEntry));
assert(message != NULL);
/* First check if there is any remote interest at all */
if (v_networkReader(v_entry(entry)->reader)->remoteActivity) {
/* Only forward messages that come from this kernel */
if (writingNetworkId == V_NETWORKID_LOCAL || entry->isRouting) {
/* OK, message is from this kernel or this is a routing entry. Now
* attach the correct fields if needed */
/* TODO: For networking services that support routing perhaps
* messages shouldn't be forwarded to 'self' (e.g., echo cancellation
* may be needed). For R&R this modus is fine. */
writeSucceeded = v_networkReaderWrite(
v_networkReader(v_entry(entry)->reader),
message, entry, 0, message->writerGID,
FALSE /* no p2p */, zeroAddressee);
if (writeSucceeded) {
result = V_WRITE_SUCCESS;
} else {
result = V_WRITE_REJECTED;
}
}
}
return result;
}
示例11: v_cfNodeNew
/**************************************************************
* constructor/destructor
**************************************************************/
v_cfNode
v_cfNodeNew(
v_configuration config,
v_cfKind kind)
{
v_cfNode node;
c_type type;
assert(C_TYPECHECK(config, v_configuration));
switch (kind) {
case V_CFELEMENT:
type = c_resolve(c_getBase(config), "kernelModule::v_cfElement");
break;
case V_CFATTRIBUTE:
type = c_resolve(c_getBase(config), "kernelModule::v_cfAttribute");
break;
case V_CFDATA:
type = c_resolve(c_getBase(config), "kernelModule::v_cfData");
break;
case V_CFNODE:
default:
OS_REPORT_1(OS_ERROR,"v_cfNodeNew failed",0,"Illegal kind (%d) specified",kind);
assert(FALSE);
type = NULL;
break;
}
if (type != NULL) {
node = c_new(type);
} else {
node = NULL;
}
/* init is done by specific class itself, this is just a
convenience function! */
return node;
}
示例12: v_deliveryWaitListNotify
v_result
v_deliveryWaitListNotify (
v_deliveryWaitList _this,
v_deliveryInfoTemplate msg)
{
c_ulong size, i, count;
v_gid *list;
assert(C_TYPECHECK(_this,v_deliveryWaitList));
assert(msg);
list = (v_gid *)_this->readerGID;
if(msg->userData.sequenceNumber == _this->sequenceNumber)
{
count = 0;
size = c_arraySize(_this->readerGID);
for (i=0; i<size; i++) {
if (v_gidEqual(list[i],msg->userData.readerGID)) {
/* Set the found readerGID to zero,
* iThe waitlist can be unblocked when
* all expected systemIds are zero.
* In that case count will be 0.
*/
v_gidSetNil(list[i]);
}
count += v_gidSystemId(list[i]);
}
if (count == 0) {
c_free(_this->readerGID);
_this->readerGID = NULL;
c_mutexLock(&_this->mutex);
c_condSignal(&_this->cv);
c_mutexUnlock(&_this->mutex);
}
}
return V_RESULT_OK;
}
示例13: v_resolveTopics
c_iter
v_resolveTopics(
v_kernel kernel,
const c_char *name)
{
c_iter list;
c_collection q;
q_expr expr;
c_value params[1];
assert(kernel != NULL);
assert(C_TYPECHECK(kernel,v_kernel));
expr = (q_expr)q_parse("name like %0");
params[0] = c_stringValue((char *)name);
q = c_queryNew(kernel->topics,expr,params);
q_dispose(expr);
c_lockRead(&kernel->lock);
list = c_select(q,0);
c_lockUnlock(&kernel->lock);
c_free(q);
return list;
}
示例14: v_dataViewInstanceRemove
void
v_dataViewInstanceRemove(
v_dataViewInstance instance)
{
v_dataView dataView;
v_dataViewInstance found;
assert(C_TYPECHECK(instance,v_dataViewInstance));
if (instance->sampleCount == 0) {
CHECK_ZERO_INSTANCE(instance);
if (v_objectKind (instance) == K_DATAVIEWINSTANCE) {
dataView = v_dataView(v_instanceEntity(instance));
found = c_remove(dataView->instances,instance,NULL,NULL);
assert(found == instance);
OS_UNUSED_ARG(found);
v_publicFree(v_public(instance));
c_free(instance);
}
} else {
CHECK_INSTANCE(instance);
}
}
示例15: writerDeadlineMissed
void
writerDeadlineMissed(
v_leaseAction leaseAction,
c_time now)
{
v_object w;
v_handleResult r;
assert(leaseAction != NULL);
assert(C_TYPECHECK(leaseAction, v_leaseAction));
r = v_handleClaim(leaseAction->actionObject, &w);
if (r == V_HANDLE_OK)
{
v_writerCheckDeadlineMissed(v_writer(w), now);
r = v_handleRelease(leaseAction->actionObject);
if(r != V_HANDLE_OK)
{
OS_REPORT_1(OS_WARNING, "v_leaseManager", 0,
"Handle release failed with result code %d ", r);
}
}
}