Example #1
0
nitf_TextSubheader_construct(nitf_Error * error)
{
    /*  Start by allocating the header */
    nitf_TextSubheader *subhdr = (nitf_TextSubheader *)
                                 NITF_MALLOC(sizeof(nitf_TextSubheader));

    /*  Return now if we have a problem above */
    if (!subhdr)
    {
        nitf_Error_init(error, NITF_STRERROR(NITF_ERRNO),
                        NITF_CTXT, NITF_ERR_MEMORY);

        return NULL;
    }

    subhdr->extendedSection = NULL;
    subhdr->securityGroup = nitf_FileSecurity_construct(error);
    if (!subhdr->securityGroup)
    {
        nitf_TextSubheader_destruct(&subhdr);
        goto CATCH_ERROR;
    }

    _NITF_CONSTRUCT_FIELD(subhdr, NITF_TE, NITF_BCS_A);
    _NITF_CONSTRUCT_FIELD(subhdr, NITF_TEXTID, NITF_BCS_A);

    _NITF_CONSTRUCT_FIELD(subhdr, NITF_TXTALVL, NITF_BCS_N);

    _NITF_CONSTRUCT_FIELD(subhdr, NITF_TXTDT, NITF_BCS_A);
    _NITF_CONSTRUCT_FIELD(subhdr, NITF_TXTITL, NITF_BCS_A);
    _NITF_CONSTRUCT_FIELD(subhdr, NITF_TSCLAS, NITF_BCS_A);

    _NITF_CONSTRUCT_FIELD(subhdr, NITF_ENCRYP, NITF_BCS_A);
    _NITF_CONSTRUCT_FIELD(subhdr, NITF_TXTFMT, NITF_BCS_A);

    _NITF_CONSTRUCT_FIELD(subhdr, NITF_TXSHDL, NITF_BCS_N);
    _NITF_CONSTRUCT_FIELD(subhdr, NITF_TXSOFL, NITF_BCS_N);

    subhdr->extendedSection = nitf_Extensions_construct(error);
    if (!subhdr->extendedSection)
        goto CATCH_ERROR;

    return subhdr;

CATCH_ERROR:
    nitf_TextSubheader_destruct(&subhdr);
    return NULL;
}
Example #2
0
NITFAPI(nitf_BandInfo *) nitf_BandInfo_construct(nitf_Error * error)
{
    /*  Start by allocating the struct */
    nitf_BandInfo *info =
        (nitf_BandInfo *) NITF_MALLOC(sizeof(nitf_BandInfo));

    /*  Return now if we have a problem above */
    if (!info)
    {
        nitf_Error_init(error, NITF_STRERROR(NITF_ERRNO),
                        NITF_CTXT, NITF_ERR_MEMORY);
        return NULL;
    }

    /* This MUST happen before we construct fields */
    /* in case destruction is required */
    info->lut = NULL;

    _NITF_CONSTRUCT_FIELD(info, NITF_IREPBAND, NITF_BCS_A);
    _NITF_CONSTRUCT_FIELD(info, NITF_ISUBCAT, NITF_BCS_A);
    _NITF_CONSTRUCT_FIELD(info, NITF_IFC, NITF_BCS_A);
    _NITF_CONSTRUCT_FIELD(info, NITF_IMFLT, NITF_BCS_A);
    _NITF_CONSTRUCT_FIELD(info, NITF_NLUTS, NITF_BCS_N);
    _NITF_CONSTRUCT_FIELD(info, NITF_NELUT, NITF_BCS_N);

    return info;

CATCH_ERROR:
    /* destruct if it was allocated */
    if (info)
        nitf_BandInfo_destruct(&info);
    return NULL;
}
Example #3
0
NITFAPI(nitf_RESubheader *) nitf_RESubheader_construct(nitf_Error * error)
{
    /*  Start by allocating the header */
    nitf_RESubheader *subhdr = (nitf_RESubheader *)
                               NITF_MALLOC(sizeof(nitf_RESubheader));

    /*  Return now if we have a problem above */
    if (!subhdr)
    {
        nitf_Error_init(error, NITF_STRERROR(NITF_ERRNO),
                        NITF_CTXT, NITF_ERR_MEMORY);
        goto CATCH_ERROR;
    }

    subhdr->securityGroup = nitf_FileSecurity_construct(error);
    if (!subhdr->securityGroup)
    {
        nitf_RESubheader_destruct(&subhdr);
        goto CATCH_ERROR;
    }

    _NITF_CONSTRUCT_FIELD(subhdr, NITF_RE, NITF_BCS_A);
    _NITF_CONSTRUCT_FIELD(subhdr, NITF_RESTAG, NITF_BCS_A);
    _NITF_CONSTRUCT_FIELD(subhdr, NITF_RESVER, NITF_BCS_N);
    _NITF_CONSTRUCT_FIELD(subhdr, NITF_RESCLAS, NITF_BCS_A);

    _NITF_CONSTRUCT_FIELD(subhdr, NITF_RESSHL, NITF_BCS_N);
    subhdr->subheaderFields = NULL;
    subhdr->dataLength = 0;

    return subhdr;

CATCH_ERROR:
    /* destruct if it was allocated */
    if (subhdr)
        nitf_RESubheader_destruct(&subhdr);
    return NULL;
}
Example #4
0
nitf_GraphicSubheader_construct(nitf_Error * error)
{
    /*  Start by allocating the header */
    nitf_GraphicSubheader *subhdr = (nitf_GraphicSubheader *)
                                    NITF_MALLOC(sizeof(nitf_GraphicSubheader));

    /*  Return now if we have a problem above */
    if (!subhdr)
    {
        nitf_Error_init(error, NITF_STRERROR(NITF_ERRNO),
                        NITF_CTXT, NITF_ERR_MEMORY);
        goto CATCH_ERROR;
    }

    subhdr->extendedSection = NULL;
    subhdr->securityGroup = NULL;
    
    subhdr->securityGroup = nitf_FileSecurity_construct(error);
    if (!subhdr->securityGroup)
        goto CATCH_ERROR;

    _NITF_CONSTRUCT_FIELD(subhdr, NITF_SY, NITF_BCS_A);
    _NITF_CONSTRUCT_FIELD(subhdr, NITF_SID, NITF_BCS_A);
    _NITF_CONSTRUCT_FIELD(subhdr, NITF_SNAME, NITF_BCS_A);
    _NITF_CONSTRUCT_FIELD(subhdr, NITF_SSCLAS, NITF_BCS_A);
    _NITF_CONSTRUCT_FIELD(subhdr, NITF_ENCRYP, NITF_BCS_A);
    _NITF_CONSTRUCT_FIELD(subhdr, NITF_SFMT, NITF_BCS_A);
    _NITF_CONSTRUCT_FIELD(subhdr, NITF_SSTRUCT, NITF_BCS_N);
    _NITF_CONSTRUCT_FIELD(subhdr, NITF_SDLVL, NITF_BCS_N);
    _NITF_CONSTRUCT_FIELD(subhdr, NITF_SALVL, NITF_BCS_N);
    _NITF_CONSTRUCT_FIELD(subhdr, NITF_SLOC, NITF_BCS_N);
    _NITF_CONSTRUCT_FIELD(subhdr, NITF_SBND1, NITF_BCS_N);
    _NITF_CONSTRUCT_FIELD(subhdr, NITF_SCOLOR, NITF_BCS_A);
    _NITF_CONSTRUCT_FIELD(subhdr, NITF_SBND2, NITF_BCS_N);
    _NITF_CONSTRUCT_FIELD(subhdr, NITF_SRES2, NITF_BCS_N);
    _NITF_CONSTRUCT_FIELD(subhdr, NITF_SXSHDL, NITF_BCS_N);
    _NITF_CONSTRUCT_FIELD(subhdr, NITF_SXSOFL, NITF_BCS_N);

    subhdr->extendedSection = nitf_Extensions_construct(error);
    if (!subhdr->extendedSection)
        goto CATCH_ERROR;

    return subhdr;

CATCH_ERROR:
    if (subhdr)
    	nitf_GraphicSubheader_destruct(&subhdr);
    return NULL;
}