ncFifoCreate()

Info Value
Header mvnc.h
Library libmvnc.so
Version 2.0
See also struct ncFifoHandle_t, ncFifoAllocate(), ncFifoDestroy()

Overview

This function initializes a ncFifoHandle_t struct.

Typically, two FIFOs are created for each network graph - one for input and one for output.

ncFifoDestroy() frees the memory that is allocated with this function.

Prototype

ncStatus_t ncFifoCreate(const char* name, ncFifoType_t type, struct ncFifoHandle_t** fifoHandle);

Parameters

Name Type Description
name const char* A null-terminated array of characters that specify a name for the FIFO; this can be can be anything you like up to NC_MAX_NAME_SIZE characters, or just an empty string.

The name can be retrieved later with ncFifoGetOption().
type ncFifoType_t A member of the ncFifoType_t enumeration that specifies the FIFO access type. The API should be able to write to input FIFOs and read from output FIFOs.
fifoHandle struct ncFifoHandle_t** The address of a pointer to a ncFifoHandle_t struct that will be created and initialized by this function.

Return

An appropriate value from the ncStatus_t enumeration.

Notes

Example

#include <stdio.h>
#include <stdlib.h>
#include <mvnc.h>

int main(int argc, char** argv)
{
    ncStatus_t retCode;
    struct ncDeviceHandle_t* deviceHandlePtr = NULL;
    struct ncGraphHandle_t* graphHandlePtr = NULL;
    struct ncFifoHandle_t* inFifoHandlePtr = NULL;

    ncDeviceCreate(0, &deviceHandlePtr);
    ncDeviceOpen(deviceHandlePtr);
    ncGraphCreate("My Graph", &graphHandlePtr);
    
    ncFifoCreate("MY Input FIFO", NC_FIFO_HOST_WO, &inFifoHandlePtr);
    if (retCode != NC_OK)
    {   // Could not create FIFO 
        printf("Error creating FIFO [%d]\n", retCode);
    }
    else
    {
        // FIFO created write only FIFO.  
        // Now allocate it and then Write graph input to it and then queue inferences. 
        printf("FIFO created OK!\n");
    }

    // clean up the graph and device
    ncFifoDestroy(&inFifoHandlePtr);
    ncGraphDestroy(&graphHandlePtr);
    ncDeviceClose(deviceHandlePtr);
    ncDeviceDestroy(&deviceHandlePtr);
}