text:
export const environment = {
  development: true,
  staging: false,
  testing: false,
  production: false
}

redpajama_set_name: RedPajamaGithub


text:
static void parseCmdLineArgs(int argc, char** argv, const char*& cfgInput, const char*& cfgScope,
                             const char*& secInput, const char*& secScope);
static void usage();

int main(int argc, char** argv)
{
    auto cfg = std::make_unique<FooConfiguration>();
    const char* cfgInput;
    const char* cfgScope;
    const char* secInput;
    const char* secScope;

    setlocale(LC_ALL, "");
    parseCmdLineArgs(argc, argv, cfgInput, cfgScope, secInput, secScope);

    // Parse the configuration file.
    try
    {
        cfg->parse(cfgInput, cfgScope, secInput, secScope);
    }
    catch (const FooConfigurationException& ex)
    {
        std::cerr << ex.what() << "\n";
        return 1;
    }

    // Create some application objects, and set their log levels
    // via configuration.
    auto aObj = std::make_unique<A>(cfg.get());
    auto bObj = std::make_unique<B>(cfg.get());

    // Invoke operations. Diagnostics will be written to standard output.
    aObj->op1();
    aObj->op2();
    aObj->op3();

    bObj->op1();
    bObj->op2();
    bObj->op3();

    return 0;
}

static void parseCmdLineArgs(int argc, char** argv, const char*& cfgInput, const char*& cfgScope, const char*& secInput, const char*& secScope)
{

    cfgInput = "";
    cfgScope = "";
    secInput = "";
    secScope = "";

    for (int i = 1; i < argc; ++i)
    {
        if (strcmp(argv[i], "-h") == 0)
        {
            usage();
        }
        else if (strcmp(argv[i], "-cfg") == 0)
        {
            if (i == argc - 1)
            {
                usage();
            }
            cfgInput = argv[i + 1];
            ++i;
        }
        else if (strcmp(argv[i], "-scope") == 0)
        {
            if (i == argc - 1)
            {
                usage();
            }
            cfgScope = argv[i + 1];
            ++i;
        }
        else if (strcmp(argv[i], "-sec") == 0)
        {
            if (i == argc - 1)
            {
                usage();
            }
            secInput = argv[i + 1];
            ++i;
        }
        else if (strcmp(argv[i], "-secScope") == 0)
        {
            if (i == argc - 1)
            {
                usage();
            }
            secScope = argv[i + 1];
            ++i;
        }
        else
        {
            fprintf(stderr, "Unrecognised option '%s'\n", argv[i]);
            usage();
        }
    }
    if (cfgInput[0] == '\0')
    {
        fprintf(stderr, "You must specify '-cfg <source>'");
        usage();
    }
}

static void usage()
{
    fprintf(stderr,
            "\n"
            "usage: demo <options>\n"
            "\n"
            "The <options> can be:\n"
            "  -h             Print this usage statement\n"
            "  -cfg <source>  Parse specified configuration source\n"
            "  -scope         Configuration scope\n"
            "  -sec <source>  Override default security configuration\n"
            "  -secScope      Security configuration scope\n"
            "\n"
            "A configuration <source> can be one of the following:\n"
            "  file.cfg       A configuration file\n"
            "  file#file.cfg  A configuration file\n"
            "  exec#<command> Output from executing the specified command\n"
            "\n");
    exit(1);
}


text:
package org.opencb.cellbase.core;

import org.codehaus.jackson.map.ObjectMapper;
import org.junit.Before;
import org.junit.Test;
import org.opencb.cellbase.core.config.CellBaseConfiguration;

import static org.junit.Assert.*;

public class CellBaseConfigurationTest {

    CellBaseConfiguration cellBaseConfiguration;

    @Before
    public void setUp() throws Exception {
        cellBaseConfiguration = CellBaseConfiguration.load(CellBaseConfigurationTest.class.getResourceAsStream("/cellBaseProperties_test.json"));
    }

    @Test
    public void load() throws Exception {
        cellBaseConfiguration = CellBaseConfiguration.load(CellBaseConfigurationTest.class.getResourceAsStream("/cellBaseProperties_test.json"));
        System.out.println(new ObjectMapper().writer().withDefaultPrettyPrinter().writeValueAsString(cellBaseConfiguration));
    }

    @Test
    public void defaultOutdir() {
       assertEquals("/tmp", cellBaseConfiguration.getDefaultOutdir());
    }

    @Test
    public void vertebrates() {
        assertEquals(3, cellBaseConfiguration.getSpecies().getVertebrates().size());
    }

    @Test
    public void metazoa() {
        assertEquals(1, cellBaseConfiguration.getSpecies().getMetazoa().size());
    }

    @Test
    public void fungi() {
        assertEquals(1, cellBaseConfiguration.getSpecies().getFungi().size());
    }

    @Test
    public void plants() {
        assertEquals(2, cellBaseConfiguration.getSpecies().getPlants().size());
    }

}


text:
/**
 * FCViz
 * Payload script for summary page - a
 */

window.waitForLogin = (async () => {
  let payload
  while (!payload) {
    try {
      payload = await $.getJSON('https://www.fundingcircle.com/auth/login')
        .then(() => true)
    } catch (err) {
      if (err.status === 404) {
        // Probably the usual FC failure to
        // receive the auth tokens in time, wait a little longer
        console.log('Waiting 500ms for login')
        await setTimeout(() => {}, 500)
      } else {
        console.error(err)
        throw err
      }
    }
  }
  return payload
})()


text:
package com.fleury.metrics.agent.reporter;

import java.util.Map;

/**
 *
 * @author Will Fleury
 */
public class DropwizardMetricSystemProvider implements MetricSystemProvider {

    @Override
    public MetricSystem createMetricSystem(Map<String, Object> configuration) {
        return new DropwizardMetricSystem(configuration);
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="./testcase.xsl"?>
<test_definition>
  <suite category="Tizen Web Device APIs" extension="crosswalk" name="tct-download-tizen-tests">
    <set name="Download" type="js">
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_start_exist" priority="P1" purpose="Check if DownloadManager::start() method exists" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_start_exist.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="start" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_cancel_exist" priority="P1" purpose="Check if DownloadManager::cancel() method exists" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_cancel_exist.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="cancel" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_pause_exist" priority="P1" purpose="Check if DownloadManager::pause() method exists" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_pause_exist.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="pause" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_resume_exist" priority="P1" purpose="Check if DownloadManager::resume() method exists" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_resume_exist.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="resume" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_getState_exist" priority="P1" purpose="Check if DownloadManager::getState() method exists" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_getState_exist.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="getState" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_getState_using" onload_delay="90" priority="P1" purpose="Check if DownloadManager::getState() method returns proper value" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_getState_using.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="getState" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadCallback_onprogress" onload_delay="90" priority="P1" purpose="Test whether the type of each argument is correct for DownloadCallback::onprogress callback" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadCallback_onprogress.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="onprogress" element_type="method" interface="DownloadCallback" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadRequest_destination_attribute" priority="P1" purpose="Check attribute DownloadRequest::destination existence and type" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadRequest_destination_attribute.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="destination" element_type="attribute" interface="DownloadRequest" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadRequest_fileName_attribute" priority="P1" purpose="Check attribute DownloadRequest::fileName existence and type" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadRequest_fileName_attribute.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="fileName" element_type="attribute" interface="DownloadRequest" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_cancel" onload_delay="90" priority="P2" purpose="Check if DownloadManager::cancel() method works" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_cancel.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="cancel" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_getState" onload_delay="90" priority="P2" purpose="Check if DownloadManager::getState() method works" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_getState.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="getState" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_pause" onload_delay="90" priority="P2" purpose="Check if DownloadManager::pause() method works" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_pause.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="pause" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_resume" onload_delay="90" priority="P2" purpose="Check if DownloadManager::resume() method works" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_resume.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="resume" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_start" priority="P2" purpose="Check if DownloadManager::start() method with downloadRequest non-optional argument works" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_start.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="start" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManagerObject_download_exists" priority="P3" purpose="Check if tizen namespace contains download object and DownloadManagerObject interface is not available" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManagerObject_download_exists.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" interface="DownloadManager" section="Content" specification="Download" usage="true" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadRequest_url_attribute" priority="P1" purpose="Check attribute DownloadRequest::url existence and type" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadRequest_url_attribute.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="url" element_type="attribute" interface="DownloadRequest" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_start_with_extra_argument" priority="P1" purpose="Check if DownloadManager::start() method works when extra argument is given" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_start_with_extra_argument.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="start" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_getDownloadRequest_exist" priority="P1" purpose="Check if DownloadManager::getDownloadRequest() method exists" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_getDownloadRequest_exist.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="getDownloadRequest" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_getMIMEType_exist" priority="P1" purpose="Check if DownloadManager::getMIMEType() method exists" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_getMIMEType_exist.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="getMIMEType" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_setListener_exist" priority="P1" purpose="Check if DownloadManager::setListener() method exists" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_setListener_exist.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="setListener" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_getDownloadRequest" onload_delay="90" priority="P2" purpose="Check if DownloadManager::getDownloadRequest() method works" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_getDownloadRequest.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="getDownloadRequest" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_getMIMEType" onload_delay="90" priority="P2" purpose="Check if DownloadManager::getMIMEType() method works" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_getMIMEType.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="getMIMEType" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_setListener" onload_delay="90" priority="P2" purpose="Check if DownloadManager::setListener() method works" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_setListener.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="setListener" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_setListener_null" priority="P2" purpose="Check if DownloadManager::setListener() method throw an TypeMismatchError when downloadId and downloadCallback are null" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_setListener_null.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="setListener" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadRequest_extend" priority="P3" purpose="Check if DownloadRequest object can have new attribute added" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadRequest_extend.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" interface="DownloadRequest" section="Content" specification="Download" usage="true" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadRequest_constructor" priority="P1" purpose="Check if DownloadRequest constructor sets attributes according to arguments given" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadRequest_constructor.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="constructor" element_type="constructor" interface="DownloadRequest" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadRequest_exist" priority="P1" purpose="Check if DownloadRequest constructor exists" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadRequest_exist.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="constructor" element_type="constructor" interface="DownloadRequest" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_setListener_downloadCallback_invalid_cb" onload_delay="90" priority="P2" purpose="Check if DownloadManager::setListener() method throws exception given wrong downloadCallback" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_setListener_downloadCallback_invalid_cb.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="setListener" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_setListener_downloadCallback_TypeMismatch" onload_delay="90" priority="P2" purpose="Check if DownloadManager::setListener() method throws exception for wrong type of downloadCallback" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_setListener_downloadCallback_TypeMismatch.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="setListener" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_setListener_missarg" priority="P2" purpose="Check if DownloadManager::setListener() method with missing non-optional argument throws exception" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_setListener_missarg.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="setListener" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_start_missarg" priority="P2" purpose="Check if DownloadManager::start() method with mandatory argument missing works" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_start_missarg.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="start" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_extend" priority="P3" purpose="Test whether the DownloadManager object can have new attribute added" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_extend.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" interface="DownloadManager" section="Content" specification="Download" usage="true" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadCallback_notexist" priority="P3" purpose="Check if DownloadCallback is NoInterfaceObject and not visible" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadCallback_notexist.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" interface="DownloadCallback" section="Content" specification="Download" usage="true" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_notexist" priority="P3" purpose="Check if DownloadManager is NoInterfaceObject and not visible" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_notexist.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" interface="DownloadManager" section="Content" specification="Download" usage="true" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_in_tizen" priority="P3" purpose="Check if tizen namespace contains download" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_in_tizen.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" interface="DownloadManager" section="Content" specification="Download" usage="true" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_start_downloadCallback_invalid_cb" onload_delay="90" priority="P2" purpose="Check if DownloadManager::start() method throws exception when giving invalid listener" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_start_downloadCallback_invalid_cb.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="start" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_start_downloadRequest_invalid_obj" onload_delay="90" priority="P2" purpose="Check if DownloadManager::start() method throws exception given wrong downloadRequest" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_start_downloadRequest_invalid_obj.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="start" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_start_with_downloadCallback" onload_delay="90" priority="P2" purpose="Check if DownloadManager::start() method with downloadCallback optional argument works" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_start_with_downloadCallback.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="start" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_start_downloadRequest_TypeMismatch" onload_delay="90" priority="P2" purpose="Check if DownloadManager::start() method throws exception for wrong type of downloadRequest" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_start_downloadRequest_TypeMismatch.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="start" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManager_start_downloadCallback_TypeMismatch" onload_delay="90" priority="P2" purpose="Check if DownloadManager::start() method throws exception for wrong type of downloadCallback" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManager_start_downloadCallback_TypeMismatch.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="start" element_type="method" interface="DownloadManager" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadCallback_onpaused" onload_delay="90" priority="P1" purpose="Test whether the type of each argument is correct for DownloadCallback::onpaused callback" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadCallback_onpaused.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="onpaused" element_type="method" interface="DownloadCallback" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadCallback_oncanceled" onload_delay="90" priority="P1" purpose="Test whether the type of each argument is correct for DownloadCallback::oncanceled callback" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadCallback_oncanceled.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="oncanceled" element_type="method" interface="DownloadCallback" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadCallback_oncompleted" onload_delay="90" priority="P1" purpose="Test whether the type of each argument is correct for DownloadCallback::oncompleted callback" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadCallback_oncompleted.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="oncompleted" element_type="method" interface="DownloadCallback" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadCallback_onfailed" onload_delay="90" priority="P1" purpose="Test whether the type of each argument is correct for DownloadCallback::onfailed callback" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadCallback_onfailed.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="onfailed" element_type="method" interface="DownloadCallback" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadRequest_networkType_attribute" priority="P1" purpose="Check attribute DownloadRequest::networkType existence and possible values" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadRequest_networkType_attribute.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="networkType" element_type="attribute" interface="DownloadRequest" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadRequest_httpHeader_attribute" priority="P1" purpose="Check attribute DownloadRequest::httpHeader existence and type" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadRequest_httpHeader_attribute.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" element_name="httpHeader" element_type="attribute" interface="DownloadRequest" section="Content" specification="Download" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
      <testcase component="Tizen Device APIs/Content/Download" execution_type="auto" id="DownloadManagerObject_notexist" priority="P3" purpose="Check if DownloadManagerObject is NoInterfaceObject and not visible" status="approved" type="compliance">
        <description>
          <test_script_entry>/opt/tct-download-tizen-tests/download/DownloadManagerObject_notexist.html</test_script_entry>
        </description>
        <specs>
          <spec>
            <spec_assertion category="Tizen Device API Specifications" interface="DownloadManagerObject" section="Content" specification="Download" usage="true" />
            <spec_url>https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/download.html</spec_url>
            <spec_statement>TBD</spec_statement>
          </spec>
        </specs>
      </testcase>
    </set>
  </suite>
</test_definition>


text:
<?xml version="1.0" encoding="utf-8" ?>
<SmsFormData FormatVersion="1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/SystemsManagementServer/2005/03/ConsoleFramework" xsi:schemaLocation="http://schemas.microsoft.com/SystemsManagementServer/2005/03/ConsoleFramework">
  <Form Id="{3561A8F9-FCB7-4648-936C-6A0B433DC0CB}" FormType="Wizard" DisableSkippable="true">
    <Assembly Name="ConfigMgr.QuickTools.DriverManager" Namespace="ConfigMgr.QuickTools.DriverManager" />
    <Pages>
      <Page VendorId="Otherland" Id="{2FCAC5F7-ADC4-417E-A840-501B5192D432}" Type="HPDriverPackGeneralPage" />
      <Page VendorId="Otherland" Id="{193E2F37-9088-4669-B2C2-342836479976}" Type="HPDriverPackCatalogPage" />
    </Pages>
  </Form>
</SmsFormData>


text:
const int HandSearch::ROTATION_AXIS_NORMAL = 0;
const int HandSearch::ROTATION_AXIS_BINORMAL = 1;
const int HandSearch::ROTATION_AXIS_CURVATURE_AXIS = 2;

HandSearch::HandSearch(Parameters params) : params_(params), plots_samples_(false), plots_local_axes_(false),
  plots_camera_sources_(false)
{
  // Calculate radius for nearest neighbor search.
  Eigen::Vector3d hand_dims;
  hand_dims << params_.hand_outer_diameter_ - params_.finger_width_, params_.hand_depth_, params_.hand_height_ / 2.0;
  nn_radius_ = hand_dims.maxCoeff();
}

std::vector<GraspSet> HandSearch::searchHands(const CloudCamera& cloud_cam, bool plots_normals,
  bool plots_samples) const
{
  if (params_.rotation_axis_ < 0 || params_.rotation_axis_ > 2)
  {
    std::cout << "Parameter <rotation_axis> is not set correctly!\n";
    std::vector<GraspSet> empty(0);
    return empty;
  }

  double t0_total = omp_get_wtime();

  // Create KdTree for neighborhood search.
  const PointCloudRGB::Ptr& cloud = cloud_cam.getCloudProcessed();
  pcl::KdTreeFLANN<pcl::PointXYZRGBA> kdtree;
  kdtree.setInputCloud(cloud);

  // Plot normals and/or samples if desired.
  if (plots_normals)
  {
    std::cout << "Plotting normals ...\n";
    plot_.plotNormals(cloud_cam.getNormals(), cloud_normals_);
  }

  if (plots_samples)
  {
    if (cloud_cam.getSampleIndices().size() > 0)
    {
      std::cout << "Plotting sample indices ...\n";
      plot_.plotSamples(cloud_cam.getSampleIndices(), cloud_cam.getCloudProcessed());
    }
    else if (cloud_cam.getSamples().cols() > 0)
    {
      std::cout << "Plotting samples ...\n";
      plot_.plotSamples(cloud_cam.getSamples(), cloud_cam.getCloudProcessed());
    }
  }

  // 1. Estimate local reference frames.
  std::cout << "Estimating local reference frames ...\n";
  std::vector<LocalFrame> frames;
  FrameEstimator frame_estimator(params_.num_threads_);
  if (cloud_cam.getSamples().cols() > 0)
    frames = frame_estimator.calculateLocalFrames(cloud_cam, cloud_cam.getSamples(), params_.nn_radius_frames_, kdtree);
  else if (cloud_cam.getSampleIndices().size() > 0)
    frames = frame_estimator.calculateLocalFrames(cloud_cam, cloud_cam.getSampleIndices(), params_.nn_radius_frames_, kdtree);
  else
  {
    std::cout << "Error: No samples or no indices!\n";
    std::vector<GraspSet> hypothesis_set_list;
    hypothesis_set_list.resize(0);
    return hypothesis_set_list;
  }

  if (plots_local_axes_)
    plot_.plotLocalAxes(frames, cloud_cam.getCloudOriginal());

  // 2. Evaluate possible hand placements.
  std::cout << "Finding hand poses ...\n";
  std::vector<GraspSet> hypothesis_set_list = evaluateHands(cloud_cam, frames, kdtree);

  std::cout << "====> HAND SEARCH TIME: " << omp_get_wtime() - t0_total << std::endl;

  return hypothesis_set_list;
}

std::vector<Grasp> HandSearch::reevaluateHypotheses(const CloudCamera& cloud_cam, const std::vector<Grasp>& grasps,
  bool plot_samples) const
{
  // create KdTree for neighborhood search
  const Eigen::MatrixXi& camera_source = cloud_cam.getCameraSource();
  const Eigen::Matrix3Xd& cloud_normals = cloud_cam.getNormals();
  const PointCloudRGB::Ptr& cloud = cloud_cam.getCloudProcessed();
  pcl::KdTreeFLANN<pcl::PointXYZRGBA> kdtree;
  kdtree.setInputCloud(cloud);

  if (plot_samples)
  {
    Plot plotter;
    Eigen::Matrix3Xd samples(3, grasps.size());
    for (int i = 0; i < grasps.size(); i++)
    {
      samples.col(i) = grasps[i].getSample();
    }

    plotter.plotSamples(samples, cloud);
  }

  std::vector<int> nn_indices;
  std::vector<float> nn_dists;
  Eigen::Matrix3Xd points = cloud->getMatrixXfMap().block(0, 0, 3, cloud->size()).cast<double>();
  PointList point_list(points, cloud_normals, camera_source, cloud_cam.getViewPoints());
  PointList nn_points;
  std::vector<int> labels(grasps.size()); // -1: not feasible, 0: feasible, >0: see Antipodal class

#ifdef _OPENMP // parallelization using OpenMP
#pragma omp parallel for private(nn_indices, nn_dists, nn_points) num_threads(params_.num_threads_)
#endif
  for (int i = 0; i < grasps.size(); i++)
  {
    labels[i] = 0;
    pcl::PointXYZRGBA sample = eigenVectorToPcl(grasps[i].getSample());

    if (kdtree.radiusSearch(sample, nn_radius_, nn_indices, nn_dists) > 0)
    {
      nn_points = point_list.slice(nn_indices);
      nn_points.setPoints(nn_points.getPoints() - grasps[i].getSample().replicate(1, nn_points.size()));
      PointList nn_points_frame;
      FingerHand finger_hand(params_.finger_width_, params_.hand_outer_diameter_, params_.hand_depth_);

      // set the lateral and forward axes of the robot hand frame (closing direction and grasp approach direction)
      if (params_.rotation_axis_ == ROTATION_AXIS_CURVATURE_AXIS)
      {
        finger_hand.setLateralAxis(1);
        finger_hand.setForwardAxis(0);
      }

      // check if the grasp is feasible (collision-free and contains at least one point)
      if (reevaluateHypothesis(nn_points, grasps[i], finger_hand, nn_points_frame))
      {
        // label the grasp
        labels[i] = labelHypothesis(nn_points_frame, finger_hand);
      }
    }
  }

  // remove empty list elements
  std::vector<Grasp> grasps_out;
  for (std::size_t i = 0; i < labels.size(); i++)
  {
    grasps_out.push_back(grasps[i]);
    bool is_half_grasp = labels[i] == Antipodal::FULL_GRASP || labels[i] == Antipodal::HALF_GRASP;
    grasps_out[grasps_out.size()-1].setHalfAntipodal(is_half_grasp);
    grasps_out[grasps_out.size()-1].setFullAntipodal(labels[i] == Antipodal::FULL_GRASP);
  }

  return grasps_out;
}

pcl::PointXYZRGBA HandSearch::eigenVectorToPcl(const Eigen::Vector3d& v) const
{
  pcl::PointXYZRGBA p;
  p.x = v(0);
  p.y = v(1);
  p.z = v(2);
  return p;
}

std::vector<GraspSet> HandSearch::evaluateHands(const CloudCamera& cloud_cam, const std::vector<LocalFrame>& frames,
  const pcl::KdTreeFLANN<pcl::PointXYZRGBA>& kdtree) const
{
  double t1 = omp_get_wtime();

  // possible angles used for hand orientations
  Eigen::VectorXd angles_space = Eigen::VectorXd::LinSpaced(params_.num_orientations_ + 1, -1.0 * M_PI/2.0, M_PI/2.0);

  // necessary b/c assignment in Eigen does not change vector size
  Eigen::VectorXd angles = angles_space.head(params_.num_orientations_);

  std::vector<int> nn_indices;
  std::vector<float> nn_dists;
  const PointCloudRGB::Ptr& cloud = cloud_cam.getCloudProcessed();
  Eigen::Matrix3Xd points = cloud->getMatrixXfMap().block(0, 0, 3, cloud->size()).cast<double>();
  std::vector<GraspSet> hand_set_list(frames.size());
  PointList point_list(points, cloud_cam.getNormals(), cloud_cam.getCameraSource(), cloud_cam.getViewPoints());
  PointList nn_points;
  GraspSet::HandGeometry hand_geom(params_.finger_width_, params_.hand_outer_diameter_, params_.hand_depth_,
    params_.hand_height_, params_.init_bite_);
//  GraspSet hand_set(hand_geom, angles, params_.rotation_axis_);

#ifdef _OPENMP // parallelization using OpenMP
#pragma omp parallel for private(nn_indices, nn_dists, nn_points) num_threads(params_.num_threads_)
#endif
  for (std::size_t i = 0; i < frames.size(); i++)
  {
    pcl::PointXYZRGBA sample = eigenVectorToPcl(frames[i].getSample());

    if (kdtree.radiusSearch(sample, nn_radius_, nn_indices, nn_dists) > 0)
    {
      nn_points = point_list.slice(nn_indices);
      nn_points.setPoints(nn_points.getPoints() - frames[i].getSample().replicate(1, nn_points.size()));

      GraspSet hand_set(hand_geom, angles, params_.rotation_axis_);
      hand_set.evaluateHypotheses(nn_points, frames[i]);

      if (hand_set.getIsValid().any()) // at least one feasible hand
      {
        hand_set_list[i] = hand_set;
      }
    }
  }

  // concatenate the grasp lists
  std::vector<GraspSet> hand_set_list_out;
  for (std::size_t i = 0; i < hand_set_list.size(); i++)
  {
    if (hand_set_list[i].getIsValid().any())
    {
      hand_set_list_out.push_back(hand_set_list[i]);
    }
  }

  double t2 = omp_get_wtime();
  std::cout << " Found " << hand_set_list_out.size() << " grasp candidate sets in " << t2 - t1 << " sec.\n";

  return hand_set_list_out;
}

bool HandSearch::reevaluateHypothesis(const PointList& point_list, const Grasp& hand,
  FingerHand& finger_hand, PointList& point_list_cropped) const
{
  // Transform points into hand frame and crop them on <hand_height>.
  PointList point_list_frame = point_list.rotatePointList(hand.getFrame().transpose());
  point_list_cropped = point_list_frame.cropByHandHeight(params_.hand_height_);

  // Check that the finger placement is possible.
  finger_hand.evaluateFingers(point_list_cropped.getPoints(), hand.getTop(), hand.getFingerPlacementIndex());
  finger_hand.evaluateHand(hand.getFingerPlacementIndex());

  if (finger_hand.getHand().any())
  {
    return true;
  }

  return false;
}

int HandSearch::labelHypothesis(const PointList& point_list, FingerHand& finger_hand) const
{
  std::vector<int> indices_learning = finger_hand.computePointsInClosingRegion(point_list.getPoints());
  if (indices_learning.size() == 0)
  {
    return Antipodal::NO_GRASP;
  }

  // extract data for classification
  PointList point_list_learning = point_list.slice(indices_learning);

  // evaluate if the grasp is antipodal
  Antipodal antipodal;
  int antipodal_result = antipodal.evaluateGrasp(point_list_learning, 0.003, finger_hand.getLateralAxis(),
    finger_hand.getForwardAxis(), params_.rotation_axis_);

  return antipodal_result;
}