本文整理汇总了C++中c_iterTakeFirst函数的典型用法代码示例。如果您正苦于以下问题:C++ c_iterTakeFirst函数的具体用法?C++ c_iterTakeFirst怎么用?C++ c_iterTakeFirst使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了c_iterTakeFirst函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: s_configurationValueULong
static void
s_configurationValueULong(
s_configuration configuration,
u_cfElement element,
const char *tag,
void (* const setAction)(s_configuration config, c_ulong longValue))
{
c_iter iter;
u_cfData data;
c_long longValue;
c_ulong ulongValue;
c_bool found;
iter = u_cfElementXPath(element, tag);
data = u_cfData(c_iterTakeFirst(iter));
while (data != NULL) {
found = u_cfDataLongValue(data, &longValue);
/* QAC EXPECT 2100; */
if (found == TRUE) {
if (longValue < 0) {
longValue = -longValue;
if (longValue < 0) {
longValue++;
longValue = -longValue;
}
}
ulongValue = (c_ulong)longValue;
setAction(configuration, ulongValue);
}
u_cfDataFree(data);
data = u_cfData(c_iterTakeFirst(iter));
}
c_iterFree(iter);
}
示例2: cfgGetArguments
static c_bool
cfgGetArguments(
sr_serviceInfo si,
u_cfElement info)
{
c_iter iter;
int iterLength;
c_bool r;
u_cfData d;
r = TRUE;
iter = u_cfElementXPath(info, "Arguments/#text");
iterLength = c_iterLength(iter);
d = u_cfData(c_iterTakeFirst(iter));
if (iterLength == 1) {
r = u_cfDataStringValue(d, &si->args);
u_cfDataFree(d);
} else if (iterLength == 0) {
OS_REPORT_1(OS_INFO, OSRPT_CNTXT_SPLICED,
0, "Taking default for <Arguments> parameter service %s", si->name);
si->args = os_strdup("");
} else {
OS_REPORT_1(OS_ERROR, OSRPT_CNTXT_SPLICED,
0, "One <Arguments> parameter expected for service %s", si->name);
si->args = os_strdup("");
while (d != NULL) {
u_cfDataFree(d);
d = u_cfData(c_iterTakeFirst(iter));
}
r = FALSE;
}
c_iterFree(iter);
return r;
}
示例3: u_cfElementGetAttributes
c_iter
u_cfElementGetAttributes(
u_cfElement element)
{
u_result r;
v_cfElement ke;
v_cfAttribute attr;
c_iter ka;
c_iter attributes;
u_participant p;
attributes = c_iterNew(NULL);
if (element != NULL) {
r = u_cfNodeReadClaim(u_cfNode(element), (v_cfNode*)(&ke));
if (r == U_RESULT_OK) {
p = u_cfNodeParticipant(u_cfNode(element));
ka = v_cfElementGetAttributes(ke);
attr = c_iterTakeFirst(ka);
while (attr != NULL) {
c_iterInsert(attributes, u_cfAttributeNew(p, attr));
attr = c_iterTakeFirst(ka);
}
c_iterFree(ka);
u_cfNodeRelease(u_cfNode(element));
}
}
return attributes;
}
示例4: cfgGetCommand
/**************************************************************
* Private functions
**************************************************************/
static c_bool
cfgGetCommand(
sr_serviceInfo si,
u_cfElement info)
{
c_iter iter;
int iterLength;
c_bool r;
u_cfData d;
r = TRUE;
iter = u_cfElementXPath(info, "Command/#text");
iterLength = c_iterLength(iter);
d = u_cfData(c_iterTakeFirst(iter));
if (iterLength == 1) {
r = u_cfDataStringValue(d, &si->command);
u_cfDataFree(d);
} else {
OS_REPORT_1(OS_ERROR, OSRPT_CNTXT_SPLICED,
0, "One <Command> parameter expected for service %s", si->name);
while (d != NULL) {
u_cfDataFree(d);
d = u_cfData(c_iterTakeFirst(iter));
}
r = FALSE;
}
c_iterFree(iter);
return r;
}
示例5: s_configurationAttrValueBoolean
static void
s_configurationAttrValueBoolean(
s_configuration configuration,
u_cfElement element,
const char *tag,
const char *attr,
void (* const setAction)(s_configuration config, c_bool boolValue))
{
c_iter iter;
u_cfElement e;
u_cfAttribute a;
c_bool boolValue, found;
iter = u_cfElementXPath(element, tag);
e = u_cfElement(c_iterTakeFirst(iter));
while (e != NULL) {
a = u_cfElementAttribute(e, attr);
if (a) {
found = u_cfAttributeBoolValue(a, &boolValue);
/* QAC EXPECT 2100; */
if (found == TRUE) {
setAction(configuration, boolValue);
}
u_cfAttributeFree(a);
}
u_cfElementFree(e);
e = u_cfElement(c_iterTakeFirst(iter));
}
c_iterFree(iter);
}
示例6: cmx_readerSnapshotFreeAll
void
cmx_readerSnapshotFreeAll()
{
cmx_readerSnapshot s;
c_char* sample;
os_mutex m;
m = cmx_getReaderSnapshotMutex();
os_mutexLock(&m);
s = cmx_readerSnapshot(c_iterTakeFirst(readerSnapshots));
while(s != NULL){
if(s->samples != NULL){
sample = (c_char*)(c_iterTakeFirst(s->samples));
while(sample != NULL){
os_free(sample);
sample = (c_char*)(c_iterTakeFirst(s->samples));
}
c_iterFree(s->samples);
}
os_free(s);
s = cmx_readerSnapshot(c_iterTakeFirst(readerSnapshots));
}
os_mutexUnlock(&m);
}
示例7: v_subscriberUnSubscribe
void
v_subscriberUnSubscribe(
v_subscriber s,
const c_char *partitionExpr)
{
v_partition d;
v_dataReaderConnectionChanges arg;
v_partitionPolicy old;
assert(s != NULL);
assert(C_TYPECHECK(s,v_subscriber));
arg.addedPartitions = NULL;
c_lockWrite(&s->lock);
arg.removedPartitions = v_partitionAdminRemove(s->partitions, partitionExpr);
old = s->qos->partition;
s->qos->partition = v_partitionPolicyRemove(old, partitionExpr,
c_getBase(c_object(s)));
c_free(old);
c_setWalk(s->readers, qosChangedAction, &arg);
d = v_partition(c_iterTakeFirst(arg.removedPartitions));
while (d != NULL) {
c_free(d);
d = v_partition(c_iterTakeFirst(arg.removedPartitions));
}
c_iterFree(arg.removedPartitions);
c_lockUnlock(&s->lock);
}
示例8: s_configurationValueString
static void
s_configurationValueString(
s_configuration configuration,
u_cfElement element,
const char *tag,
void (* const setAction)(s_configuration config, const c_char * str) )
{
c_iter iter;
u_cfData data;
c_bool found;
c_char * str;
iter = u_cfElementXPath(element, tag);
data = u_cfData(c_iterTakeFirst(iter));
while (data) {
found = u_cfDataStringValue(data, &str);
/* QAC EXPECT 2100; */
if (found == TRUE) {
setAction(configuration, str);
os_free(str);
}
u_cfDataFree(data);
data = u_cfData(c_iterTakeFirst(iter));
}
c_iterFree(iter);
}
示例9: s_configurationValueSize
static void
s_configurationValueSize(
s_configuration configuration,
u_cfElement element,
const char *tag,
void (* const setAction)(s_configuration config, c_ulong ulongValue))
{
c_iter iter;
u_cfData data;
c_ulong ulongValue;
c_bool found;
iter = u_cfElementXPath(element, tag);
data = u_cfData(c_iterTakeFirst(iter));
while (data != NULL) {
found = u_cfDataSizeValue(data, &ulongValue);
/* QAC EXPECT 2100; */
if (found == TRUE) {
setAction(configuration, ulongValue);
}
u_cfDataFree(data);
data = u_cfData(c_iterTakeFirst(iter));
}
c_iterFree(iter);
}
示例10: s_configurationValueFloat
static void
s_configurationValueFloat(
s_configuration configuration,
u_cfElement element,
const c_char *tag,
void (* const setAction)(s_configuration config, c_float floatValue))
{
c_iter iter;
u_cfData data;
c_bool found;
c_float floatValue;
iter = u_cfElementXPath(element, tag);
data = u_cfData(c_iterTakeFirst(iter));
while (data != NULL) {
found = u_cfDataFloatValue(data, &floatValue);
if (found == TRUE) {
setAction(configuration, floatValue);
}
u_cfDataFree(data);
data = u_cfData(c_iterTakeFirst(iter));
}
c_iterFree(iter);
}
示例11: jni_lookupTopic
jni_topic
jni_lookupTopic(
jni_participant p,
const char* name)
{
c_iter topics;
jni_topic topic, temp;
int found;
topic = NULL;
if((name != NULL) && (p != NULL)){
topics = c_iterCopy(p->topics);
found = 0;
temp = jni_topic(c_iterTakeFirst(topics));
while( (temp != NULL) && (!found)){
if(strcmp(jni_topicDescription(temp)->name, name) == 0){
topic = temp;
found = 1;
}
temp = jni_topic(c_iterTakeFirst(topics));
}
c_iterFree(topics);
}
return topic;
}
示例12: cmx_readerSnapshotFree
void
cmx_readerSnapshotFree(
c_char* snapshot)
{
cmx_readerSnapshot s;
c_char* sample;
os_mutex m;
s = cmx_readerSnapshotLookup(snapshot);
if(s != NULL){
m = cmx_getReaderSnapshotMutex();
os_mutexLock(&m);
c_iterTake(readerSnapshots, s);
os_mutexUnlock(&m);
if(s->samples != NULL){
sample = (c_char*)(c_iterTakeFirst(s->samples));
while(sample != NULL){
os_free(sample);
sample = (c_char*)(c_iterTakeFirst(s->samples));
}
c_iterFree(s->samples);
}
os_free(s);
os_free(snapshot);
}
}
示例13: u_subscriberDeleteContainedEntities
u_result
u_subscriberDeleteContainedEntities (
u_subscriber _this)
{
u_result result;
u_reader reader;
c_iter list;
if (_this != NULL) {
result = u_entityLock(u_entity(_this));
if (result == U_RESULT_OK) {
list = _this->readers;
_this->readers = NULL;
/* Unlock here because following code will take this lock. */
u_entityUnlock(u_entity(_this));
reader = c_iterTakeFirst(list);
while (reader) {
switch (u_entityKind(u_entity(reader))) {
case U_READER:
result = u_dataReaderDeleteContainedEntities(u_dataReader(reader));
result = u_dataReaderFree(u_dataReader(reader));
break;
case U_GROUPQUEUE:
result = u_groupQueueFree(u_groupQueue(reader));
break;
case U_DATAVIEW:
result = u_dataViewFree(u_dataView(reader));
break;
case U_NETWORKREADER:
result = u_networkReaderFree(u_networkReader(reader));
break;
default:
OS_REPORT_2(OS_WARNING,
"u_subscriberDeleteContainedEntities",0,
"invalid object type: "
"For Subscriber = 0x%x, found Reader type = %s.",
_this, u_kindImage(u_entityKind(u_entity(reader))));
assert(0);
break;
}
u_entityDereference(u_entity(_this));
reader = c_iterTakeFirst(list);
}
c_iterFree(list);
} else {
OS_REPORT_2(OS_WARNING,
"u_subscriberDeleteContainedEntities",0,
"Operation u_entityLock failed: "
"Subscriber = 0x%x, result = %s.",
_this, u_resultImage(result));
}
} else {
OS_REPORT(OS_WARNING,
"u_subscriberDeleteContainedEntities",0,
"Invalid Subscriber <NULL>.");
result = U_RESULT_ILL_PARAM;
}
return result;
}
示例14: cfgGetSchedule
static c_bool
cfgGetSchedule(
sr_serviceInfo si,
u_cfElement info)
{
c_iter iter;
int iterLength;
c_bool r;
u_cfData d;
c_char *str;
r = TRUE;
iter = u_cfElementXPath(info, "Scheduling/Class/#text");
iterLength = c_iterLength(iter);
d = u_cfData(c_iterTakeFirst(iter));
if (iterLength == 1) {
r = u_cfDataStringValue(d, &str);
if (r == TRUE) {
if (strncmp(str, SCHED_RT, strlen(SCHED_RT)) == 0) {
si->procAttr.schedClass = OS_SCHED_REALTIME;
} else {
if (strncmp(str, SCHED_TS, strlen(SCHED_TS)) == 0) {
si->procAttr.schedClass = OS_SCHED_TIMESHARE;
} else {
if (strcmp(str, SCHED_DEF)==0) {
si->procAttr.schedClass = OS_SCHED_DEFAULT;
} else {
si->procAttr.schedClass = OS_SCHED_DEFAULT;
OS_REPORT_1(OS_WARNING, OSRPT_CNTXT_SPLICED,
0, "Incorrect <Scheduling/Class> parameter for service %s -> default",
si->name);
r = TRUE;
}
}
}
os_free(str);
}
u_cfDataFree(d);
} else {
si->procAttr.schedClass = OS_SCHED_DEFAULT;
if (iterLength == 0) {
OS_REPORT_1(OS_INFO, OSRPT_CNTXT_SPLICED,
0, "Taking default for <Scheduling/Class> parameter service %s", si->name);
} else {
OS_REPORT_1(OS_ERROR, OSRPT_CNTXT_SPLICED,
0, "One <Scheduling/Class> parameter expected for service %s", si->name);
r = FALSE;
}
while (d != NULL) {
u_cfDataFree(d);
d = u_cfData(c_iterTakeFirst(iter));
}
}
c_iterFree(iter);
return r;
}
示例15: jni_participantFree
jni_result
jni_participantFree(
jni_participant p)
{
jni_result r;
jni_partition partition;
r = JNI_RESULT_OK;
if(p != NULL){
if((p->publishers != NULL) && (c_iterLength(p->publishers) != 0)){
r = JNI_RESULT_PRECONDITION_NOT_MET;
}
else if((p->subscribers != NULL) && (c_iterLength(p->subscribers) != 0)){
r = JNI_RESULT_PRECONDITION_NOT_MET;
}
else if((p->topics != NULL) && (c_iterLength(p->topics) != 0)){
r = JNI_RESULT_PRECONDITION_NOT_MET;
}
else if((p->partitions != NULL) && (c_iterLength(p->partitions) != 0)){
partition = jni_partition(c_iterTakeFirst(p->partitions));
while((partition != NULL) && (r == JNI_RESULT_OK)){
r = jni_partitionFree(partition);
partition = jni_partition(c_iterTakeFirst(p->partitions));
}
}
else{
/*DO NOTHING.*/
}
if(r == JNI_RESULT_OK){
if(p->publishers != NULL){
c_iterFree(p->publishers);
}
if(p->subscribers != NULL){
c_iterFree(p->subscribers);
}
if(p->topics != NULL){
c_iterFree(p->topics);
}
if(p->partitions != NULL){
c_iterFree(p->partitions);
}
if(p->uparticipant != NULL){
r = jni_convertResult(u_participantFree(p->uparticipant));
}
else{
r = JNI_RESULT_OK;
}
os_free(p);
}
}
else{
r = JNI_RESULT_BAD_PARAMETER;
}
return r;
}