Пример #1
0
mxLogical *mxGetLogicals(const mxArray *ptr)
{
    InternalType *pIT = (InternalType *)ptr;
    if (pIT == NULL)
    {
        return NULL;
    }

    Bool *pB = pIT->getAs<Bool>();
    if (pB == NULL)
    {
        return NULL;
    }

    return (mxLogical *)pB->get();
}
Пример #2
0
double mxGetScalar(const mxArray *ptr)
{
    // TODO: review spec
    InternalType *pIT = (InternalType *)ptr;
    if (pIT == NULL)
    {
        return 0;
    }

    switch (pIT->getType())
    {
        case InternalType::ScilabDouble:
        {
            Double *pD = pIT->getAs<Double>();
            return pD->get(0);
        }
        case InternalType::ScilabBool:
        {
            Bool *pB = pIT->getAs<Bool>();
            return (double)pB->get(0);
        }
        case InternalType::ScilabInt8:
        {
            Int8 *pI = pIT->getAs<Int8>();
            return (double)pI->get(0);
        }
        case InternalType::ScilabUInt8:
        {
            UInt8 *pI = pIT->getAs<UInt8>();
            return (double)pI->get(0);
        }
        case InternalType::ScilabInt16:
        {
            Int16 *pI = pIT->getAs<Int16>();
            return (double)pI->get(0);
        }
        case InternalType::ScilabUInt16:
        {
            UInt16 *pI = pIT->getAs<UInt16>();
            return (double)pI->get(0);
        }
        case InternalType::ScilabInt32:
        {
            Int32 *pI = pIT->getAs<Int32>();
            return (double)pI->get(0);
        }
        case InternalType::ScilabUInt32:
        {
            UInt32 *pI = pIT->getAs<UInt32>();
            return (double)pI->get(0);
        }
        case InternalType::ScilabInt64:
        {
            Int64 *pI = pIT->getAs<Int64>();
            return (double)pI->get(0);
        }
        case InternalType::ScilabUInt64:
        {
            UInt64 *pI = pIT->getAs<UInt64>();
            return (double)pI->get(0);
        }
        default:
            return 0;
    }
}
Пример #3
0
void *mxGetData(const mxArray *ptr)
{
    InternalType *pIT = (InternalType *)ptr;
    if (pIT == NULL)
    {
        return NULL;
    }

    switch (pIT->getType())
    {
        case InternalType::ScilabDouble:
        {
            Double *pD = pIT->getAs<Double>();
            return pD->get();
        }
        case InternalType::ScilabBool:
        {
            Bool *pB = pIT->getAs<Bool>();
            return pB->get();
        }
        case InternalType::ScilabInt8:
        {
            Int8 *pI = pIT->getAs<Int8>();
            return pI->get();
        }
        case InternalType::ScilabUInt8:
        {
            UInt8 *pI = pIT->getAs<UInt8>();
            return pI->get();
        }
        case InternalType::ScilabInt16:
        {
            Int16 *pI = pIT->getAs<Int16>();
            return pI->get();
        }
        case InternalType::ScilabUInt16:
        {
            UInt16 *pI = pIT->getAs<UInt16>();
            return pI->get();
        }
        case InternalType::ScilabInt32:
        {
            Int32 *pI = pIT->getAs<Int32>();
            return pI->get();
        }
        case InternalType::ScilabUInt32:
        {
            UInt32 *pI = pIT->getAs<UInt32>();
            return pI->get();
        }
        case InternalType::ScilabInt64:
        {
            Int64 *pI = pIT->getAs<Int64>();
            return pI->get();
        }
        case InternalType::ScilabUInt64:
        {
            UInt64 *pI = pIT->getAs<UInt64>();
            return pI->get();
        }
        default:
            return NULL;
    }
}