c_bool
__sensor_msgs_msg_dds__CompressedImage___copyIn(
    c_base base,
    struct ::sensor_msgs::msg::dds_::CompressedImage_ *from,
    struct _sensor_msgs_msg_dds__CompressedImage_ *to)
{
    c_bool result = OS_C_TRUE;
    (void) base;

    if(result){
        extern c_bool __std_msgs_msg_dds__Header___copyIn(c_base, ::std_msgs::msg::dds_::Header_ *, _std_msgs_msg_dds__Header_ *);
        result = __std_msgs_msg_dds__Header___copyIn(base, &from->header_, &to->header_);
    }
#ifdef OSPL_BOUNDS_CHECK
    if(from->format_){
        to->format_ = c_stringNew(base, from->format_);
    } else {
        OS_REPORT (OS_ERROR, "copyIn", 0,"Member 'sensor_msgs::msg::dds_::CompressedImage_.format_' of type 'c_string' is NULL.");
        result = OS_C_FALSE;
    }
#else
    to->format_ = c_stringNew(base, from->format_);
#endif
    {
/* Code generated by /home/erle/opensplice/src/tools/idlpp/code/idl_genCorbaCxxCopyin.c at line 774 */

        static c_type type0 = NULL;
        c_type subtype0;
        c_long length0;
        c_octet *dest0;
        ::sensor_msgs::msg::dds_::CompressedImage_::_data__seq *src = &from->data_;

        if (type0 == NULL) {
            subtype0 = c_type(c_metaResolve (c_metaObject(base), "c_octet"));
            type0 = c_metaSequenceTypeNew(c_metaObject(base),"C_SEQUENCE<c_octet>",subtype0,0);
            c_free(subtype0);
        }
        length0 = (c_long)(*src).length();
#ifdef OSPL_BOUNDS_CHECK
         dest0 = (c_octet *)c_newSequence(c_collectionType(type0),length0);
        {
        /* Code generated by /home/erle/opensplice/src/tools/idlpp/code/idl_genCorbaCxxCopyin.c at line 1873 */
                    c_octet *buf0;
            buf0 = (c_octet *)(*src).get_buffer();
            memcpy (dest0,buf0,length0* sizeof(*dest0));
        }
        to->data_ = (c_sequence)dest0;
#else
        dest0 = (c_octet *)c_newSequence(c_collectionType(type0),length0);
        {
        /* Code generated by /home/erle/opensplice/src/tools/idlpp/code/idl_genCorbaCxxCopyin.c at line 1873 */
                    c_octet *buf0;
            buf0 = (c_octet *)(*src).get_buffer();
            memcpy (dest0,buf0,length0* sizeof(*dest0));
        }
        to->data_ = (c_sequence)dest0;
#endif
    }
    return result;
}
示例#2
0
c_structure
idl_stacDefFindMetaStructureResolved(
    c_metaObject scope,
    const char *typeName)
{
    c_baseObject object;
    c_structure structure;

    object = c_baseObject(c_metaResolve(scope, typeName));

    if(!object)
    {
        printf("FATAL ERROR | #pragma stac: Trying to locate structure '%s' in "
            "scope '%s'. But no such object exists.\n",
            typeName, c_metaScopedName(c_metaObject(scope)));
        exit(-2);
    }
    /* Resolve typedefs */
    idl_stacDefResolveTypeDef(object);
    /* The final object (after typedef resolving) should be a structure */
    if(object->kind != M_STRUCTURE)
    {
        printf("FATAL ERROR | #pragma stac: Trying to locate structure '%s' in "
            "scope '%s'. But the identified object is not a structure.\n",
            typeName, c_metaScopedName(c_metaObject(scope)));
        exit(-2);
    }
    structure = c_structure(object);

    return structure;
}
示例#3
0
static c_type
createKeyType(
    const c_char *name,
    c_array keyList)
{
    c_base base;
    c_type foundType;
    c_char *typeName;
    c_char keyName[16];
    c_long i, length, sres;
    c_array members;
    c_metaObject o;
    c_field field;

    if (keyList == NULL) {
        return NULL;
    }
    base = c_getBase(keyList);
    length = c_arraySize(keyList);
    if (length == 0) {
        return NULL;
    }
    o = c_metaDefine(c_metaObject(base),M_STRUCTURE);
    members = c_arrayNew(c_member_t(base),length);

    for (i=0;i<length;i++) {
        field = keyList[i];
        assert(field != NULL);
        members[i] = (c_voidp)c_metaDefine(c_metaObject(base),M_MEMBER);
            sprintf(keyName,"field%d",i);
            c_specifier(members[i])->name = c_stringNew(base,keyName);
            c_specifier(members[i])->type = c_keep(c_fieldType(field));
    }
    c_structure(o)->members = members;
    c_metaObject(o)->definedIn = c_metaObject(base);
    c_metaFinalize(o);
#define KEY_NAME   "<Key>"
#define KEY_FORMAT "%s<Key>"

    if (name != NULL) {
        length = sizeof(KEY_NAME) + strlen(name);
        typeName = os_malloc(length);
        sres = snprintf(typeName,length,KEY_FORMAT,name);
        assert(sres == (length-1));
    } else {
        assert(FALSE);
        length = 100;
        typeName = os_malloc(length);
        os_sprintf(typeName,PA_ADDRFMT KEY_NAME,(c_address)o);
    }
#undef KEY_NAME
#undef KEY_FORMAT
    foundType = c_type(c_metaBind(c_metaObject(base),typeName,o));

    c_free(o);
    os_free(typeName);

    return foundType;

}
示例#4
0
c_type
c_declaratorType(
    c_declarator declaration,
    c_type type)
{
    c_literal l;
    c_metaObject scope;
    c_collectionType o;

    if (declaration->sizes != NULL) {
        scope = c_metaObject(c__getBase(type));
        l = c_iterTakeFirst(declaration->sizes);
        while (l != NULL) {
            o = (c_collectionType)c_metaDefine(scope,M_COLLECTION);
            o->kind = OSPL_C_ARRAY;
            if (l->value.kind == V_LONGLONG) {
                assert (l->value.is.LongLong >= 0);
                o->maxSize = (c_ulong) l->value.is.LongLong;
            } else {
                assert (l->value.is.Long >= 0);
                o->maxSize = (c_ulong) l->value.is.Long;
            }
            o->subType = type;
            c_metaFinalize(c_metaObject(o));
            type = (c_type)o;
            c_free(l);
            l = c_iterTakeFirst(declaration->sizes);
        }
    }
    return type;
}
示例#5
0
c_object
c_checkType (
    c_object o,
    const c_char *name)
{
    c_type type;
    c_string str;
    c_bool found = FALSE;
    c_bool stop = FALSE;

    if (o == NULL) {
        return NULL;
    }
    c_assertValidDatabaseObject(o);
    assert(c_refCount(o) > 0);
    assert(name != NULL);
    type = c__getType(o);
    while (!found && !stop) {
        str = c_metaObject(type)->name;
        if (str == NULL) {
            found = TRUE; /** assume TRUE **/
        } else if (strcmp(str,name) != 0) {
            switch (c_baseObject(type)->kind) {
            case M_CLASS:
                type = c_type(c_class(type)->extends);
                if (type == NULL) {
                    if ((strcmp(str,"c_base") == 0) && (strcmp(name,"c_module") == 0)) {
                        found = TRUE;
                    }
                    stop = TRUE;
                }
            break;
            case M_TYPEDEF:
                type = c_typeDef(type)->alias;
                if (type == NULL) {
                    stop = TRUE;
                }
            break;
            default:
              stop = TRUE;
            }
        } else {
            found = TRUE;
        }
    }
    if (!found) {
#ifndef NDEBUG
        if(o != NULL){
            str = c_metaObject(c__getType(o))->name;
            OS_REPORT_2(OS_ERROR, "Database", 0,
                    "Type mismatch: object type is %s but %s was expected\n",
                    str,name);
        }
#endif

        return NULL;
    }
    return o;
}
c_bool
__std_msgs_msg_dds__UInt64MultiArray___copyIn(
    c_base base,
    struct ::std_msgs::msg::dds_::UInt64MultiArray_ *from,
    struct _std_msgs_msg_dds__UInt64MultiArray_ *to)
{
    c_bool result = OS_C_TRUE;
    (void) base;

    if(result){
        extern c_bool __std_msgs_msg_dds__MultiArrayLayout___copyIn(c_base, ::std_msgs::msg::dds_::MultiArrayLayout_ *, _std_msgs_msg_dds__MultiArrayLayout_ *);
        result = __std_msgs_msg_dds__MultiArrayLayout___copyIn(base, &from->layout_, &to->layout_);
    }
    {
/* Code generated by /home/erle/opensplice/src/tools/idlpp/code/idl_genCorbaCxxCopyin.c at line 774 */

        static c_type type0 = NULL;
        c_type subtype0;
        c_long length0;
        c_ulonglong *dest0;
        ::std_msgs::msg::dds_::UInt64MultiArray_::_data__seq *src = &from->data_;

        if (type0 == NULL) {
            subtype0 = c_type(c_metaResolve (c_metaObject(base), "c_ulonglong"));
            type0 = c_metaSequenceTypeNew(c_metaObject(base),"C_SEQUENCE<c_ulonglong>",subtype0,0);
            c_free(subtype0);
        }
        length0 = (c_long)(*src).length();
#ifdef OSPL_BOUNDS_CHECK
         dest0 = (c_ulonglong *)c_newSequence(c_collectionType(type0),length0);
        {
        /* Code generated by /home/erle/opensplice/src/tools/idlpp/code/idl_genCorbaCxxCopyin.c at line 1873 */
                    c_ulonglong *buf0;
            buf0 = (c_ulonglong *)(*src).get_buffer();
            memcpy (dest0,buf0,length0* sizeof(*dest0));
        }
        to->data_ = (c_sequence)dest0;
#else
        dest0 = (c_ulonglong *)c_newSequence(c_collectionType(type0),length0);
        {
        /* Code generated by /home/erle/opensplice/src/tools/idlpp/code/idl_genCorbaCxxCopyin.c at line 1873 */
                    c_ulonglong *buf0;
            buf0 = (c_ulonglong *)(*src).get_buffer();
            memcpy (dest0,buf0,length0* sizeof(*dest0));
        }
        to->data_ = (c_sequence)dest0;
#endif
    }
    return result;
}
示例#7
0
static c_type
createTopicKeyType (
    c_type  messageType,
    const c_char *keyExpr)
{
    c_string typeName;
    c_char *name;
    c_long length;
    c_type keyType;
    c_array keyList;
    c_bool proceed;

    keyList = NULL;
    proceed = createMessageKeyList(messageType, keyExpr, &keyList);

    if (proceed) {
        typeName = c_metaName(c_metaObject(messageType));
        length = strlen(typeName) + strlen(keyExpr) + 3;
        name = os_alloca(length);
        snprintf(name,length,"%s<%s>",typeName,keyExpr);
        keyType = createKeyType(name,keyList);
        c_free(typeName);
        os_freea(name);
    } else {
        keyType = NULL;
    }
    c_free(keyList);

    return keyType;
}
/*
 * return the real type (typedef are resoved) for a key (from a keylist).
 * scope should be the data type.
 */
static c_type
idl_getTypeOfKey(
    c_type scope,
    os_char* keyName)
{
    c_iter fields = NULL;
    c_specifier sp;
    char *fieldName;

    /* Key field name consists of [<field>.]*<field> */
    fields = c_splitString(keyName, ".");
    fieldName = c_iterTakeFirst(fields);
    /* find specificer (sp) corresponding to keylist field name */
    while (fieldName != NULL) {
        if (scope) {
            sp = c_specifier(c_metaFindByName(c_metaObject(scope), fieldName, CQ_FIXEDSCOPE | CQ_MEMBER | CQ_CASEINSENSITIVE));
            assert(sp && (strcmp(sp->name, fieldName) == 0));
            scope = sp->type;
        }
        fieldName = c_iterTakeFirst(fields);
    }

    /* now scope is type of key. But it can be typedef. Determine the actual type. */
    return c_typeActualType(scope);
}
示例#9
0
static void
userDataQosPolicyCopyin (
    c_base base,
    const gapi_userDataQosPolicy *src,
    struct v_userDataPolicy      *dst)
{
    static c_type gapi_userData_type = NULL;

    if ( src->value._length > 0 ) {
        if (gapi_userData_type == NULL) {
            c_type type = c_octet_t(base);
            if (type) {
                gapi_userData_type =
                        c_metaArrayTypeNew(c_metaObject(base),
                                           "C_ARRAY<c_octet>",
                                           type,0);
                c_free(type);
            }
        }

        if ( gapi_userData_type ) {
            dst->value = c_newArray(c_collectionType(gapi_userData_type),
                                    src->value._length);
            if ( dst->value ) {
                memcpy(dst->value, src->value._buffer, src->value._length);
            }
        }
    } else {
        dst->value = NULL;
    }
}
void
in_messageDeserializerReadClass(
    in_messageDeserializer _this,
    c_type type,
    c_voidp data)
{
    c_class cls;
    in_messageDeserializerPropertyActionArg arg;

    assert(_this);
    assert(in_messageDeserializerIsValid(_this));
    assert(type);
    assert(data);

    cls = c_class(type);

    arg.object = data;
    arg.transformer = _this; /* no need to increase ref count, obviously */

    /* Walk over all properties of the class */
    c_metaWalk(
        c_metaObject(cls),
        (c_metaWalkAction)in_messageDeserializerReadPropertyAction,
        &arg);
}
示例#11
0
void
v_instanceUnregister (
    v_instance instance,
    v_registration registration,
    c_time timestamp)
{
    c_char* metaName;

    assert(C_TYPECHECK(instance, v_instance));

    switch (v_objectKind(instance)) {
    case K_DATAREADERINSTANCE:
        v_dataReaderInstanceUnregister(v_dataReaderInstance(instance),
                registration, timestamp);
    break;
    default:
        metaName = c_metaName(c_metaObject(c_getType(instance)));
        OS_REPORT_1(OS_ERROR,
                    "v_instanceUnregister",0,
                    "Unknown instance type <%s>",
                    metaName);
        c_free(metaName);
    break;
    }
}
示例#12
0
文件: dbd.c 项目: xrl/opensplice_dds
static void
printWalkHistory (
    c_object o,
    c_iterActionArg arg)
{
    c_type type;
    c_char *name, *ename;

    if (o) {
        type = c_getType(o);
        name = c_metaScopedName(c_metaObject(type));
        printf("<0x%x> %s",(HEXVALUE)o,name);
        if (c_checkType(o, "v_entity") == o) {
            ename = v_entityName(o);
            if (ename != NULL) {
                printf(" /* %s */", ename);
            }
        } else if (c_checkType(o, "c_metaObject") == o) {
            ename = c_metaScopedName(o);
            if (ename != NULL) {
                printf(" /* %s */", ename);
                os_free(ename);
            }
        }
        printf("\n");
    } else {
        printf("<0x0>\n");
    }
}
示例#13
0
static c_metaEquality
c_metaNameCompare (
    c_baseObject baseObject,
    c_metaFindCompareArg arg)
{
    c_findArg farg = (c_findArg)arg;
    c_metaEquality equality = E_UNEQUAL;
    char *name;

    if (CQ_KIND_IN_MASK (baseObject, farg->metaFilter)) {
        if (CQ_KIND_IN_MASK (baseObject, CQ_SPECIFIERS)) {
	    name = c_specifier(baseObject)->name;
        } else if (CQ_KIND_IN_MASK (baseObject, CQ_METAOBJECTS)) {
	    name = c_metaObject(baseObject)->name;
	} else {
	    return equality;
	}
	if (farg->metaFilter & CQ_CASEINSENSITIVE) {
            if (os_strcasecmp (name, (const char *)farg->name) == 0) {
	        equality = E_EQUAL;
	    }
        } else {
            if (strcmp (name, (const char *)farg->name) == 0) {
                equality = E_EQUAL;
            }
	}
    }
    return equality;
}
c_bool
__rcl_interfaces_srv_dds__GetParameterTypes_Response___copyIn(
    c_base base,
    struct ::rcl_interfaces::srv::dds_::GetParameterTypes_Response_ *from,
    struct _rcl_interfaces_srv_dds__GetParameterTypes_Response_ *to)
{
    c_bool result = OS_C_TRUE;
    (void) base;

    {
/* Code generated by /home/erle/opensplice/src/tools/idlpp/code/idl_genCorbaCxxCopyin.c at line 774 */

        static c_type type0 = NULL;
        c_type subtype0;
        c_long length0;
        c_octet *dest0;
        ::rcl_interfaces::srv::dds_::GetParameterTypes_Response_::_types__seq *src = &from->types_;

        if (type0 == NULL) {
            subtype0 = c_type(c_metaResolve (c_metaObject(base), "c_octet"));
            type0 = c_metaSequenceTypeNew(c_metaObject(base),"C_SEQUENCE<c_octet>",subtype0,0);
            c_free(subtype0);
        }
        length0 = (c_long)(*src).length();
#ifdef OSPL_BOUNDS_CHECK
         dest0 = (c_octet *)c_newSequence(c_collectionType(type0),length0);
        {
        /* Code generated by /home/erle/opensplice/src/tools/idlpp/code/idl_genCorbaCxxCopyin.c at line 1873 */
                    c_octet *buf0;
            buf0 = (c_octet *)(*src).get_buffer();
            memcpy (dest0,buf0,length0* sizeof(*dest0));
        }
        to->types_ = (c_sequence)dest0;
#else
        dest0 = (c_octet *)c_newSequence(c_collectionType(type0),length0);
        {
        /* Code generated by /home/erle/opensplice/src/tools/idlpp/code/idl_genCorbaCxxCopyin.c at line 1873 */
                    c_octet *buf0;
            buf0 = (c_octet *)(*src).get_buffer();
            memcpy (dest0,buf0,length0* sizeof(*dest0));
        }
        to->types_ = (c_sequence)dest0;
#endif
    }
    return result;
}
示例#15
0
c_char *
sd_getScopedTypeName(
    c_type type,
    const c_char *separator)
{
    c_string typeName;
    c_metaObject module;
    c_string moduleName;
    c_ulong nameLen;
    c_char *result;
    c_type actualType;
    c_bool hasModuleName;

    actualType = type;
    typeName = c_metaName(c_metaObject(actualType));
    if (typeName) {
        module = c_metaModule(c_metaObject(actualType));
        if (module) {
            moduleName = c_metaName(c_metaObject(module));
            hasModuleName = (moduleName != NULL);
            if (!hasModuleName) {
                moduleName = sd_stringDup("");
            }
            nameLen = strlen(moduleName) +
                      strlen(separator) +
                      strlen(typeName) +
                      1U /* '\0' */;
            result = (c_char *)os_malloc(nameLen);
            snprintf(result, nameLen, "%s%s%s", moduleName, separator, typeName);
            if (hasModuleName) {
                c_free(moduleName);
            } else {
                os_free(moduleName);
            }
            c_free(module);
        } else {
            result = sd_stringDup(typeName);
        }
        c_free(typeName);
    } else {
        result = sd_stringDup(SD_TYPENAME_ANON);
    }

    return result;
}
示例#16
0
static void
idl_checkFinalized(
    c_baseObject o,
    int* unfinalCount) {
    char* name;

    switch(o->kind) {
    case M_STRUCTURE:
    case M_UNION:
        if(!c_isFinal(c_metaObject(o))) {
            name = c_metaScopedName(c_metaObject(o));
            printf("missing implementation for struct\\union %s.\n", name);
            (*unfinalCount)++;
            free(name);
        }
        break;
    default:
        break;
    }
}
示例#17
0
文件: mmfd.c 项目: S73417H/opensplice
static void
toolAction (
    d_storeMMFKernel kernel,
    c_voidp addr)
{
    c_base base;
    c_type type;
    c_char *name;
    c_object o;
    c_address offset;
    c_long size;
    struct toolActionData actionData;

    actionData.fin = stdin;
    actionData.fout = stdout;
    actionData.depth = 0;
    actionData.stack = NULL;

    base = c_getBase(kernel);
    o = c_baseCheckPtr(base, addr);
    if (o) {
        type = c_getType(o);
        size = c_typeSize(type);
        if (o != addr) {
            offset = C_ADDRESS(addr) - C_ADDRESS(o);
            if (offset < (c_address)size) {
                printf("Warning: address is %lu bytes in %s "
                       "object starting at 0x"PA_ADDRFMT"\n",
                       offset, _METANAME(type), (os_address)o);
                OBJECT_PUSH(&actionData, o);
                tryPrintOffset(o,&actionData,offset);
                OBJECT_POP(&actionData);
            } else {
                printf("Warning: address is %lu bytes in "
                       "memory starting at 0x"PA_ADDRFMT"\n",
                   offset, (os_address)o);
            }
        } else {
            name = c_metaScopedName(c_metaObject(type));
            printf("Object <0x"PA_ADDRFMT"> refCount=%d size=%d type is: <0x"PA_ADDRFMT"> %s\n",
                   (os_address)o, c_refCount(o), size, (os_address)type, name);
            os_free(name);
            OBJECT_PUSH(&actionData, o);
            printType(type, &actionData);
            printf("\n");
            OBJECT_POP(&actionData);
        }
    } else {
        printf("Address <0x"PA_ADDRFMT"> is not a Database Object\n",
               (os_address)addr);
    }
}
示例#18
0
c_collectionType
c_fieldRefs_t (
    c_base _this)
{
    if (_this->baseCache.fieldCache.c_fieldRefs_t == NULL) {
        _this->baseCache.fieldCache.c_fieldRefs_t = c_collectionType(
                             c_metaArrayTypeNew(c_metaObject(_this),
                                                "C_ARRAY<c_address>",
                                                c_address_t(_this),
                                                0));
    }
    return _this->baseCache.fieldCache.c_fieldRefs_t;
}
示例#19
0
static void
printCollectionAction(
    c_metaObject mo,
    c_scopeWalkActionArg arg)
{
    c_type type;
    c_object o = c_metaObject (mo);
    toolActionData actionData = (toolActionData)arg;
    c_char *name;

    if (o != NULL) {
        type = c_getType(o);
        name = c_metaScopedName(c_metaObject(type));
        iprintf("Object <0x"PA_ADDRFMT"> refCount=%d type is: <0x"PA_ADDRFMT"> %s\n",
                (os_address)o, c_refCount(o), (os_address)type, name);
        os_free(name);
        OBJECT_PUSH(actionData, o);
        printType(type, actionData);
        printf("\n");
        OBJECT_POP(actionData);
    }
}
示例#20
0
c_collectionType
c_fieldPath_t (
    c_base _this)
{
    if (_this->baseCache.fieldCache.c_fieldPath_t == NULL) {
        _this->baseCache.fieldCache.c_fieldPath_t = c_collectionType(
                             c_metaArrayTypeNew(c_metaObject(_this),
                                                "C_ARRAY<c_base>",
                                                c_getMetaType(_this,M_BASE),
                                                0));
    }
    return _this->baseCache.fieldCache.c_fieldPath_t;
}
示例#21
0
d_storeResult
d_groupInfoDataInject(
    d_groupInfo _this,
    const d_store store,
    d_group group)
{
    d_storeResult result;
    struct d_instanceInjectArg inject;
    c_type mmfMessageType;
    c_char* typeName;

    if(_this && group){
        inject.vgroup = d_groupGetKernelGroup(group);

        mmfMessageType = d_topicInfoGetMessageType(_this->topic);
        typeName = c_metaScopedName(c_metaObject(mmfMessageType));

        inject.messageType = c_type(c_metaResolveType(
                c_metaObject(c_getBase(inject.vgroup)), typeName));

        if(inject.messageType){
            inject.result = D_STORE_RESULT_OK;

            c_tableWalk(_this->instances, d_instanceInject, &inject);

            c_free(inject.messageType);
            result = inject.result;
        } else {
            result = D_STORE_RESULT_PRECONDITION_NOT_MET;
        }
        c_free(inject.vgroup);
        c_free(mmfMessageType);
        os_free(typeName);
    } else {
        result = D_STORE_RESULT_ILL_PARAM;
    }
    return result;
}
示例#22
0
static void
printInterface(
    c_interface interf,
    toolActionData actionData)
{
    c_object o;

    o = c_iterObject(actionData->stack, 0);
    /* Only walk over the properties if the reference is valid. */
    if (o != NULL) {
        iprintf("%s {\n", _METANAME(interf));
        c_metaWalk(c_metaObject(interf),
                   (c_metaWalkAction)walkProperty,
                   actionData);
        iprintf("};");
    }
}
示例#23
0
void
createField(
    v_entity entity,
    c_voidp  argument )
{
    c_type type;
    c_metaObject userData;
    struct createFieldArg * arg = (struct createFieldArg *)argument;

    type = c_resolve(c_getBase(entity), arg->typeName);
    assert(type != NULL);
    userData = c_metaResolve(c_metaObject(type), arg->fieldName);
    c_free(type);

    arg->fieldOffset = c_property(userData)->offset;
    c_free(userData);
}
示例#24
0
static void
getCopyInfo (
    v_entity e,
    c_voidp argument)
{
    v_topic kt;
    c_type sampleType;
    c_property messageAttr;
    _DataReader dataReader = (_DataReader)argument;

    sampleType = v_dataReaderSampleType(v_dataReader(e));
    kt = v_dataReaderGetTopic(v_dataReader(e));
    dataReader->userdataOffset = v_topicDataOffset(kt);
    c_free(kt);
    messageAttr = c_property(c_metaResolve(c_metaObject(sampleType),"message"));
    dataReader->messageOffset = messageAttr->offset;
    c_free(messageAttr);
}
示例#25
0
static c_type
createSampleType(
    c_type messageType,
    const c_char* topicName)
{
    c_base base;
    c_type sampleType, baseType, foundType, found;
    c_metaObject o;
    c_char *name;
    c_long length,sres;

    base = c_getBase(messageType);
    baseType = c_resolve(base, "durabilityModule2::d_sample");
    assert(baseType != NULL);

    sampleType = c_type(c_metaDefine(c_metaObject(base),M_CLASS));
    c_class(sampleType)->extends = c_class(baseType);

    o = c_metaDefine(c_metaObject(sampleType),M_ATTRIBUTE);
    c_property(o)->type = c_keep(messageType);
    found = c_type(c_metaBind(c_metaObject(sampleType),"message",o));
    c_free(o);
    c_free(found);

    c_metaObject(sampleType)->definedIn = c_keep(base);
    c_metaFinalize(c_metaObject(sampleType));

#define SAMPLE_NAME   "d_sample<>"
#define SAMPLE_FORMAT "d_sample<%s>"
    /* Create a name and bind type to name */
    /* The sizeof contains \0 */
    length = sizeof(SAMPLE_NAME) + strlen(topicName);
    name = os_malloc(length);
    sres = snprintf(name,length,SAMPLE_FORMAT,topicName);
    assert(sres == (length-1));
#undef SAMPLE_NAME
#undef SAMPLE_FORMAT

    foundType = c_type(c_metaBind(c_metaObject(base),
                                  name,
                                  c_metaObject(sampleType)));
    os_free(name);
    c_free(sampleType);

    return foundType;
}
示例#26
0
文件: dbd.c 项目: xrl/opensplice_dds
static void
printHistory (
    c_iter history,
    c_long cursor)
{
    c_type type;
    c_object o;
    c_char *name, *ename;

    o = c_iterObject(history,cursor-1);
    type = c_getType(o);
    name = c_metaScopedName(c_metaObject(type));
    printf("<0x%x> %s",(HEXVALUE)o,name);
    if (c_checkType(o, "v_entity") == o) {
        ename = v_entityName(o);
        if (ename != NULL) {
            printf(" /* %s */", ename);
        }
    }
    printf("\n");
}
示例#27
0
/** \brief Routine for the walking over interface attributes */
static void
c_deepwalkInterface(
    c_interface interf,
    c_object *objectPtr,
    c_deepwalkFunc action,
    void *actionArg)
{
    struct c_interfaceContext context;
    c_object *inst;

    /* members are stored in scope (unordered), so use scopeWalk */
    inst = (c_object *)(*objectPtr);
    /* Only walk over the properties if the reference is valid. */
    if (inst && *inst) {
        context.objectPtr = inst;
        context.action = action;
        context.actionArg = actionArg;
        c_metaWalk(c_metaObject(interf),
                   (c_metaWalkAction)c_deepwalkProperty, &context);
    }
}
示例#28
0
c_char *
u_topicTypeName(
    u_topic t)
{
    v_topic kt;
    u_result r;
    c_char *name;


    r = u_entityReadClaim(u_entity(t),(v_entity*)(&kt));
    if (r == U_RESULT_OK) {
        assert(kt);
        name = (c_char *)c_metaScopedName(c_metaObject(v_topicDataType(kt)));
        u_entityRelease(u_entity(t));
    } else {
        OS_REPORT(OS_WARNING, "u_topicTypeName", 0,
                  "Could not claim topic.");
        name = NULL;
    }
    return name;
}
示例#29
0
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;
    }
}
示例#30
0
文件: u_topic.c 项目: osrf/opensplice
os_char *
u_topicTypeName(
    const u_topic _this)
{
    v_topic kt;
    u_result r;
    os_char *name;

    assert(_this);

    r = u_topicReadClaim(_this, &kt, C_MM_RESERVATION_ZERO);
    if (r == U_RESULT_OK) {
        assert(kt);
        name = (c_char *)c_metaScopedName(c_metaObject(v_topicDataType(kt)));
        u_topicRelease(_this, C_MM_RESERVATION_ZERO);
    } else {
        OS_REPORT(OS_WARNING, "u_topicTypeName", r,
                  "Could not claim topic.");
        name = NULL;
    }
    return name;
}