/*
   HARK Library
   Copyright (C) 2021 Honda Research Institute Japan Inc.
 */

#if !defined(_HARKLIB_NODE_COMBINE_MAP_H_INCLUDED_)
#define _HARKLIB_NODE_COMBINE_MAP_H_INCLUDED_ 1

#include "hark-lib/hark-lib.h"
#include "hark-lib/node.h"
#include "hark-lib/matrix.h"

namespace hark
{
namespace node
{
    class CombineMap: public NodeDef
    {
    public:
        CombineMap();

        void initialize(InputDataBundle &input);
        virtual void reset();
        virtual bool operator () (size_t count, InputDataBundle &input, OutputDataBundle &output);

    private:
        enum class HANDLING_MODE : int64_t {
            IGNORE = 0,
            PRIORITIZE_INPUT1 = 1,
            PRIORITIZE_INPUT2 = 2,
            USE_OFFSET = 3
        };
        //enum class INPUT_PRIORITY : int64_t {
        //    PRIORITY_TOP = 0,
        //    PRIORITY_BOTTOM = 1
        //};

        // LSB to MSB each 4bits description
        // element size: 0:unknown, 1:8bit, 2:16bit, 3:32bit, 4:64bit, 5:128bit, 6:256bit, 7:512bit, 8:1024bit, 9-D:reserve, E:variable, F:other
        // numeric representation(complex, quaternions, etc...): 0:unknown, 1:primitive, 2:std::complex, 3-D:reserve, E:irrelecant, F:other
        // providing signs: 0:unknown, 1:floating_point, 2:signed, 3:unsigned, 4-D:reserve, E:irrelecant, F:other
        // container type: 0:unknown, 1:std::vector, 2:hark::Matrix, E:no container, F:other class
        enum class INPUT_TYPE : int64_t {
            INPUT_UNDECIDED                = 0x0000000000000000,
            INPUT_VECTOR_UNKNOWN           = 0x0000000000001000,
            INPUT_VECTOR_HALF              = 0x0000000000001112,
            INPUT_VECTOR_FLOAT             = 0x0000000000001113,
            INPUT_VECTOR_DOUBLE            = 0x0000000000001114,
            INPUT_VECTOR_QUAD              = 0x0000000000001115,
            INPUT_VECTOR_COMPLEX_HALF      = 0x0000000000001122,
            INPUT_VECTOR_COMPLEX_FLOAT     = 0x0000000000001123,
            INPUT_VECTOR_COMPLEX_DOUBLE    = 0x0000000000001124,
            INPUT_VECTOR_COMPLEX_QUAD      = 0x0000000000001125,
            INPUT_MATRIX_UNKNOWN           = 0x0000000000002000,
            INPUT_MATRIX_HALF              = 0x0000000000002112,
            INPUT_MATRIX_FLOAT             = 0x0000000000002113,
            INPUT_MATRIX_DOUBLE            = 0x0000000000002114,
            INPUT_MATRIX_QUAD              = 0x0000000000002115,
            INPUT_MATRIX_COMPLEX_HALF      = 0x0000000000002122,
            INPUT_MATRIX_COMPLEX_FLOAT     = 0x0000000000002123,
            INPUT_MATRIX_COMPLEX_DOUBLE    = 0x0000000000002124,
            INPUT_MATRIX_COMPLEX_QUAD      = 0x0000000000002125,
            INPUT_PRIMITIVE_UNKNOWN        = 0x000000000000E000,
            INPUT_PRIMITIVE_HALF           = 0x000000000000E112,
            INPUT_PRIMITIVE_FLOAT          = 0x000000000000E113,
            INPUT_PRIMITIVE_DOUBLE         = 0x000000000000E114,
            INPUT_PRIMITIVE_QUAD           = 0x000000000000E115,
            INPUT_PRIMITIVE_COMPLEX_HALF   = 0x000000000000E122,
            INPUT_PRIMITIVE_COMPLEX_FLOAT  = 0x000000000000E123,
            INPUT_PRIMITIVE_COMPLEX_DOUBLE = 0x000000000000E124,
            INPUT_PRIMITIVE_COMPLEX_QUAD   = 0x000000000000E125,
            INPUT_PRIMITIVE_CHAR           = 0x000000000000E211,
            INPUT_PRIMITIVE_SHORT          = 0x000000000000E212,
            INPUT_PRIMITIVE_INT            = 0x000000000000E213,
            INPUT_PRIMITIVE_LONG           = 0x000000000000E214,
            INPUT_PRIMITIVE_LLONG          = 0x000000000000E215,
            INPUT_PRIMITIVE_UNSIGNED_CHAR  = 0x000000000000E311,
            INPUT_PRIMITIVE_UNSIGNED_SHORT = 0x000000000000E312,
            INPUT_PRIMITIVE_UNSIGNED_INT   = 0x000000000000E313,
            INPUT_PRIMITIVE_UNSIGNED_LONG  = 0x000000000000E314,
            INPUT_PRIMITIVE_UNSIGNED_LLONG = 0x000000000000E315,
            INPUT_PRIMITIVE_BOOL           = 0x000000000000EE1F,
            INPUT_PRIMITIVE_INT8           = 0x000000000000F211,
            INPUT_PRIMITIVE_INT16          = 0x000000000000F212,
            INPUT_PRIMITIVE_INT32          = 0x000000000000F213,
            INPUT_PRIMITIVE_INT64          = 0x000000000000F214,
            INPUT_PRIMITIVE_INT128         = 0x000000000000F215,
            INPUT_PRIMITIVE_UINT8          = 0x000000000000F311,
            INPUT_PRIMITIVE_UINT16         = 0x000000000000F312,
            INPUT_PRIMITIVE_UINT32         = 0x000000000000F313,
            INPUT_PRIMITIVE_UINT64         = 0x000000000000F314,
            INPUT_PRIMITIVE_UINT128        = 0x000000000000F315,
            INPUT_STRING                   = 0x000000000000FEEE,
        };

        HANDLING_MODE handling_mode;
        INPUT_TYPE type;
        int input1_offset;
        int input2_offset;
        bool debug;
    };
}
}

#endif /* #if !defined(_HARKLIB_NODE_COMBINE_MAP_H_INCLUDED_) */

/* end of file */
