def insert_new_finger(finger, finger_list, interface):
    """
    @brief Inserts a finger into the database if it does not exist in a list of known fingers

    @param finger - The Finger to add
    @param finger_list - The list of Fingers to compare the new finger to.
    @param interface - The database interface to use to add the finger. 
    """
    if(not eigenhand_db_objects.find_equivalent_finger(finger_list, finger)):
        return interface.add_finger_to_db(finger)
    return -1
Exemple #2
0
def insert_new_finger(finger, finger_list, interface):
    """
    @brief Inserts a finger into the database if it does not exist in a list of known fingers

    @param finger - The Finger to add
    @param finger_list - The list of Fingers to compare the new finger to.
    @param interface - The database interface to use to add the finger. 
    """
    if (not eigenhand_db_objects.find_equivalent_finger(finger_list, finger)):
        return interface.add_finger_to_db(finger)
    return -1
def insert_unique_finger(interface, finger, finger_list):
    """
    @brief insert a finger in to the database if it does not already exist in this list of fingers.
    otherwise, it simply sets the id of the given finger to the similar finger found in the database.

    FIXME - Maybe the test for uniqueness should be on the database server side instead of maintaining a unique list
    This is probably really inefficient as we do it so many times, but it doesn't occur during the blocking phase of the experiment
    For longer experiments where the number of fingers becomes astronomically large, this could really be a problem

    @param finger - the Finger to install
    @param finger_list - The list of fingers to test against. 
    """
    equivalent_finger = eigenhand_db_objects.find_equivalent_finger(finger_list, finger)
    if(equivalent_finger):
        return equivalent_finger
    
    finger = cp.deepcopy(finger)
    finger.finger_id = interface.add_finger_to_db(finger)[0]
    return finger
Exemple #4
0
def insert_unique_finger(interface, finger, finger_list):
    """
    @brief insert a finger in to the database if it does not already exist in this list of fingers.
    otherwise, it simply sets the id of the given finger to the similar finger found in the database.

    FIXME - Maybe the test for uniqueness should be on the database server side instead of maintaining a unique list
    This is probably really inefficient as we do it so many times, but it doesn't occur during the blocking phase of the experiment
    For longer experiments where the number of fingers becomes astronomically large, this could really be a problem

    @param finger - the Finger to install
    @param finger_list - The list of fingers to test against. 
    """
    equivalent_finger = eigenhand_db_objects.find_equivalent_finger(
        finger_list, finger)
    if (equivalent_finger):
        return equivalent_finger

    finger = cp.deepcopy(finger)
    finger.finger_id = interface.add_finger_to_db(finger)[0]
    return finger