/// <summary>
 ///  Recursively load data into the tuple current being loaded.
 /// </summary>
 /// <param name="handler">The handler constructing the current element.</param>
 /// <param name="schema">Schema of tuple being constructed.</param>
 /// <param name="row">Data source for tuple to construct.</param>
 /// <param name="absIndex">Absolute index into <code>row</code> for the next column to process.</param>
 /// <returns>The updated absolute index.</returns>
 private int fillTuple(OplDataHandler handler, ITupleSchema schema, IRow row, int absIndex)
 {
     handler.StartTuple();
     for (int i = 0; i < schema.Size; ++i)
     {
         if (schema.IsTuple(i))
         {
             ILOG.Opl_Core.Cppimpl.IloTupleSchema s = (ILOG.Opl_Core.Cppimpl.IloTupleSchema)schema;
             absIndex = fillTuple(handler, s.getTupleColumn(i), row, absIndex);
             continue;
         }
         if (schema.IsNum(i))
         {
             SET_FLOAT(handler, row, absIndex);
         }
         else if (schema.IsInt(i))
         {
             SET_INT(handler, row, absIndex);
         }
         else if (schema.IsSymbol(i))
         {
             SET_STRING(handler, row, absIndex);
         }
         else
         {
             throw new NotImplementedException("tuple element type not supported");
         }
         ++absIndex;
     }
     handler.EndTuple();
     return(absIndex);
 }
    /// <summary>
    ///  Look for a string field in a tuple and return its value.
    /// </summary>
    /// <param name="tuple">The tuple to search.</param>
    /// <param name="field">The name of the field to find.</param>
    /// <param name="def">The value to return if the field is not found or is not of string type.</param>
    /// <returns></returns>
    private static string tryLoadField(ITuple tuple, String field, string def = null)
    {
        ITupleSchema schema = tuple.Schema;
        int          size   = schema.Size;

        for (int i = 0; i < size; ++i)
        {
            if (schema.IsSymbol(i) && field.Equals(schema.GetColumnName(i)))
            {
                return(tuple.GetStringValue(i));
            }
        }
        return(def);
    }