text:
#include "fsl_smc_hal.h"

/*******************************************************************************
 * Definitions
 ******************************************************************************/

/*******************************************************************************
 * Code
 ******************************************************************************/
/*FUNCTION**********************************************************************
 *
 * Function Name : SMC_HAL_SetMode
 * Description   : Config the power mode
 * This function will configure the power mode control for any run, stop and
 * stop submode if needed. It will also configure the power options for specific
 * power mode. Application should follow the proper procedure to configure and
 * switch power mode between the different run and stop mode. Refer to reference
 * manual for the proper procedure and supported power mode that can be configured
 * and switch between each other. Refert to smc_power_mode_config_t for required
 * parameters to configure the power mode and the supported options. Other options
 * may need to configure through the hal driver individaully. Refer to hal driver
 * header for details.
 *
 *END**************************************************************************/
smc_hal_error_code_t SMC_HAL_SetMode(uint32_t baseAddr, const smc_power_mode_config_t *powerModeConfig)
{
    smc_hal_error_code_t retCode = kSmcHalSuccess;
    uint8_t currentStat;
    volatile unsigned int dummyread;
    smc_stop_mode_t stopMode;
    smc_run_mode_t runMode;
    power_mode_stat_t modeStat;
    power_modes_t powerModeName = powerModeConfig->powerModeName;

    /* verify the power mode name*/
    assert(powerModeName < kPowerModeMax);

    currentStat = SMC_HAL_GetStat(baseAddr);

#if  FSL_FEATURE_SMC_HAS_LPWUI
    /* check lpwui option*/
    if (powerModeConfig->lpwuiOption)
    {
        /* check current stat*/
        /* if not in VLPR stat, could not set to RUN*/
        if (currentStat == kStatRun)
        {
            SMC_HAL_SetLpwuiMode(baseAddr, powerModeConfig->lpwuiOptionValue);
        }
    }
#endif

    /* branch based on power mode name*/
    switch (powerModeName)
    {
    case kPowerModeRun:
        /* Set to RUN mode. */
        SMC_HAL_SetRunMode(baseAddr, kSmcRun);
        while (kStatRun != SMC_HAL_GetStat(baseAddr)) {} // Wait for stat change
        break;
    case kPowerModeVlpr:
        if (kStatRun != currentStat)
        {
            /* Can only change to VLPR when RUN. */
            retCode = kSmcHalFailed;
        }
        else
        {
            /* set power mode to VLPR*/
            SMC_HAL_SetRunMode(baseAddr, kSmcVlpr);
            /* Wait for stat change */
            while (kStatVlpr != SMC_HAL_GetStat(baseAddr)) {}
        }
        break;

#if FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE
    case kPowerModeHsrun:
        if (kStatRun != currentStat)
        {
            /* Can only change to HSRUN when RUN. */
            retCode = kSmcHalFailed;
        }
        else
        {
            /* set power mode to HSRUN */
            SMC_HAL_SetRunMode(baseAddr, kSmcHsrun);
            /* Wait for stat change */
            while (kStatHsrun != SMC_HAL_GetStat(baseAddr)) {}
        }
        break;
#endif

    case kPowerModeWait:
    case kPowerModeVlpw:
        if (powerModeName == kPowerModeWait)
        {
            /* mode setting for normal RUN*/
            runMode = kSmcRun;
            modeStat = kStatRun;
        }
        else
        {
            /* mode setting for VLPR*/
            runMode = kSmcVlpr;
            modeStat = kStatVlpr;
        }

        /* check current stat*/
        currentStat = SMC_HAL_GetStat(baseAddr);

        if (currentStat != modeStat)
        {
            /* if not in the mode, return error*/
            retCode = kSmcHalFailed;
        }
        else
        {
            /* set power mode to normal RUN or VLPR mode first*/
            SMC_HAL_SetRunMode(baseAddr, runMode);
        }

        if (retCode == kSmcHalSuccess)
        {
            /* Clear the SLEEPDEEP bit to disable deep sleep mode - enter wait mode*/
            SCB->SCR &= ~SCB_SCR_SLEEPDEEP_Msk;
            __WFI();
        }
        break;

    case kPowerModeStop:
    case kPowerModeVlps:
    case kPowerModeLls:
        if (powerModeName == kPowerModeStop)
        {
#if FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE
            /* check current stat*/
            currentStat = SMC_HAL_GetStat(baseAddr);

            if ((currentStat == kStatHsrun) || (SMC_HAL_GetRunMode(baseAddr) == kSmcHsrun))
            {
                retCode = kSmcHalFailed;
                break;
            }
#endif
            stopMode = kSmcStop;
#if FSL_FEATURE_SMC_HAS_PSTOPO
            if (powerModeConfig->pstopOption)
            {
                SMC_HAL_SetPstopMode(baseAddr, powerModeConfig->pstopOptionValue);
            }
#endif
        }
#if FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE
        else if (powerModeName == kPowerModeLls)
        {
            stopMode = kSmcLls;
#if FSL_FEATURE_SMC_HAS_RAM2_POWER_OPTION
        /* check if Lls2 option needs configuration*/
        if (powerModeConfig->stopSubMode == kSmcStopSub2)
        {
            if (powerModeConfig->ram2Option)
            {
                SMC_HAL_SetRam2Mode(baseAddr, powerModeConfig->ram2OptionValue);
            }
        }
#endif
        }
#endif
        else
        {
            stopMode = kSmcVlps;
        }

        /* set power mode to specified STOP mode*/
        SMC_HAL_SetStopMode(baseAddr, stopMode);

#if FSL_FEATURE_SMC_HAS_LLS_SUBMODE
        if (powerModeName == kPowerModeLls)
        {
            /* further set the stop sub mode configuration*/
            SMC_HAL_SetStopSubMode(baseAddr, powerModeConfig->stopSubMode);
        }
#endif

        /* wait for write to complete to SMC before stopping core  */
        dummyread = SMC_HAL_GetStat(baseAddr);
        dummyread = dummyread + 1;

        /* Set the SLEEPDEEP bit to enable deep sleep mode (STOP)*/
        SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
        __WFI();

        break;

    case kPowerModeVlls:
        /* set power mode to specified STOP mode*/
        SMC_HAL_SetStopMode(baseAddr, kSmcVlls);

        /* further set the stop sub mode configuration*/
        SMC_HAL_SetStopSubMode(baseAddr, powerModeConfig->stopSubMode);

        /* check if Vlls0 option needs configuration*/
        if (powerModeConfig->stopSubMode == kSmcStopSub0)
        {
#if FSL_FEATURE_SMC_HAS_PORPO
            if (powerModeConfig->porOption)
            {
                SMC_HAL_SetPorMode(baseAddr, powerModeConfig->porOptionValue);
            }
#endif
        }

#if FSL_FEATURE_SMC_HAS_RAM2_POWER_OPTION
        /* check if Vlls2 option needs configuration*/
        if (powerModeConfig->stopSubMode == kSmcStopSub2)
        {
            if (powerModeConfig->ram2Option)
            {
                SMC_HAL_SetRam2Mode(baseAddr, powerModeConfig->ram2OptionValue);
            }
        }
#endif

#if FSL_FEATURE_SMC_HAS_LPOPO
        /* check if Vllsx option needs configuration*/
        if (powerModeConfig->lpoOption)
        {
            SMC_HAL_SetLpoMode(baseAddr, powerModeConfig->lpoOptionValue);
        }
#endif

        /* wait for write to complete to SMC before stopping core  */
        dummyread = SMC_HAL_GetStat(baseAddr);
        dummyread = dummyread + 1;

        /* Set the SLEEPDEEP bit to enable deep sleep mode (STOP)*/
        SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk;
        __WFI();

        break;
    default:
        retCode = kSmcHalNoSuchModeName;
        break;
    }

    return retCode;
}

/*FUNCTION**********************************************************************
 *
 * Function Name : SMC_HAL_SetProtection
 * Description   : Config all power mode protection settings
 * This function will configure the power mode protection settings for
 * supported power mode on the specified chip family. The availabe power modes
 * are defined in smc_power_mode_protection_config_t. Application should provide
 * the protect settings for all supported power mode on the chip and aslo this
 * should be done at early system level init stage. Refer to reference manual
 * for details. This register can only write once after power reset. So either
 * use this function or use the individual set function if you only have single
 * option to set.
 *
 *END**************************************************************************/
void SMC_HAL_SetProtection(uint32_t baseAddr, smc_power_mode_protection_config_t *protectConfig)
{
    /* initialize the setting */
    uint8_t regValue = 0;

    /* check configurations for each mode and combine the seting together */
    if (protectConfig->vlpProt)
    {
        regValue |= BF_SMC_PMPROT_AVLP(1);
    }

#if FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE
    if (protectConfig->llsProt)
    {
        regValue |= BF_SMC_PMPROT_ALLS(1);
    }
#endif

    if (protectConfig->vllsProt)
    {
        regValue |= BF_SMC_PMPROT_AVLLS(1);
    }

#if FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE
    if (protectConfig->hsrunProt)
    {
        regValue |= BF_SMC_PMPROT_AHSRUN(1);
    }
#endif

    /* write once into pmprot register*/
    HW_SMC_PMPROT_SET(baseAddr, regValue);
}

/*FUNCTION**********************************************************************
 *
 * Function Name : SMC_HAL_SetProtectionMode
 * Description   : Config the individual power mode protection setting
 * This function will only configure the power mode protection settings for
 * a specified power mode on the specified chip family. The availabe power modes
 * are defined in smc_power_mode_protection_config_t. Refer to reference manual
 * for details. This register can only write once after power reset.
 *
 *END**************************************************************************/
void SMC_HAL_SetProtectionMode(uint32_t baseAddr, power_modes_protect_t protect, bool allow)
{
    /* check the setting range */
    assert(protect < kAllowMax);

    /* branch according to mode and write the setting */
    switch (protect)
    {
    case kAllowVlp:
        if (allow)
        {
            BW_SMC_PMPROT_AVLP(baseAddr, 1);
        }
        else
        {
            BW_SMC_PMPROT_AVLP(baseAddr, 0);
        }
        break;
#if FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE
    case kAllowLls:
        if (allow)
        {
            BW_SMC_PMPROT_ALLS(baseAddr, 1);
        }
        else
        {
            BW_SMC_PMPROT_ALLS(baseAddr, 0);
        }
        break;
#endif
    case kAllowVlls:
        if (allow)
        {
            BW_SMC_PMPROT_AVLLS(baseAddr, 1);
        }
        else
        {
            BW_SMC_PMPROT_AVLLS(baseAddr, 0);
        }
        break;
#if FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE
    case kAllowHsrun:
        if (allow)
        {
            BW_SMC_PMPROT_AHSRUN(baseAddr, 1);
        }
        else
        {
            BW_SMC_PMPROT_AHSRUN(baseAddr, 0);
        }
        break;
#endif
    default:
        break;
    }
}

/*FUNCTION**********************************************************************
 *
 * Function Name : SMC_HAL_GetProtectionMode
 * Description   : Get the current power mode protection setting
 * This function will get the current power mode protection settings for
 * a specified power mode.
 *
 *END**************************************************************************/
bool SMC_HAL_GetProtectionMode(uint32_t baseAddr, power_modes_protect_t protect)
{
    bool retValue = false;

    /* check the mode range */
    assert(protect < kAllowMax);

    /* branch according to the mode and read the setting */
    switch (protect)
    {
    case kAllowVlp:
        retValue = BR_SMC_PMPROT_AVLP(baseAddr);
        break;
#if FSL_FEATURE_SMC_HAS_LOW_LEAKAGE_STOP_MODE
    case kAllowLls:
        retValue = BR_SMC_PMPROT_ALLS(baseAddr);
        break;
#endif
    case kAllowVlls:
        retValue = BR_SMC_PMPROT_AVLLS(baseAddr);
        break;
#if FSL_FEATURE_SMC_HAS_HIGH_SPEED_RUN_MODE
    case kAllowHsrun:
        retValue = BR_SMC_PMPROT_AHSRUN(baseAddr);
        break;
#endif
    default:
        break;
    }
    return retValue;
}

/*FUNCTION**********************************************************************
 *
 * Function Name : SMC_HAL_SetRunMode
 * Description   : Config the RUN mode control setting
 * This function will set the run mode settings. For example, normal run mode,
 * very lower power run mode, etc. Refer to smc_run_mode_t for supported run
 * mode on the chip family. Refer to reference manual for details about the
 * run mode.
 *
 *END**************************************************************************/
void SMC_HAL_SetRunMode(uint32_t baseAddr, smc_run_mode_t runMode)
{
    BW_SMC_PMCTRL_RUNM(baseAddr, runMode);
}

/*FUNCTION**********************************************************************
 *
 * Function Name : SMC_HAL_GetRunMode
 * Description   : Get the current RUN mode config
 * This function will get the run mode settings. Refer to smc_run_mode_t
 * for supported run mode on the chip family. Refer to reference manual for
 * details about the run mode.
 *
 *END**************************************************************************/
smc_run_mode_t SMC_HAL_GetRunMode(uint32_t baseAddr)
{
    return (smc_run_mode_t)BR_SMC_PMCTRL_RUNM(baseAddr);
}

/*FUNCTION**********************************************************************
 *
 * Function Name : SMC_HAL_SetStopMode
 * Description   : Config the STOP mode control setting
 * This function will set the stop mode settings. For example, normal stop mode,
 * very lower power stop mode, etc. Refer to smc_stop_mode_t for supported stop
 * mode on the chip family. Refer to reference manual for details about the
 * stop mode.
 *
 *END**************************************************************************/
void SMC_HAL_SetStopMode(uint32_t baseAddr, smc_stop_mode_t stopMode)
{
    BW_SMC_PMCTRL_STOPM(baseAddr, stopMode);
}

/*FUNCTION**********************************************************************
 *
 * Function Name : SMC_HAL_GetStopMode
 * Description   : Get the current STOP mode control setting
 * This function will get the stop mode settings. For example, normal stop mode,
 * very lower power stop mode, etc. Refer to smc_stop_mode_t for supported stop
 * mode on the chip family. Refer to reference manual for details about the
 * stop mode.
 *
 *END**************************************************************************/
smc_stop_mode_t SMC_HAL_GetStopMode(uint32_t baseAddr)
{
    return (smc_stop_mode_t)BR_SMC_PMCTRL_STOPM(baseAddr);
}

/*FUNCTION**********************************************************************
 *
 * Function Name : SMC_HAL_SetStopSubMode
 * Description   : Config the stop sub mode control setting
 * This function will set the stop submode settings. Some of the stop mode will
 * further have submode supported. Refer to smc_stop_submode_t for supported
 * stop submode and Refer to reference manual for details about the submode
 * for specific stop mode.
 *
 *END**************************************************************************/
void SMC_HAL_SetStopSubMode(uint32_t baseAddr, smc_stop_submode_t stopSubMode)
{
#if FSL_FEATURE_SMC_USE_VLLSCTRL_REG
    BW_SMC_VLLSCTRL_VLLSM(baseAddr, stopSubMode);
#else
#if FSL_FEATURE_SMC_USE_STOPCTRL_VLLSM
    BW_SMC_STOPCTRL_VLLSM(baseAddr, stopSubMode);
#else
    BW_SMC_STOPCTRL_LLSM(baseAddr, stopSubMode);
#endif
#endif
}

/*FUNCTION**********************************************************************
 *
 * Function Name : SMC_HAL_GetStopSubMode
 * Description   : Get the current stop submode config
 * This function will get the stop submode settings. Some of the stop mode will
 * further have submode supported. Refer to smc_stop_submode_t for supported
 * stop submode and Refer to reference manual for details about the submode
 * for specific stop mode.
 *
 *END**************************************************************************/
smc_stop_submode_t SMC_HAL_GetStopSubMode(uint32_t baseAddr)
{
#if FSL_FEATURE_SMC_USE_VLLSCTRL_REG
    return (smc_stop_submode_t)BR_SMC_VLLSCTRL_VLLSM(baseAddr);
#else
#if FSL_FEATURE_SMC_USE_STOPCTRL_VLLSM
    return (smc_stop_submode_t)BR_SMC_STOPCTRL_VLLSM(baseAddr);
#else
    return (smc_stop_submode_t)BR_SMC_STOPCTRL_LLSM(baseAddr);
#endif
#endif
}

#if FSL_FEATURE_SMC_HAS_PORPO
/*FUNCTION**********************************************************************
 *
 * Function Name : SMC_HAL_SetPorMode
 * Description   : Config the POR (power-on-reset) option
 * This function will set the POR power option setting. It controls whether the
 * POR detect circuit (for brown-out detection) is enabled in certain stop mode.
 * The setting will be either enable or disable the above feature when POR
 * happened. Refer to reference manual for details.
 *
 *END**************************************************************************/
void SMC_HAL_SetPorMode(uint32_t baseAddr, smc_por_option_t option)
{
#if FSL_FEATURE_SMC_USE_VLLSCTRL_REG
    BW_SMC_VLLSCTRL_PORPO(baseAddr, option);
#else
    BW_SMC_STOPCTRL_PORPO(baseAddr, option);
#endif
}

/*FUNCTION**********************************************************************
 *
 * Function Name : SMC_HAL_GetPorMode
 * Description   : Get the config of POR option
 * This function will set the POR power option setting. See config function
 * header for details.
 *
 *END**************************************************************************/
smc_por_option_t SMC_HAL_GetPorMode(uint32_t baseAddr)
{
#if FSL_FEATURE_SMC_USE_VLLSCTRL_REG
    return (smc_por_option_t)BR_SMC_VLLSCTRL_PORPO(baseAddr);
#else
    return (smc_por_option_t)BR_SMC_STOPCTRL_PORPO(baseAddr);
#endif
}
#endif

#if FSL_FEATURE_SMC_HAS_PSTOPO
/*FUNCTION**********************************************************************
 *
 * Function Name : SMC_HAL_SetPstopMode
 * Description   : Config the PSTOPO (Partial Stop Option)
 * This function will set the PSTOPO option. It controls whether a Partial
 * Stop mode is entered when STOPM=STOP. When entering a Partial Stop mode from
 * RUN mode, the PMC, MCG and flash remain fully powered, allowing the device
 * to wakeup almost instantaneously at the expense of higher power consumption.
 * In PSTOP2, only system clocks are gated allowing peripherals running on bus
 * clock to remain fully functional. In PSTOP1, both system and bus clocks are
 * gated. Refer to smc_pstop_option_t for supported options. Refer to reference
 * manual for details.
 *
 *END**************************************************************************/
void SMC_HAL_SetPstopMode(uint32_t baseAddr, smc_pstop_option_t option)
{
    BW_SMC_STOPCTRL_PSTOPO(baseAddr, option);
}

/*FUNCTION**********************************************************************
 *
 * Function Name : SMC_HAL_GetPstopMode
 * Description   : Get the config of PSTOPO option
 * This function will get the current PSTOPO option setting. Refer to config
 * function for more details.
 *
 *END**************************************************************************/
smc_pstop_option_t SMC_HAL_GetPstopMode(uint32_t baseAddr)
{
    return (smc_pstop_option_t)BR_SMC_STOPCTRL_PSTOPO(baseAddr);
}
#endif

#if FSL_FEATURE_SMC_HAS_RAM2_POWER_OPTION
/*FUNCTION**********************************************************************
 *
 * Function Name : SMC_HAL_SetRam2Mode
 * Description   : Configures the RAM2PO (RAM2 Power Option)
 * This function  sets the RAM2PO option. It controls whether powering of RAM partition 2
 * is enabled in LLS2 or VLLS2 mode. See the smc_ram2_option_t for supported options
 * and the reference manual for details about this option.
 *END**************************************************************************/
void SMC_HAL_SetRam2Mode(uint32_t baseAddr, smc_ram2_option_t option)
{
#if FSL_FEATURE_SMC_USE_VLLSCTRL_REG
    BW_SMC_VLLSCTRL_RAM2PO(baseAddr, option);
#else
    BW_SMC_STOPCTRL_RAM2PO(baseAddr, option);
#endif
}

/*FUNCTION**********************************************************************
 *
 * Function Name : SMC_HAL_GetRam2Mode
 * Description   : Gets the configuration of the RAM2PO option
 * This function gets the current RAM2PO option setting. See the configuration
 * function for more details.
 *
 *END**************************************************************************/
smc_ram2_option_t SMC_HAL_GetRam2Mode(uint32_t baseAddr)
{
#if FSL_FEATURE_SMC_USE_VLLSCTRL_REG
    return (smc_ram2_option_t)BR_SMC_VLLSCTRL_RAM2PO(baseAddr);
#else
    return (smc_ram2_option_t)BR_SMC_STOPCTRL_RAM2PO(baseAddr);
#endif
}
#endif

#if FSL_FEATURE_SMC_HAS_LPOPO
/*FUNCTION**********************************************************************
 *
 * Function Name : SMC_HAL_SetLpoMode
 * Description   : Config the LPO option setting
 * This function will set the LPO option setting. It controls whether the 1kHZ
 * LPO clock is enabled in certain lower power stop modes. Refer to
 * smc_lpo_option_t for supported options and refer to reference manual for
 * details about this option.
 *
 *END**************************************************************************/
void SMC_HAL_SetLpoMode(uint32_t baseAddr, smc_lpo_option_t option)
{
    BW_SMC_STOPCTRL_LPOPO(baseAddr, option);
}

/*FUNCTION**********************************************************************
 *
 * Function Name : SMC_HAL_GetLpoMode
 * Description   : Get the config of LPO option
 * This function will get the current LPO option setting. Refer to config
 * function for details.
 *
 *END**************************************************************************/
smc_lpo_option_t SMC_HAL_GetLpoMode(uint32_t baseAddr)
{
    return (smc_lpo_option_t)BR_SMC_STOPCTRL_LPOPO(baseAddr);
}
#endif

#if FSL_FEATURE_SMC_HAS_LPWUI
/*FUNCTION**********************************************************************
 *
 * Function Name : SMC_HAL_SetLpwuiMode
 * Description   : Config the LPWUI (Low Power Wake Up on interrupt) option
 * This function will set the LPWUI option. It will cause the system to exit
 * to normal RUN mode when any active interrupt occurs while in a certain lower
 * power mode. Refer to smc_lpwui_option_t for supported options and refer to
 * reference manual for more details about this option.
 *
 *END**************************************************************************/
void SMC_HAL_SetLpwuiMode(uint32_t baseAddr, smc_lpwui_option_t option)
{
    BW_SMC_PMCTRL_LPWUI(baseAddr, option);
}

/*FUNCTION**********************************************************************
 *
 * Function Name : SMC_HAL_GetLpwuiMode
 * Description   : Get the current LPWUI option
 * This function will get the LPWUI option. Refer to config function for more
 * details.
 *
 *END**************************************************************************/
smc_lpwui_option_t SMC_HAL_GetLpwuiMode(uint32_t baseAddr)
{
    return (smc_lpwui_option_t)BR_SMC_PMCTRL_LPWUI(baseAddr);
}
#endif

/*FUNCTION**********************************************************************
 *
 * Function Name : SMC_HAL_GetStat
 * Description   : Get the current power mode stat
 * This function will return the current power mode stat. Once application is
 * switching the power mode, it should always check the stat to make sure it
 * runs into the specified mode or not. Also application will need to check
 * this mode before switching to certain mode. The system will require that
 * only certain mode could switch to other specific mode. Refer to the
 * reference manual for details. Refer to _power_mode_stat for the meaning
 * of the power stat
 *
 *END**************************************************************************/
power_mode_stat_t SMC_HAL_GetStat(uint32_t baseAddr)
{
    return (power_mode_stat_t)BR_SMC_PMSTAT_PMSTAT(baseAddr);
}

/*******************************************************************************
 * EOF
 ******************************************************************************/


text:
#include <aws/macie2/model/CreateAllowListRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>

#include <utility>

using namespace Aws::Macie2::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;

CreateAllowListRequest::CreateAllowListRequest() :
    m_clientToken(Aws::Utils::UUID::RandomUUID()),
    m_clientTokenHasBeenSet(true),
    m_criteriaHasBeenSet(false),
    m_descriptionHasBeenSet(false),
    m_nameHasBeenSet(false),
    m_tagsHasBeenSet(false)
{
}

Aws::String CreateAllowListRequest::SerializePayload() const
{
  JsonValue payload;

  if(m_clientTokenHasBeenSet)
  {
   payload.WithString("clientToken", m_clientToken);

  }

  if(m_criteriaHasBeenSet)
  {
   payload.WithObject("criteria", m_criteria.Jsonize());

  }

  if(m_descriptionHasBeenSet)
  {
   payload.WithString("description", m_description);

  }

  if(m_nameHasBeenSet)
  {
   payload.WithString("name", m_name);

  }

  if(m_tagsHasBeenSet)
  {
   JsonValue tagsJsonMap;
   for(auto& tagsItem : m_tags)
   {
     tagsJsonMap.WithString(tagsItem.first, tagsItem.second);
   }
   payload.WithObject("tags", std::move(tagsJsonMap));

  }

  return payload.View().WriteReadable();
}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>
<FindBugsFilter>
    <!-- we're *supposed* to manually GC there -->
    <Match>
        <Class name="io.sunflower.servlets.tasks.GarbageCollectionTask"/>
        <Method name="execute"/>
        <Bug pattern="DM_GC"/>
    </Match>

    <!-- kind of hard to use exit codes without System.exit -->
    <Match>
        <Class name="io.sunflower.Application"/>
        <Method name="onFatalError"/>
        <Bug pattern="DM_EXIT"/>
    </Match>

    <!-- serialization is boring -->
    <Match>
        <Bug code="Se"/>
        <Class name="io.sunflower.servlets.tasks.TaskServlet"/>
    </Match>
    <Match>
        <Bug code="Se"/>
        <Class name="io.sunflower.servlets.assets.AssetServlet"/>
    </Match>

    <!-- pretty sure this is a bug in FindBugs -->
    <Match>
        <Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE"/>
        <Class name="io.sunflower.configuration.ConfigurationFactory"/>
    </Match>

    <!-- exclude the generated code by JMH from the analysis -->
    <Match>
        <Package name="~io\.dropwizard\.benchmarks\..*\.generated"/>
    </Match>

    <Match>
        <Package name="~org\.openjdk\.jmh.*"/>
    </Match>
</FindBugsFilter>


text:
.topic-detail {
    background-color: white;
    padding: 2em;
    border-color: #e1e1e1;
}

.topic-detail-title {
    border-bottom-width: 1px;
    border-bottom-style: solid;
    border-bottom-color: black;
    padding-bottom: 10px;
}


text:
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using DDS.OpenSplice.OS;
using DDS.OpenSplice.Kernel;
using DDS.OpenSplice.kernelModuleI;
using DDS.OpenSplice.Database;

namespace DDS.OpenSplice.CustomMarshalers
{
    internal class v_handleToInstanceHandleMarshaler
    {
        internal static V_RESULT CopyOut(ref v_handle_s from, ref InstanceHandle to)
        {
            IntPtr instance;
            V_RESULT result = V_RESULT.INTERNAL_ERROR;

            if (from.server == IntPtr.Zero && from.index == 0 && from.serial == 0)
            {
                to = 0;
                result = V_RESULT.OK;
            }
            else
            {
                if (v_handle.Claim(from, out instance) == v_handleResult.V_HANDLE_OK)
                {
                    to = User.InstanceHandle.New(instance);
                    if (v_handle.Release(from) == v_handleResult.V_HANDLE_OK)
                    {
                       result = V_RESULT.OK;
                    }
                }
            }

            return result;
        }
    }

    internal class InconsistentTopicStatusMarshaler
    {
        private static Type type = typeof(DDS.OpenSplice.kernelModuleI.v_inconsistentTopicInfo);

        internal static V_RESULT CopyOut(IntPtr fromPtr, IntPtr toPtr)
        {
            v_inconsistentTopicInfo from = (v_inconsistentTopicInfo)Marshal.PtrToStructure(fromPtr, type);

            GCHandle toGCHandle = GCHandle.FromIntPtr(toPtr);
            InconsistentTopicStatus to = toGCHandle.Target as InconsistentTopicStatus;

            V_RESULT result = CopyOut(ref from, to);

            toGCHandle.Target = to;
            return result;
        }

        internal static V_RESULT CopyOut(ref v_inconsistentTopicInfo from, InconsistentTopicStatus to)
        {
            to.TotalCount = from.totalCount;
            to.TotalCountChange = from.totalChanged;
            return V_RESULT.OK;
        }
    }

    internal class LivelinessChangedStatusMarshaler
    {
        private static Type type = typeof(DDS.OpenSplice.kernelModuleI.v_livelinessChangedInfo);

        internal static V_RESULT CopyOut(IntPtr fromPtr, IntPtr toPtr)
        {
            v_livelinessChangedInfo from = (v_livelinessChangedInfo)Marshal.PtrToStructure(fromPtr, type);

            GCHandle toGCHandle = GCHandle.FromIntPtr(toPtr);
            LivelinessChangedStatus to = toGCHandle.Target as LivelinessChangedStatus;

            V_RESULT result = CopyOut(ref from, to);

            toGCHandle.Target = to;
            return result;
        }

        internal static V_RESULT CopyOut(ref v_livelinessChangedInfo from, LivelinessChangedStatus to)
        {
            to.AliveCount = from.activeCount;
            to.NotAliveCount = from.inactiveCount;
            to.AliveCountChange = from.activeChanged;
            to.NotAliveCountChange = from.inactiveChanged;
            to.LastPublicationHandle = User.InstanceHandle.FromGID(from.instanceHandle);
            return V_RESULT.OK;
        }
    }

    internal class SubscriptionMatchedStatusMarshaler
    {
        private static Type type = typeof(DDS.OpenSplice.kernelModuleI.v_topicMatchInfo);

        internal static V_RESULT CopyOut(IntPtr fromPtr, IntPtr toPtr)
        {
            v_topicMatchInfo from = (v_topicMatchInfo)Marshal.PtrToStructure(fromPtr, type);

            GCHandle toGCHandle = GCHandle.FromIntPtr(toPtr);
            SubscriptionMatchedStatus to = toGCHandle.Target as SubscriptionMatchedStatus;

            V_RESULT result = CopyOut(ref from, to);

            toGCHandle.Target = to;
            return result;
        }

        internal static V_RESULT CopyOut(ref v_topicMatchInfo from, SubscriptionMatchedStatus to)
        {
            to.TotalCount = from.totalCount;
            to.TotalCountChange = from.totalChanged;
            to.CurrentCount = from.currentCount;
            to.CurrentCountChange = from.currentChanged;
            to.LastPublicationHandle = User.InstanceHandle.FromGID(from.instanceHandle);
            return V_RESULT.OK;
        }
    }

    internal class SampleRejectedStatusMarshaler
    {
        private static Type type = typeof(DDS.OpenSplice.kernelModuleI.v_sampleRejectedInfo);

        internal static V_RESULT CopyOut(IntPtr fromPtr, IntPtr toPtr)
        {
            v_sampleRejectedInfo from = (v_sampleRejectedInfo)Marshal.PtrToStructure(fromPtr, type);

            GCHandle toGCHandle = GCHandle.FromIntPtr(toPtr);
            SampleRejectedStatus to = toGCHandle.Target as SampleRejectedStatus;

            V_RESULT result = CopyOut(ref from, to);

            toGCHandle.Target = to;
            return result;
        }

        internal static V_RESULT CopyOut(ref v_sampleRejectedInfo from, SampleRejectedStatus to)
        {
            to.TotalCount = from.totalCount;
            to.TotalCountChange = from.totalChanged;
            to.LastReason = (SampleRejectedStatusKind) from.lastReason;
            to.LastInstanceHandle = User.InstanceHandle.FromGID(from.instanceHandle);
            return V_RESULT.OK;
        }
    }

    internal class RequestedDeadlineMissedStatusMarshaler
    {
        private static Type type = typeof(DDS.OpenSplice.kernelModuleI.v_deadlineMissedInfo);

        internal static V_RESULT CopyOut(IntPtr fromPtr, IntPtr toPtr)
        {
            v_deadlineMissedInfo from = (v_deadlineMissedInfo)Marshal.PtrToStructure(fromPtr, type);

            GCHandle toGCHandle = GCHandle.FromIntPtr(toPtr);
            RequestedDeadlineMissedStatus to = toGCHandle.Target as RequestedDeadlineMissedStatus;

            V_RESULT result = CopyOut(ref from, to);

            toGCHandle.Target = to;
            return result;
        }

        internal static V_RESULT CopyOut(ref v_deadlineMissedInfo from, RequestedDeadlineMissedStatus to)
        {
            to.TotalCount = from.totalCount;
            to.TotalCountChange = from.totalChanged;
            return v_handleToInstanceHandleMarshaler.CopyOut(ref from.instanceHandle, ref to.LastInstanceHandle);
        }
    }

    internal class RequestedIncompatibleQosStatusMarshaler
    {
        private static Type type = typeof(DDS.OpenSplice.kernelModuleI.v_incompatibleQosInfo);

        internal static V_RESULT CopyOut(IntPtr fromPtr, IntPtr toPtr)
        {
            v_incompatibleQosInfo from = (v_incompatibleQosInfo)Marshal.PtrToStructure(fromPtr, type);

            GCHandle toGCHandle = GCHandle.FromIntPtr(toPtr);
            RequestedIncompatibleQosStatus to = toGCHandle.Target as RequestedIncompatibleQosStatus;

            V_RESULT result = CopyOut(ref from, to);

            toGCHandle.Target = to;
            return result;
        }

        internal static V_RESULT CopyOut(ref v_incompatibleQosInfo from, RequestedIncompatibleQosStatus to)
        {
            to.TotalCount = from.totalCount;
            to.TotalCountChange = from.totalChanged;
            to.LastPolicyId = (QosPolicyId) from.lastPolicyId;
            if (from.totalCount > 0)
            {
                int arrSize = 0;
                for (int i = 0; i < Constants.V_POLICY_ID_COUNT; i++)
                {
                    int v = from.policyCount[i];
                    if (v != 0)
                    {
                        arrSize++;
                    }
                }

                int n = 0;
                to.Policies = new QosPolicyCount[arrSize];
                for (int i = 0; i < Constants.V_POLICY_ID_COUNT; i++)
                {
                    int v = from.policyCount[i];

                    if (v != 0)
                    {
                        to.Policies[n] = new QosPolicyCount();
                        to.Policies[n].PolicyId = (QosPolicyId) i;
                        to.Policies[n].Count = v;
                        n++;
                    }
                }
            }
            return V_RESULT.OK;
        }
    }

    internal class SampleLostStatusMarshaler
    {
        private static Type type = typeof(DDS.OpenSplice.kernelModuleI.v_sampleLostInfo);

        internal static V_RESULT CopyOut(IntPtr fromPtr, IntPtr toPtr)
        {
            v_sampleLostInfo from = (v_sampleLostInfo)Marshal.PtrToStructure(fromPtr, type);

            GCHandle toGCHandle = GCHandle.FromIntPtr(toPtr);
            SampleLostStatus to = toGCHandle.Target as SampleLostStatus;

            V_RESULT result = CopyOut(ref from, to);

            toGCHandle.Target = to;
            return result;
        }

        internal static V_RESULT CopyOut(ref v_sampleLostInfo from, SampleLostStatus to)
        {
            to.TotalCount = from.totalCount;
            to.TotalCountChange = from.totalChanged;
            return V_RESULT.OK;
        }
    }

    internal class LivelinessLostStatusMarshaler
    {
        private static Type type = typeof(DDS.OpenSplice.kernelModuleI.v_livelinessLostInfo);

        internal static V_RESULT CopyOut(IntPtr fromPtr, IntPtr toPtr)
        {
            v_livelinessLostInfo from = (v_livelinessLostInfo)Marshal.PtrToStructure(fromPtr, type);

            GCHandle toGCHandle = GCHandle.FromIntPtr(toPtr);
            LivelinessLostStatus to = toGCHandle.Target as LivelinessLostStatus;

            V_RESULT result = CopyOut(ref from, to);

            toGCHandle.Target = to;
            return result;
        }

        internal static V_RESULT CopyOut(ref v_livelinessLostInfo from, LivelinessLostStatus to)
        {
            to.TotalCount = from.totalCount;
            to.TotalCountChange = from.totalChanged;
            return V_RESULT.OK;
        }
    }

    internal class OfferedDeadlineMissedStatusMarshaler
    {
        private static Type type = typeof(DDS.OpenSplice.kernelModuleI.v_deadlineMissedInfo);

        internal static V_RESULT CopyOut(IntPtr fromPtr, IntPtr toPtr)
        {
            v_deadlineMissedInfo from = (v_deadlineMissedInfo)Marshal.PtrToStructure(fromPtr, type);

            GCHandle toGCHandle = GCHandle.FromIntPtr(toPtr);
            OfferedDeadlineMissedStatus to = toGCHandle.Target as OfferedDeadlineMissedStatus;

            V_RESULT result = CopyOut(ref from, to);

            toGCHandle.Target = to;
            return result;
        }

        internal static V_RESULT CopyOut(ref v_deadlineMissedInfo from, OfferedDeadlineMissedStatus to)
        {
            to.TotalCount = from.totalCount;
            to.TotalCountChange = from.totalChanged;
            return v_handleToInstanceHandleMarshaler.CopyOut(ref from.instanceHandle, ref to.LastInstanceHandle);
        }
    }

    internal class OfferedIncompatibleQosStatusMarshaler
    {
        private static Type type = typeof(DDS.OpenSplice.kernelModuleI.v_incompatibleQosInfo);

        internal static V_RESULT CopyOut(IntPtr fromPtr, IntPtr toPtr)
        {
            v_incompatibleQosInfo from = (v_incompatibleQosInfo)Marshal.PtrToStructure(fromPtr, type);

            GCHandle toGCHandle = GCHandle.FromIntPtr(toPtr);
            OfferedIncompatibleQosStatus to = toGCHandle.Target as OfferedIncompatibleQosStatus;

            V_RESULT result = CopyOut(ref from, to);

            toGCHandle.Target = to;
            return result;
        }

        internal static V_RESULT CopyOut(ref v_incompatibleQosInfo from, OfferedIncompatibleQosStatus to)
        {
            to.TotalCount = from.totalCount;
            to.TotalCountChange = from.totalChanged;
            to.LastPolicyId = (QosPolicyId) from.lastPolicyId;
            if (from.totalCount > 0)
            {
                int arrSize = 0;
                for (int i = 0; i < Constants.V_POLICY_ID_COUNT; i++)
                {
                    int v = from.policyCount[i];

                    if (v != 0)
                    {
                        arrSize++;
                    }
                }

                int n = 0;
                to.Policies = new QosPolicyCount[arrSize];
                for (int i = 0; i < Constants.V_POLICY_ID_COUNT; i++)
                {
                    int v = from.policyCount[i];

                    if (v != 0)
                    {
                        to.Policies[n] = new QosPolicyCount();
                        to.Policies[n].PolicyId = (QosPolicyId) i;
                        to.Policies[n].Count = v;
                        n++;
                    }
                }
            }
            return V_RESULT.OK;
        }
    }

    internal class PublicationMatchedStatusMarshaler
    {
        private static Type type = typeof(DDS.OpenSplice.kernelModuleI.v_topicMatchInfo);

        internal static V_RESULT CopyOut(IntPtr fromPtr, IntPtr toPtr)
        {
            v_topicMatchInfo from = (v_topicMatchInfo)Marshal.PtrToStructure(fromPtr, type);

            GCHandle toGCHandle = GCHandle.FromIntPtr(toPtr);
            PublicationMatchedStatus to = toGCHandle.Target as PublicationMatchedStatus;

            V_RESULT result = CopyOut(ref from, to);

            toGCHandle.Target = to;
            return result;
        }

        internal static V_RESULT CopyOut(ref v_topicMatchInfo from, PublicationMatchedStatus to)
        {
            to.TotalCount = from.totalCount;
            to.TotalCountChange = from.totalChanged;
            to.CurrentCount = from.currentCount;
            to.CurrentCountChange = from.currentChanged;
            to.LastSubscriptionHandle = User.InstanceHandle.FromGID(from.instanceHandle);
            return V_RESULT.OK;
        }
    }

    internal class vEventMarshaler
    {
        internal static StatusKind vEventMaskToStatusMask(uint vMask, V_KIND vKind)
        {
            StatusKind mask = 0;

            switch(vKind) {
            case V_KIND.K_TOPIC:
                if ((vMask & (uint) V_EVENT.INCONSISTENT_TOPIC) != 0) {
                    mask |= StatusKind.InconsistentTopic;
                }
                if ((vMask & (uint) V_EVENT.ALL_DATA_DISPOSED) != 0) {
                    mask |= StatusKind.AllDataDisposed;
                }
                break;
            case V_KIND.K_SUBSCRIBER:
                if ((vMask & (uint) V_EVENT.ON_DATA_ON_READERS) != 0) {
                    mask |= StatusKind.DataOnReaders;
                }
                break;
            case V_KIND.K_WRITER:
                if ((vMask & (uint) V_EVENT.LIVELINESS_LOST) != 0) {
                    mask |= StatusKind.LivelinessLost;
                }
                if ((vMask & (uint) V_EVENT.OFFERED_DEADLINE_MISSED) != 0) {
                    mask |= StatusKind.OfferedDeadlineMissed;
                }
                if ((vMask & (uint) V_EVENT.OFFERED_INCOMPATIBLE_QOS) != 0) {
                    mask |= StatusKind.OfferedIncompatibleQos;
                }
                if ((vMask & (uint) V_EVENT.PUBLICATION_MATCHED) != 0) {
                    mask |= StatusKind.PublicationMatched;
                }
                break;
            case V_KIND.K_READER:
            case V_KIND.K_GROUPQUEUE:
            case V_KIND.K_DATAREADER:
            case V_KIND.K_GROUPSTREAM:
                if ((vMask & (uint) V_EVENT.SAMPLE_REJECTED) != 0) {
                    mask |= StatusKind.SampleRejected;
                }
                if ((vMask & (uint) V_EVENT.LIVELINESS_CHANGED) != 0) {
                    mask |= StatusKind.LivelinessChanged;
                }
                if ((vMask & (uint) V_EVENT.REQUESTED_DEADLINE_MISSED) != 0) {
                    mask |= StatusKind.RequestedDeadlineMissed;
                }
                if ((vMask & (uint) V_EVENT.REQUESTED_INCOMPATIBLE_QOS) != 0) {
                    mask |= StatusKind.RequestedIncompatibleQos;
                }
                if ((vMask & (uint) V_EVENT.SUBSCRIPTION_MATCHED) != 0) {
                    mask |= StatusKind.SubscriptionMatched;
                }
                if ((vMask & (uint) V_EVENT.DATA_AVAILABLE) != 0) {
                    mask |= StatusKind.DataAvailable;
                }
                if ((vMask & (uint) V_EVENT.SAMPLE_LOST) != 0) {
                    mask |= StatusKind.SampleLost;
                }
                break;
            case V_KIND.K_PARTICIPANT:
            case V_KIND.K_PUBLISHER:
            case V_KIND.K_DOMAIN:
            case V_KIND.K_KERNEL:
                break;
            default:
                Debug.Assert(false);
                break;
            }

            return mask;
        }

        internal static uint vEventMaskFromStatusMask(StatusKind mask)
        {
            uint vMask = 0;

            if ((mask & StatusKind.InconsistentTopic) != 0) {
                vMask |= (uint) V_EVENT.INCONSISTENT_TOPIC;
            }
            if ((mask & StatusKind.LivelinessLost) != 0) {
                vMask |= (uint) V_EVENT.LIVELINESS_LOST;
            }
            if ((mask & StatusKind.OfferedDeadlineMissed) != 0) {
                vMask |= (uint) V_EVENT.OFFERED_DEADLINE_MISSED;
            }
            if ((mask & StatusKind.OfferedIncompatibleQos) != 0) {
                vMask |= (uint) V_EVENT.OFFERED_INCOMPATIBLE_QOS;
            }
            if ((mask & StatusKind.DataOnReaders) != 0) {
                vMask |= (uint) V_EVENT.ON_DATA_ON_READERS;
            }
            if ((mask & StatusKind.SampleLost) != 0) {
                vMask |= (uint) V_EVENT.SAMPLE_LOST;
            }
            if ((mask & StatusKind.DataAvailable) != 0) {
                vMask |= (uint) V_EVENT.DATA_AVAILABLE;
            }
            if ((mask & StatusKind.SampleRejected) != 0) {
                vMask |= (uint) V_EVENT.SAMPLE_REJECTED;
            }
            if ((mask & StatusKind.LivelinessChanged) != 0) {
                vMask |= (uint) V_EVENT.LIVELINESS_CHANGED;
            }
            if ((mask & StatusKind.RequestedDeadlineMissed) != 0) {
                vMask |= (uint) V_EVENT.REQUESTED_DEADLINE_MISSED;
            }
            if ((mask & StatusKind.RequestedIncompatibleQos) != 0) {
                vMask |= (uint) V_EVENT.REQUESTED_INCOMPATIBLE_QOS;
            }
            if ((mask & StatusKind.PublicationMatched) != 0) {
                vMask |= (uint) V_EVENT.PUBLICATION_MATCHED;
            }
            if ((mask & StatusKind.SubscriptionMatched) != 0) {
                vMask |= (uint) V_EVENT.SUBSCRIPTION_MATCHED;
            }
            if ((mask & StatusKind.AllDataDisposed) != 0) {
                vMask |= (uint) V_EVENT.ALL_DATA_DISPOSED;
            }
            return vMask;
        }
    }

    internal class vStatusMarshaler
    {
        private static Type type = typeof(DDS.OpenSplice.kernelModuleI.v_status);

        internal static V_RESULT CopyOut(IntPtr fromPtr, IntPtr toPtr)
        {
            v_status from = (v_status)Marshal.PtrToStructure(fromPtr, type);

            GCHandle toGCHandle = GCHandle.FromIntPtr(toPtr);
            DDS.OpenSplice.Common.EntityStatus to = toGCHandle.Target as DDS.OpenSplice.Common.EntityStatus;

            V_RESULT result = CopyOut(ref from, to);

            toGCHandle.Target = to;
            return result;
        }

        internal static V_RESULT CopyOut(ref v_status from, DDS.OpenSplice.Common.EntityStatus to)
        {
            to.State = (uint)from.state;
            return V_RESULT.OK;
        }
    }

    internal class vTopicStatusMarshaler
    {
        private static Type type = typeof(DDS.OpenSplice.kernelModuleI.v_topicStatus);

        internal static V_RESULT CopyOut(IntPtr fromPtr, IntPtr toPtr)
        {
            v_topicStatus from = (v_topicStatus)Marshal.PtrToStructure(fromPtr, type);

            GCHandle toGCHandle = GCHandle.FromIntPtr(toPtr);
            DDS.OpenSplice.Common.TopicStatus to = toGCHandle.Target as DDS.OpenSplice.Common.TopicStatus;

            V_RESULT result = CopyOut(ref from, to);

            toGCHandle.Target = to;
            return result;
        }

        internal static V_RESULT CopyOut(ref v_topicStatus from, DDS.OpenSplice.Common.TopicStatus to)
        {
            to.State = (uint)from._parent.state;
            to.InconsistentTopic = new InconsistentTopicStatus();

            InconsistentTopicStatusMarshaler.CopyOut(ref from.inconsistentTopic, to.InconsistentTopic);
            return V_RESULT.OK;
        }
    }

    internal class vWriterStatusMarshaler
    {
        private static Type type = typeof(DDS.OpenSplice.kernelModuleI.v_writerStatus);

        internal static V_RESULT CopyOut(IntPtr fromPtr, IntPtr toPtr)
        {
            v_writerStatus from = (v_writerStatus)Marshal.PtrToStructure(fromPtr, type);

            GCHandle toGCHandle = GCHandle.FromIntPtr(toPtr);
            DDS.OpenSplice.Common.WriterStatus to = toGCHandle.Target as DDS.OpenSplice.Common.WriterStatus;

            V_RESULT result = CopyOut(ref from, to);

            toGCHandle.Target = to;
            return result;
        }

        internal static V_RESULT CopyOut(ref v_writerStatus from, DDS.OpenSplice.Common.WriterStatus to)
        {
            to.State = (uint)from._parent.state;
            to.LivelinessLost = new LivelinessLostStatus();
            to.DeadlineMissed = new OfferedDeadlineMissedStatus();
            to.IncompatibleQos = new OfferedIncompatibleQosStatus();
            to.PublicationMatch = new PublicationMatchedStatus();

            LivelinessLostStatusMarshaler.CopyOut(ref from.livelinessLost, to.LivelinessLost);
            OfferedDeadlineMissedStatusMarshaler.CopyOut(ref from.deadlineMissed, to.DeadlineMissed);
            OfferedIncompatibleQosStatusMarshaler.CopyOut(ref from.incompatibleQos, to.IncompatibleQos);
            PublicationMatchedStatusMarshaler.CopyOut(ref from.publicationMatch, to.PublicationMatch);
            return V_RESULT.OK;
        }
    }

    internal class vReaderStatusMarshaler
    {
        private static Type type = typeof(DDS.OpenSplice.kernelModuleI.v_readerStatus);

        internal static V_RESULT CopyOut(IntPtr fromPtr, IntPtr toPtr)
        {
            v_readerStatus from = (v_readerStatus)Marshal.PtrToStructure(fromPtr, type);

            GCHandle toGCHandle = GCHandle.FromIntPtr(toPtr);
            DDS.OpenSplice.Common.ReaderStatus to = toGCHandle.Target as DDS.OpenSplice.Common.ReaderStatus;

            V_RESULT result = CopyOut(ref from, to);

            toGCHandle.Target = to;
            return result;
        }

        internal static V_RESULT CopyOut(ref v_readerStatus from, DDS.OpenSplice.Common.ReaderStatus to)
        {
            to.State = (uint)from._parent.state;
            to.LivelinessChanged = new LivelinessChangedStatus();
            to.SampleRejected = new SampleRejectedStatus();
            to.SampleLost = new SampleLostStatus();
            to.DeadlineMissed = new RequestedDeadlineMissedStatus();
            to.IncompatibleQos = new RequestedIncompatibleQosStatus();
            to.SubscriptionMatch = new SubscriptionMatchedStatus();

            LivelinessChangedStatusMarshaler.CopyOut(ref from.livelinessChanged, to.LivelinessChanged);
            SampleRejectedStatusMarshaler.CopyOut(ref from.sampleRejected, to.SampleRejected);
            SampleLostStatusMarshaler.CopyOut(ref from.sampleLost, to.SampleLost);
            RequestedDeadlineMissedStatusMarshaler.CopyOut(ref from.deadlineMissed, to.DeadlineMissed);
            RequestedIncompatibleQosStatusMarshaler.CopyOut(ref from.incompatibleQos, to.IncompatibleQos);
            SubscriptionMatchedStatusMarshaler.CopyOut(ref from.subscriptionMatch, to.SubscriptionMatch);
            return V_RESULT.OK;
        }
    }
}


text:
// Copyright 2016 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

using Google.Api.Gax;
using Google.Apis.Auth.OAuth2;
using Google.Apis.Bigquery.v2;
using Google.Apis.Bigquery.v2.Data;
using Google.Apis.Services;
using System;
using System.Linq;
using System.Threading.Tasks;

namespace Google.Bigquery.V2
{
    /// <summary>
    /// Abstract class providing operations for Google Cloud Bigquery.
    /// </summary>
    /// <remarks>
    /// <para>
    /// This abstract class is provided to enable testability while permitting
    /// additional operations to be added in the future. See <see cref="Create(string, GoogleCredential)"/>
    /// and <see cref="CreateAsync(string, GoogleCredential)"/> to construct instances; alternatively, you can
    /// construct a <see cref="BigqueryClientImpl"/> directly from a <see cref="BigqueryService"/>.
    /// </para>
    /// <para>
    /// All instance methods declared in this class are virtual, with an implementation which simply
    /// throws <see cref="NotImplementedException"/>. All these methods are overridden in <see cref="BigqueryClientImpl"/>.
    /// </para>
    /// </remarks>
    public abstract partial class BigqueryClient
    {
        /// <summary>
        /// The underlying Bigquery service object used by this client.
        /// </summary>
        /// <remarks>
        /// The <see cref="BigqueryClient"/> class only provides convenience operations built on top of
        /// an existing service object. Any more complex operations which are not supported by this wrapper may wish
        /// to use the same service object as the wrapper, in order to take advantage of its configuration (for authentication,
        /// application naming etc).
        /// </remarks>
        public virtual BigqueryService Service { get { throw new NotImplementedException(); } }

        /// <summary>
        /// The ID of the project this client operates on. All operations that require a
        /// project to be specified implicitly supply this ID.
        /// </summary>
        public virtual string ProjectId { get { throw new NotImplementedException(); } }

        /// <summary>
        /// Asynchronously creates a <see cref="BigqueryClient"/>, using application default credentials if
        /// no credentials are specified.
        /// </summary>
        /// <remarks>
        /// The credentials are scoped as necessary.
        /// </remarks>
        /// <param name="projectId">The ID of the project containing the BigQuery data. Must not be null.</param>
        /// <param name="credential">Optional <see cref="GoogleCredential"/>.</param>
        /// <returns>The task representing the created <see cref="BigqueryClient"/>.</returns>
        public static async Task<BigqueryClient> CreateAsync(string projectId, GoogleCredential credential = null) =>
            // If no credentials have been specified, we fetch them "properly asynchronously"
            // to avoid the Task.Run in the synchronous call
            Create(
                GaxPreconditions.CheckNotNull(projectId, nameof(projectId)),
                credential ?? await GoogleCredential.GetApplicationDefaultAsync().ConfigureAwait(false));

        /// <summary>
        /// Synchronously creates a <see cref="BigqueryClient"/>, using application default credentials if
        /// no credentials are specified.
        /// </summary>
        /// <remarks>
        /// The credentials are scoped as necessary.
        /// </remarks>
        /// <param name="projectId">The ID of the project containing the BigQuery data. Must not be null.</param>
        /// <param name="credential">Optional <see cref="GoogleCredential"/>.</param>
        /// <returns>The created <see cref="BigqueryClient"/>.</returns>
        public static BigqueryClient Create(string projectId, GoogleCredential credential = null)
        {
            GaxPreconditions.CheckNotNull(projectId, nameof(projectId));
            try
            {
                credential = credential ?? Task.Run(() => GoogleCredential.GetApplicationDefaultAsync()).Result;
            }
            catch (AggregateException e)
            {
                // Unwrap the first exception, a bit like await would.
                // It's very unlikely that we'd ever see an AggregateException without an inner exceptions,
                // but let's handle it relatively gracefully.
                throw e.InnerExceptions.FirstOrDefault() ?? e;
            }
            if (credential.IsCreateScopedRequired)
            {
                credential = credential.CreateScoped(
                    // FIXME: Work out which of these we actually need.
                    BigqueryService.Scope.Bigquery,
                    BigqueryService.Scope.BigqueryInsertdata,
                    BigqueryService.Scope.DevstorageFullControl,
                    BigqueryService.Scope.CloudPlatform);
            }
            var service = new BigqueryService(new BaseClientService.Initializer
            {
                HttpClientInitializer = credential,
                ApplicationName = BigqueryClientImpl.ApplicationName,
            });

            return new BigqueryClientImpl(projectId, service);
        }

        /// <summary>
        /// Creates a <see cref="TableReference"/> from the given dataset ID and table ID,
        /// using this client's project ID.
        /// </summary>
        /// <param name="datasetId">The dataset ID. Must not be null.</param>
        /// <param name="tableId">The table ID. Must not be null.</param>
        /// <returns>A <see cref="TableReference"/> representing the requested table.</returns>
        public TableReference GetTableReference(string datasetId, string tableId) =>
            GetTableReference(ProjectId, datasetId, tableId);

        /// <summary>
        /// Creates a <see cref="TableReference"/> from the given project ID, dataset ID and table ID.
        /// </summary>
        /// <param name="projectId">The project ID. Must not be null.</param>
        /// <param name="datasetId">The dataset ID. Must not be null.</param>
        /// <param name="tableId">The table ID. Must not be null.</param>
        /// <returns>A <see cref="TableReference"/> representing the requested table.</returns>
        public TableReference GetTableReference(string projectId, string datasetId, string tableId) =>
            new TableReference
            {
                ProjectId = GaxPreconditions.CheckNotNull(projectId, nameof(projectId)),
                DatasetId = GaxPreconditions.CheckNotNull(datasetId, nameof(datasetId)),
                TableId = GaxPreconditions.CheckNotNull(tableId, nameof(tableId)),
            };

        /// <summary>
        /// Creates a <see cref="DatasetReference"/> from the given dataset ID,
        /// using this client's project ID.
        /// </summary>
        /// <param name="datasetId">The dataset ID. Must not be null.</param>
        /// <returns>A <see cref="DatasetReference"/> representing the requested dataset.</returns>
        public DatasetReference GetDatasetReference(string datasetId) =>
            GetDatasetReference(ProjectId, datasetId);

        /// <summary>
        /// Creates a <see cref="DatasetReference"/> from the given project ID and dataset ID.
        /// </summary>
        /// <param name="projectId">The project ID. Must not be null.</param>
        /// <param name="datasetId">The dataset ID. Must not be null.</param>
        /// <returns>A <see cref="DatasetReference"/> representing the requested dataset.</returns>
        public DatasetReference GetDatasetReference(string projectId, string datasetId) =>
            new DatasetReference
            {
                ProjectId = GaxPreconditions.CheckNotNull(projectId, nameof(projectId)),
                DatasetId = GaxPreconditions.CheckNotNull(datasetId, nameof(datasetId)),
            };

        /// <summary>
        /// Creates a <see cref="ProjectReference"/> from the given project ID.
        /// </summary>
        /// <param name="projectId">The project ID. Must not be null.</param>
        /// <returns>A <see cref="ProjectReference"/> representing the requested project.</returns>
        public ProjectReference GetProjectReference(string projectId) =>
            new ProjectReference
            {
                ProjectId = GaxPreconditions.CheckNotNull(projectId, nameof(projectId)),
            };

        /// <summary>
        /// Creates a <see cref="JobReference"/> from the given job ID,
        /// using this client's project ID.
        /// </summary>
        /// <param name="jobId">The job ID. Must not be null.</param>
        /// <returns>A <see cref="JobReference"/> representing the requested job.</returns>
        public JobReference GetJobReference(string jobId) =>
            GetJobReference(ProjectId, jobId);

        /// <summary>
        /// Creates a <see cref="JobReference"/> from the given project ID and job ID.
        /// </summary>
        /// <param name="projectId">The project ID. Must not be null.</param>
        /// <param name="jobId">The job ID. Must not be null.</param>
        /// <returns>A <see cref="JobReference"/> representing the requested job.</returns>
        public JobReference GetJobReference(string projectId, string jobId) =>
            new JobReference
            {
                ProjectId = GaxPreconditions.CheckNotNull(projectId, nameof(projectId)),
                JobId = GaxPreconditions.CheckNotNull(jobId, nameof(jobId))
            };
    }
}


text:
#ifndef Connection_hpp
#define Connection_hpp

#include "StdCpp.hpp"
#include "Database.hpp"
#include "Result.hpp"
#include "Function.hpp"

namespace usql {
    class Connection : public NoCopyable
    {
    public:
        Connection(const std::string &filename);
        virtual ~Connection();

        Result open();
        Result open(int flags);
        bool isOpenning() const {
            return _db->isOpening();
        }

        Result close();

        _WeakDatabase database() {
            return _db;
        }

    public:
        Result exec(const std::string &cmd);

        Result beginTransaction(TransactionType type);
        Result commit();
        Result rollback();
        Result transaction(TransactionType type, tr1::function<bool(Connection &)> action);

        //tables
        struct ColumnInfo
        {
            std::string name;
            std::string type;
            bool nullable;
            std::string defaultValue;

			ColumnInfo(): nullable(false) {}
        };

        struct TableInfo
        {
            std::string name;
            std::vector<std::string> primaryKeys;
            std::vector<ColumnInfo> columndefs;
        };

        bool tableExists(const std::string &tablename, const std::string &schema = "");
        std::vector<std::string> allTables(const std::string &schema = "");
        TableInfo tableInfo(const std::string &name, const std::string &schema = "");

        //attach or detach database
        struct DatabaseInfo
        {
            std::string name;
            std::string filepath;

            DatabaseInfo(const std::string &n, const std::string &f) : name(n), filepath(f) {}
        };
        Result attachDatabase(const std::string &filename, const std::string &schema);
        void detachDatabase(const std::string &schema);
        std::vector<DatabaseInfo> allDatabase();

    public:
#if _USQL_SQLITE_CREATE_FUNCTION_V2_ENABLE
        Result registerFunction(Function *func);

        void unregisterFunction(const std::string name);
        void unregisterAllFunctions();
#endif

    private:
        std::string _filename;
        _Database _db;

#if _USQL_SQLITE_CREATE_FUNCTION_V2_ENABLE
        std::list<std::string> _functions;
#endif
    };
}

#endif /* Connection_hpp */


text:
from __future__ import division

import settings
import numpy as np
from lfd.demonstration import demonstration
from lfd.environment import sim_util
from lfd.registration import registration
from lfd.transfer import transfer
from lfd.transfer import planning

class RegistrationAndTrajectoryTransferer(object):
    def __init__(self, registration_factory, trajectory_transferer):
        self.registration_factory = registration_factory
        self.trajectory_transferer = trajectory_transferer

    def transfer(self, demo, test_scene_state, callback=None, plotting=False):
        """Registers demonstration scene onto the test scene and uses this registration to transfer the demonstration trajectory

        Args:
            demo: Demonstration that has the demonstration scene and the trajectory to transfer
            test_scene_state: SceneState of the test scene

        Returns:
            The transferred Trajectory
        """
        raise NotImplementedError

class TwoStepRegistrationAndTrajectoryTransferer(RegistrationAndTrajectoryTransferer):
    def transfer(self, demo, test_scene_state, callback=None, plotting=False):
        reg = self.registration_factory.register(demo, test_scene_state, callback=callback)
        test_aug_traj = self.trajectory_transferer.transfer(reg, demo, plotting=plotting)
        return test_aug_traj

class UnifiedRegistrationAndTrajectoryTransferer(RegistrationAndTrajectoryTransferer):
    def __init__(self, registration_factory, trajectory_transferer,
                 alpha=settings.ALPHA,
                 beta_pos=settings.BETA_POS,
                 gamma=settings.GAMMA,
                 use_collision_cost=settings.USE_COLLISION_COST,
                 init_trajectory_transferer=None):
        super(UnifiedRegistrationAndTrajectoryTransferer, self).__init__(registration_factory, trajectory_transferer)
        if not isinstance(registration_factory, registration.TpsRpmRegistrationFactory):
            raise NotImplementedError("UnifiedRegistrationAndTrajectoryTransferer only supports TpsRpmRegistrationFactory")
        if not isinstance(trajectory_transferer, transfer.FingerTrajectoryTransferer):
            raise NotImplementedError("UnifiedRegistrationAndTrajectoryTransferer only supports FingerTrajectoryTransferer")
        self.sim = trajectory_transferer.sim
        self.alpha = alpha
        self.beta_pos = beta_pos
        self.gamma = gamma
        self.use_collision_cost = use_collision_cost
        self.init_trajectory_transferer = init_trajectory_transferer

    def transfer(self, demo, test_scene_state, callback=None, plotting=False):
        reg = self.registration_factory.register(demo, test_scene_state, callback=callback)

        handles = []
        if plotting:
            demo_cloud = demo.scene_state.cloud
            test_cloud = reg.test_scene_state.cloud
            demo_color = demo.scene_state.color
            test_color = reg.test_scene_state.color
            handles.append(self.sim.env.plot3(demo_cloud[:,:3], 2, demo_color if demo_color is not None else (1,0,0)))
            handles.append(self.sim.env.plot3(test_cloud[:,:3], 2, test_color if test_color is not None else (0,0,1)))
            self.sim.viewer.Step()

        active_lr = ""
        for lr in 'lr':
            if lr in demo.aug_traj.lr2arm_traj and sim_util.arm_moved(demo.aug_traj.lr2arm_traj[lr]):
                active_lr += lr
        _, timesteps_rs = sim_util.unif_resample(np.c_[(1./settings.JOINT_LENGTH_PER_STEP) * np.concatenate([demo.aug_traj.lr2arm_traj[lr] for lr in active_lr], axis=1),
                                                       (1./settings.FINGER_CLOSE_RATE) * np.concatenate([demo.aug_traj.lr2finger_traj[lr] for lr in active_lr], axis=1)],
                                                 1.)
        demo_aug_traj_rs = demo.aug_traj.get_resampled_traj(timesteps_rs)

        if self.init_trajectory_transferer:
            warm_init_traj = self.init_trajectory_transferer.transfer(reg, demo, plotting=plotting)

        manip_name = ""
        flr2finger_link_names = []
        flr2demo_finger_pts_trajs_rs = []
        init_traj = np.zeros((len(timesteps_rs),0))
        for lr in active_lr:
            arm_name = {"l":"leftarm", "r":"rightarm"}[lr]
            finger_name = "%s_gripper_l_finger_joint"%lr

            if manip_name:
                manip_name += "+"
            manip_name += arm_name + "+" + finger_name

            if self.init_trajectory_transferer:
                init_traj = np.c_[init_traj, warm_init_traj.lr2arm_traj[lr], warm_init_traj.lr2finger_traj[lr]]
            else:
                init_traj = np.c_[init_traj, demo_aug_traj_rs.lr2arm_traj[lr], demo_aug_traj_rs.lr2finger_traj[lr]]

            if plotting:
                handles.append(self.sim.env.drawlinestrip(demo.aug_traj.lr2ee_traj[lr][:,:3,3], 2, (1,0,0)))
                handles.append(self.sim.env.drawlinestrip(demo_aug_traj_rs.lr2ee_traj[lr][:,:3,3], 2, (1,1,0)))
                transformed_ee_traj_rs = reg.f.transform_hmats(demo_aug_traj_rs.lr2ee_traj[lr])
                handles.append(self.sim.env.drawlinestrip(transformed_ee_traj_rs[:,:3,3], 2, (0,1,0)))
                self.sim.viewer.Step()

            flr2demo_finger_pts_traj_rs = sim_util.get_finger_pts_traj(self.sim.robot, lr, (demo_aug_traj_rs.lr2ee_traj[lr], demo_aug_traj_rs.lr2finger_traj[lr]))
            flr2demo_finger_pts_trajs_rs.append(flr2demo_finger_pts_traj_rs)

            flr2transformed_finger_pts_traj_rs = {}
            flr2finger_link_name = {}
            flr2finger_rel_pts = {}
            for finger_lr in 'lr':
                flr2transformed_finger_pts_traj_rs[finger_lr] = reg.f.transform_points(np.concatenate(flr2demo_finger_pts_traj_rs[finger_lr], axis=0)).reshape((-1,4,3))
                flr2finger_link_name[finger_lr] = "%s_gripper_%s_finger_tip_link"%(lr,finger_lr)
                flr2finger_rel_pts[finger_lr] = sim_util.get_finger_rel_pts(finger_lr)
            flr2finger_link_names.append(flr2finger_link_name)

            if plotting:
                handles.extend(sim_util.draw_finger_pts_traj(self.sim, flr2demo_finger_pts_traj_rs, (1,1,0)))
                handles.extend(sim_util.draw_finger_pts_traj(self.sim, flr2transformed_finger_pts_traj_rs, (0,1,0)))
                self.sim.viewer.Step()

        if not self.init_trajectory_transferer:
            # modify the shoulder joint angle of init_traj to be the limit (highest arm) because this usually gives a better local optima (but this might not be the right thing to do)
            dof_inds = sim_util.dof_inds_from_name(self.sim.robot, manip_name)
            joint_ind = self.sim.robot.GetJointIndex("%s_shoulder_lift_joint"%lr)
            init_traj[:,dof_inds.index(joint_ind)] = self.sim.robot.GetDOFLimits([joint_ind])[0][0]

        print "planning joint TPS and finger points trajectory following"
        test_traj, obj_value, tps_rel_pts_costs, tps_cost = planning.joint_fit_tps_follow_finger_pts_trajs(self.sim.robot, manip_name,
                                                                              flr2finger_link_names, flr2finger_rel_pts,
                                                                              flr2demo_finger_pts_trajs_rs, init_traj,
                                                                              reg.f,
                                                                              use_collision_cost=self.use_collision_cost,
                                                                              start_fixed=False,
                                                                              alpha=self.alpha, beta_pos=self.beta_pos, gamma=self.gamma)

        full_traj = (test_traj, sim_util.dof_inds_from_name(self.sim.robot, manip_name))
        test_aug_traj = demonstration.AugmentedTrajectory.create_from_full_traj(self.sim.robot, full_traj, lr2open_finger_traj=demo_aug_traj_rs.lr2open_finger_traj, lr2close_finger_traj=demo_aug_traj_rs.lr2close_finger_traj)

        if plotting:
            for lr in active_lr:
                flr2new_transformed_finger_pts_traj_rs = {}
                for finger_lr in 'lr':
                    flr2new_transformed_finger_pts_traj_rs[finger_lr] = reg.f.transform_points(np.concatenate(flr2demo_finger_pts_traj_rs[finger_lr], axis=0)).reshape((-1,4,3))
                handles.extend(sim_util.draw_finger_pts_traj(self.sim, flr2new_transformed_finger_pts_traj_rs, (0,1,1)))
                handles.append(self.sim.env.drawlinestrip(test_aug_traj.lr2ee_traj[lr][:,:3,3], 2, (0,0,1)))
                flr2test_finger_pts_traj = sim_util.get_finger_pts_traj(self.sim.robot, lr, full_traj)
                handles.extend(sim_util.draw_finger_pts_traj(self.sim, flr2test_finger_pts_traj, (0,0,1)))
            self.sim.viewer.Step()

        return test_aug_traj


text:
package com.amazonaws.services.simpleemail.model.transform;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.amazonaws.AmazonClientException;
import com.amazonaws.Request;
import com.amazonaws.DefaultRequest;
import com.amazonaws.http.HttpMethodName;
import com.amazonaws.services.simpleemail.model.*;
import com.amazonaws.transform.Marshaller;
import com.amazonaws.util.StringUtils;

/**
 * DescribeActiveReceiptRuleSetRequest Marshaller
 */

public class DescribeActiveReceiptRuleSetRequestMarshaller
        implements
        Marshaller<Request<DescribeActiveReceiptRuleSetRequest>, DescribeActiveReceiptRuleSetRequest> {

    public Request<DescribeActiveReceiptRuleSetRequest> marshall(
            DescribeActiveReceiptRuleSetRequest describeActiveReceiptRuleSetRequest) {

        if (describeActiveReceiptRuleSetRequest == null) {
            throw new AmazonClientException(
                    "Invalid argument passed to marshall(...)");
        }

        Request<DescribeActiveReceiptRuleSetRequest> request = new DefaultRequest<DescribeActiveReceiptRuleSetRequest>(
                describeActiveReceiptRuleSetRequest, "AmazonSimpleEmailService");
        request.addParameter("Action", "DescribeActiveReceiptRuleSet");
        request.addParameter("Version", "2010-12-01");
        request.setHttpMethod(HttpMethodName.POST);

        return request;
    }

}


text:
@interface NSObject ()
- (id)initWithORMObject:(ORMObject *)anORMObject;
@end

@interface ORMStore ()
@property (nonatomic, readonly) FMDatabase *db;
@property (nonatomic, readonly) dispatch_queue_t queue;

@property (nonatomic, readonly) NSMutableDictionary *entityConnectors;

@property (nonatomic, readonly) NSMutableSet *insertedObjects;
@property (nonatomic, readonly) NSMutableSet *changedObjects;
@property (nonatomic, readonly) NSMutableSet *deletedObjects;

@property (nonatomic, readonly) NSMapTable *managedObjects;
@end

@implementation ORMStore

@synthesize queue = _queue;

#pragma mark Life-cycle
- (id)init
{
    return [self initWithSerialQueue:nil];
}

- (id)initWithSerialQueue:(dispatch_queue_t)queue;
{
    self = [super init];
    if (self) {

        _entityConnectors = [[NSMutableDictionary alloc] init];

        _managedObjects = [NSMapTable strongToWeakObjectsMapTable];

        _insertedObjects = [[NSMutableSet alloc] init];
        _changedObjects = [[NSMutableSet alloc] init];
        _deletedObjects = [[NSMutableSet alloc] init];

        _queue = queue ? queue : dispatch_queue_create("de.tobias-kraentzer.CocoaORM (ORMStore)", DISPATCH_QUEUE_SERIAL);

        _db = [[FMDatabase alloc] initWithPath:nil];
        BOOL success = [_db open];
        NSAssert(success, @"Coud not open database: %@", [_db.lastError localizedDescription]);

        // Enable Foreign Key Support
        success = [_db executeUpdate:@"PRAGMA foreign_keys = ON"];
        NSAssert(success, @"Coud not enable foreign key support: %@", [_db.lastError localizedDescription]);
    }
    return self;
}

- (void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

#pragma mark Transactions

- (void)commitTransaction:(ORMStoreTransactionCompletionHandler(^)(BOOL *rollback))block
{
    [self commitTransaction:block andWait:NO];
}

- (void)commitTransactionAndWait:(ORMStoreTransactionCompletionHandler(^)(BOOL *rollback))block
{
    [self commitTransaction:block andWait:YES];
}

- (void)commitTransaction:(ORMStoreTransactionCompletionHandler(^)(BOOL *rollback))block andWait:(BOOL)wait
{
    [self commitTransactionInDatabase:^ORMStoreTransactionCompletionHandler(FMDatabase *db, BOOL *rollback) {

        __block BOOL _rollback = NO;
        __block NSError *error = nil;

        ORMStoreTransactionCompletionHandler completionHalndler = block(&_rollback);

        // Insert Objects into Database
        if (!_rollback) {
            [self.insertedObjects enumerateObjectsUsingBlock:^(ORMObject *ORM, BOOL *stop) {

                ORMEntitySQLConnector *connector = [self connectorWithEntityDescription:ORM.entityDescription];

                ORMEntityID eid = [connector insertEntityWithProperties:ORM.changedValues
                                                           intoDatabase:db
                                                                  error:&error];

                if (eid) {
                    ORM.objectID = [[ORMObjectID alloc] initWithEntityDescription:ORM.entityDescription entityID:eid];
                    ORM.store = self;
                } else {
                    *stop = YES;
                    _rollback = YES;
                }
            }];
        }

        // Update Objects in Database
        if (!_rollback) {
            [self.changedObjects enumerateObjectsUsingBlock:^(ORMObject *ORM, BOOL *stop) {

                ORMEntitySQLConnector *connector = [self connectorWithEntityDescription:ORM.entityDescription];

                BOOL success = [connector updateEntityWithEntityID:ORM.objectID.entityID
                                                    withProperties:ORM.changedValues
                                                        inDatabase:db
                                                             error:&error];

                *stop = !success;
                _rollback = !success;
            }];
        }

        // Delete Objects in Database
        if (!_rollback) {
            [self.deletedObjects enumerateObjectsUsingBlock:^(ORMObject *ORM, BOOL *stop) {

                ORMEntitySQLConnector *connector = [self connectorWithEntityDescription:ORM.entityDescription];

                BOOL success = [connector deleteEntityWithEntityID:ORM.objectID.entityID
                                                        inDatabase:db
                                                             error:&error];

                *stop = !success;
                _rollback = !success;
            }];
        }

        *rollback = _rollback;

        return ^(NSError *_error) {

            if (_error) {
                [self resetChanges];
                if (completionHalndler) {
                    completionHalndler(_error);
                }
            } else {
                if (_rollback) {
                    [self resetChanges];
                } else {
                    [self applyChanges];
                }

                if (completionHalndler) {
                    completionHalndler(error);
                }
            }
        };

    } andWait:wait];
}

#pragma mark Object Life-cycle

- (id)objectWithID:(ORMObjectID *)objectID
{
    ORMObject *ORM = [self.managedObjects objectForKey:objectID];
    if (ORM == nil) {
        ORM = [[ORMObject alloc] initWithEntityDescription:objectID.entityDescription];
        ORM.store = self;
        ORM.objectID = objectID;
        [self.managedObjects setObject:ORM forKey:objectID];
    }

    if (ORM.managedObject) {
        return ORM.managedObject;
    } else {
        return [[ORM.entityDescription.managedClass alloc] initWithORMObject:ORM];
    }
}

- (id)createObjectWithEntityDescription:(ORMEntityDescription *)entityDescription
{
    ORMObject *ORM = [[ORMObject alloc] initWithEntityDescription:entityDescription];
    id obj = [[entityDescription.managedClass alloc] initWithORMObject:ORM];
    [self.insertedObjects addObject:ORM];
    return obj;
}

- (void)deleteObject:(NSObject *)object
{
    NSAssert([self.managedObjects objectForKey:object.ORM.objectID] != nil, @"Object '%@' not managed by this store.", object);
    [self.deletedObjects addObject:object.ORM];
}

#pragma mark Object Property Loading

- (void)loadValueWithAttributeDescription:(ORMAttributeDescription *)attributeDescription ofObject:(id)object
{
    NSError *error = nil;
    ORMEntitySQLConnector *connector = [self connectorWithEntityDescription:attributeDescription.entityDescription];
    NSDictionary *properties = [connector propertiesOfEntityWithEntityID:[object ORM].objectID.entityID
                                                              inDatabase:self.db
                                                                   error:&error];
    [[object ORM].persistentValues addEntriesFromDictionary:properties];
}

#pragma mark Object Enumeration

- (void)enumerateObjectsWithEntityDescription:(ORMEntityDescription *)entityDescription
                            matchingCondition:(NSString *)condition
                                withArguments:(NSDictionary *)arguments
                           fetchingProperties:(NSArray *)propertyNames
                                   enumerator:(void(^)(id object, BOOL *stop))enumerator
{
    NSError *error = nil;
    ORMEntitySQLConnector *connector = [self connectorWithEntityDescription:entityDescription];
    [connector enumerateEntitiesInDatabase:self.db matchingCondition:condition withArguments:arguments fetchingProperties:propertyNames error:&error enumerator:^(ORMEntityID eid, __unsafe_unretained Class klass, NSDictionary *properties, BOOL *stop) {
        ORMObjectID *objectID = [[ORMObjectID alloc] initWithEntityDescription:[klass ORMEntityDescription] entityID:eid];
        NSObject *object = [self objectWithID:objectID];
        [[self.ORM persistentValues] addEntriesFromDictionary:properties];
        enumerator(object, stop);
    }];
}

#pragma mark Apply or Reset Changes

- (void)applyChanges
{
    // Insert
    [self.insertedObjects enumerateObjectsUsingBlock:^(ORMObject *ORM, BOOL *stop) {
        [ORM applyChanges];
        [self.managedObjects setObject:ORM forKey:ORM.objectID];
        [[NSNotificationCenter defaultCenter] addObserver:self
                                                 selector:@selector(objectORMValuesDidChange:)
                                                     name:ORMObjectDidChangeValuesNotification
                                                   object:ORM];
    }];
    [self.insertedObjects removeAllObjects];

    // Update
    [self.changedObjects enumerateObjectsUsingBlock:^(ORMObject *ORM, BOOL *stop) {
        [ORM applyChanges];
    }];
    [self.changedObjects removeAllObjects];

    // Delete
    [self.deletedObjects enumerateObjectsUsingBlock:^(ORMObject *ORM, BOOL *stop) {
        ORM.objectID = nil;
        ORM.store = nil;
        [[NSNotificationCenter defaultCenter] removeObserver:self
                                                        name:ORMObjectDidChangeValuesNotification
                                                      object:ORM];
    }];
    [self.deletedObjects removeAllObjects];
}

- (void)resetChanges
{
    // Insert
    [self.insertedObjects enumerateObjectsUsingBlock:^(ORMObject *ORM, BOOL *stop) {
        [ORM resetChanges];
        ORM.objectID = nil;
        ORM.store = nil;
    }];
    [self.insertedObjects removeAllObjects];

    // Update
    [self.changedObjects enumerateObjectsUsingBlock:^(ORMObject *ORM, BOOL *stop) {
        [ORM resetChanges];
    }];
    [self.changedObjects removeAllObjects];

    // Delete
    [self.deletedObjects removeAllObjects];
}

#pragma mark Handle Object Change Notification

- (void)objectORMValuesDidChange:(NSNotification *)aNotification
{
    [self.changedObjects addObject:aNotification.object];
}

#pragma mark Manage Connector

- (ORMEntitySQLConnector *)connectorWithEntityDescription:(ORMEntityDescription *)entityDescription
{
    ORMEntitySQLConnector *connector = [self.entityConnectors objectForKey:entityDescription.name];
    if (!connector) {
        connector = [[ORMEntitySQLConnector alloc] initWithEntityDescription:entityDescription];
        [self.entityConnectors setObject:connector forKey:entityDescription.name];

        NSError *error = nil;
        if (![connector setupSchemataInDatabase:self.db error:&error]) {
            NSLog(@"Failed to setup schemata in datatbase: %@", [error localizedDescription]);
        }
    }
    return connector;
}

@end

@implementation ORMStore (Private)

#pragma mark Database Transaction

- (void)commitTransactionInDatabase:(ORMStoreTransactionCompletionHandler(^)(FMDatabase *db, BOOL *rollback))block;
{
    [self commitTransactionInDatabase:block andWait:NO];
}

- (void)commitTransactionInDatabaseAndWait:(ORMStoreTransactionCompletionHandler(^)(FMDatabase *db, BOOL *rollback))block;
{
    [self commitTransactionInDatabase:block andWait:YES];
}

- (void)commitTransactionInDatabase:(ORMStoreTransactionCompletionHandler(^)(FMDatabase *db, BOOL *rollback))block andWait:(BOOL)wait
{
    void(^_block)() = ^{
        @autoreleasepool {
            // Begin Transaction

            [self.db beginTransaction];

            BOOL rollback = NO;
            ORMStoreTransactionCompletionHandler completionHalndler = block(self.db, &rollback);

            BOOL success = YES;

            if (rollback) {
                // Rollback Transaction
                success = [self.db rollback];
            } else {
                // Commit Transaction
                success = [self.db commit];
            }

            if (completionHalndler) {
                if (!success) {
                    completionHalndler(self.db.lastError);
                } else {
                    completionHalndler(nil);
                }
            }
        }
    };

    if (wait) {
        dispatch_sync(self.queue, _block);
    } else {
        dispatch_async(self.queue, _block);
    }
}

@end


text:
<?php

namespace AppBundle\Repository;

/**
 * TramiteSolicitudRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class TramiteSolicitudRepository extends \Doctrine\ORM\EntityRepository
{
    public function findByVehiculoAndDate($datos)
    {
        $fechaDesde = new \DateTime($datos->fechaDesde);
        $fechaHasta = new \DateTime($datos->fechaHasta);
        $em = $this->getEntityManager();
        $dql = "SELECT ts
            FROM AppBundle:TramiteSolicitud ts, AppBundle:TramiteFactura tf, AppBundle:Factura f
            WHERE ts.tramiteFactura = tf.id
            AND tf.factura = f.id
            AND f.vehiculo = :vehiculoId
            AND ts.fecha BETWEEN :fechaDesde AND :fechaHasta";
        $consulta = $em->createQuery($dql);

        $consulta->setParameters(array(
            'vehiculoId' => $datos->idVehiculo,
            'fechaDesde' => $fechaDesde,
            'fechaHasta' => $fechaHasta,
        ));
        return $consulta->getResult();
    }

    public function findByVehiculoOrderTramite($idVehiculo)
    {
        $em = $this->getEntityManager();
        $dql = "SELECT t
            FROM AppBundle:TramiteSolicitud ts,AppBundle:TramiteFactura tf, AppBundle:TramitePrecio tp, AppBundle:Tramite t
            WHERE ts.tramiteFactura = tf.id
            AND tf.tramitePrecio = tp.id
            AND tp.tramite = t.id
            AND ts.vehiculo = :vehiculoId
            GROUP BY t.id";
        $consulta = $em->createQuery($dql);

        $consulta->setParameters(array(
            'vehiculoId' => $idVehiculo,
        ));
        return $consulta->getResult();
    }

    public function getTramitesVehiculo($vehiculoId)
    {
        $em = $this->getEntityManager();
        $dql = "SELECT ts
            FROM AppBundle:TramiteSolicitud ts, AppBundle:TramiteFactura tf, AppBundle:Factura f
            WHERE ((ts.tramiteFactura = tf.id)
            AND (tf.factura = f.id)
            AND (f.vehiculo = :vehiculoId)
            )
            ";
        $consulta = $em->createQuery($dql);

        $consulta->setParameters(array(
            'vehiculoId' => $vehiculoId,
        ));
        return $consulta->getResult();
    }
    // consulta para agrupar y hace conte por cada uno de tramite
   public function getTramiteReportes()
    {
        $em = $this->getEntityManager();
        $dql = "SELECT ts, count(ts.tramiteFactura) as conteo
                FROM AppBundle:tramiteSolicitud ts
                GROUP BY ts.tramiteFactura
                ORDER BY ts.id ASC";
        $consulta = $em->createQuery($dql);

        return $consulta->getResult();
    }
    // consulta para agrupar y hace conte por cada uno de tramite segun las fechas
    public function getReporteFecha($datos)
    {

        $desde = new \DateTime($datos->desde);
        $hasta = new \DateTime($datos->hasta);
        $sedeOperativa = ($datos->sedeOperativa);

        $em = $this->getEntityManager();
        $dql = "SELECT ts, count(ts.tramiteFactura) as conteo
                FROM AppBundle:tramiteSolicitud ts, AppBundle:tramiteFactura tf,
                     AppBundle:factura f, AppBundle:sedeOperativa so
                WHERE ts.fecha BETWEEN :desde AND :hasta
                AND ts.tramiteFactura = tf.id AND tf.factura = f.id
                AND f.sedeOperativa = so.id AND so.id = :sedeOperativa
                GROUP BY ts.tramiteFactura
                ORDER BY ts.id ASC";
        $consulta = $em->createQuery($dql);
        // var_dump($consulta);
        // die();

        $consulta->setParameters(array(
            'desde' => $desde,
            'hasta' => $hasta,
            'sedeOperativa' => $sedeOperativa,
        ));

        return $consulta->getResult();
    }

    public function getByModuloAndFilter($params)
    {
        $em = $this->getEntityManager();

        switch ($params->tipoFiltro) {
            case 1:
                $dql = "SELECT ts
                FROM AppBundle:TramiteSolicitud ts, AppBundle:TramiteFactura tf,
                AppBundle:Factura f, AppBundle:Modulo m,
                AppBundle:TramitePrecio tp, AppBundle:Vehiculo v,
                AppBundle:CfgPlaca p
                WHERE ts.vehiculo = v.id
                AND v.placa = p.id
                AND p.numero = :placa
                AND tf.factura = f.id
                AND tf.tramitePrecio = tp.id
                AND tp.modulo = :idModulo
                ORDER BY ts.fecha DESC";

                $consulta = $em->createQuery($dql);

                $consulta->setParameters(array(
                    'idModulo' => $params->idModulo,
                    'placa' => $params->filtro,
                ));
                break;

            case 2:
                $dql = "SELECT ts
                FROM AppBundle:TramiteSolicitud ts, AppBundle:TramiteFactura tf,
                AppBundle:Factura f, AppBundle:Modulo m,
                AppBundle:TramitePrecio tp, AppBundle:Vehiculo v,
                AppBundle:CfgPlaca p
                WHERE ts.vehiculo = v.id
                AND v.placa = p.id
                AND tf.factura = f.id
                AND tf.tramitePrecio = tp.id
                AND tp.modulo = :idModulo
                AND f.numero = :numero
                ORDER BY ts.fecha DESC";

                $consulta = $em->createQuery($dql);

                $consulta->setParameters(array(
                    'idModulo' => $params->idModulo,
                    'numero' => $params->filtro,
                ));
                break;

            case 3:
                $dql = "SELECT ts
                FROM AppBundle:TramiteSolicitud ts, AppBundle:TramiteFactura tf,
                AppBundle:Factura f, AppBundle:Modulo m,
                AppBundle:TramitePrecio tp, AppBundle:Vehiculo v,
                AppBundle:CfgPlaca p
                WHERE ts.vehiculo = v.id
                AND v.placa = p.id
                AND tf.factura = f.id
                AND tf.tramitePrecio = tp.id
                AND tp.modulo = :idModulo
                AND ts.fecha = :fecha
                ORDER BY ts.fecha DESC";

                $consulta = $em->createQuery($dql);

                $consulta->setParameters(array(
                    'idModulo' => $params->idModulo,
                    'fecha' => $params->filtro,
                ));
                break;
        }

        return $consulta->getResult();
    }

    public function getMatriculaCancelada($idVehiculo)
    {
        $em = $this->getEntityManager();

        $dql = "SELECT ts
            FROM AppBundle:TramiteFactura tf, AppBundle:Tramite t,
            AppBundle:TramitePrecio tp, AppBundle:TramiteSolicitud ts
            WHERE tf.tramitePrecio = tp.id
            AND tp.tramite = t.id
            AND t.codigo = 15
            AND ts.tramiteFactura = tf.id
            AND ts.vehiculo = :idVehiculo
            AND tf.realizado = true";
        $consulta = $em->createQuery($dql);

        $consulta->setParameters(array(
            'idVehiculo' => $idVehiculo,
        ));

        return $consulta->getOneOrNullResult();
    }
}


text:
__all__ = ['Reader', 'ReaderError']

from error import YAMLError, Mark

import codecs, re

# Unfortunately, codec functions in Python 2.3 does not support the `finish`
# arguments, so we have to write our own wrappers.

try:
    codecs.utf_8_decode('', 'strict', False)
    from codecs import utf_8_decode, utf_16_le_decode, utf_16_be_decode

except TypeError:

    def utf_16_le_decode(data, errors, finish=False):
        if not finish and len(data) % 2 == 1:
            data = data[:-1]
        return codecs.utf_16_le_decode(data, errors)

    def utf_16_be_decode(data, errors, finish=False):
        if not finish and len(data) % 2 == 1:
            data = data[:-1]
        return codecs.utf_16_be_decode(data, errors)

    def utf_8_decode(data, errors, finish=False):
        if not finish:
            # We are trying to remove a possible incomplete multibyte character
            # from the suffix of the data.
            # The first byte of a multi-byte sequence is in the range 0xc0 to 0xfd.
            # All further bytes are in the range 0x80 to 0xbf.
            # UTF-8 encoded UCS characters may be up to six bytes long.
            count = 0
            while count < 5 and count < len(data)   \
                    and '\x80' <= data[-count-1] <= '\xBF':
                count -= 1
            if count < 5 and count < len(data)  \
                    and '\xC0' <= data[-count-1] <= '\xFD':
                data = data[:-count-1]
        return codecs.utf_8_decode(data, errors)

class ReaderError(YAMLError):

    def __init__(self, name, position, character, encoding, reason):
        self.name = name
        self.character = character
        self.position = position
        self.encoding = encoding
        self.reason = reason

    def __str__(self):
        if isinstance(self.character, str):
            return "'%s' codec can't decode byte #x%02x: %s\n"  \
                    "  in \"%s\", position %d"    \
                    % (self.encoding, ord(self.character), self.reason,
                            self.name, self.position)
        else:
            return "unacceptable character #x%04x: %s\n"    \
                    "  in \"%s\", position %d"    \
                    % (ord(self.character), self.reason,
                            self.name, self.position)

class Reader:
    # Reader:
    # - determines the data encoding and converts it to unicode,
    # - checks if characters are in allowed range,
    # - adds '\0' to the end.

    # Reader accepts
    #  - a `str` object,
    #  - a `unicode` object,
    #  - a file-like object with its `read` method returning `str`,
    #  - a file-like object with its `read` method returning `unicode`.

    # Yeah, it's ugly and slow.

    def __init__(self, stream):
        self.name = None
        self.stream = None
        self.stream_pointer = 0
        self.eof = True
        self.buffer = u''
        self.pointer = 0
        self.raw_buffer = None
        self.raw_decode = None
        self.encoding = None
        self.index = 0
        self.line = 0
        self.column = 0
        if isinstance(stream, unicode):
            self.name = "<unicode string>"
            self.check_printable(stream)
            self.buffer = stream+u'\0'
        elif isinstance(stream, str):
            self.name = "<string>"
            self.raw_buffer = stream
            self.determine_encoding()
        else:
            self.stream = stream
            self.name = getattr(stream, 'name', "<file>")
            self.eof = False
            self.raw_buffer = ''
            self.determine_encoding()

    def peek(self, index=0):
        if self.pointer+index+1 >= len(self.buffer):
            self.update(index+1)
        return self.buffer[self.pointer+index]

    def prefix(self, length=1):
        if self.pointer+length >= len(self.buffer):
            self.update(length)
        return self.buffer[self.pointer:self.pointer+length]

    def forward(self, length=1):
        if self.pointer+length+1 >= len(self.buffer):
            self.update(length+1)
        for k in range(length):
            ch = self.buffer[self.pointer]
            self.pointer += 1
            self.index += 1
            if ch in u'\n\x85\u2028\u2029'  \
                    or (ch == u'\r' and self.buffer[self.pointer+1] != u'\n'):
                self.line += 1
                self.column = 0
            elif ch != u'\uFEFF':
                self.column += 1

    def get_mark(self):
        if self.stream is None:
            return Mark(self.name, self.index, self.line, self.column,
                    self.buffer, self.pointer)
        else:
            return Mark(self.name, self.index, self.line, self.column,
                    None, None)

    def determine_encoding(self):
        while not self.eof and len(self.raw_buffer) < 2:
            self.update_raw()
        if not isinstance(self.raw_buffer, unicode):
            if self.raw_buffer.startswith(codecs.BOM_UTF16_LE):
                self.raw_decode = utf_16_le_decode
                self.encoding = 'utf-16-le'
            elif self.raw_buffer.startswith(codecs.BOM_UTF16_BE):
                self.raw_decode = utf_16_be_decode
                self.encoding = 'utf-16-be'
            else:
                self.raw_decode = utf_8_decode
                self.encoding = 'utf-8'
        self.update(1)

    NON_PRINTABLE = re.compile(u'[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\uD7FF\uE000-\uFFFD]')
    def check_printable(self, data):
        match = self.NON_PRINTABLE.search(data)
        if match:
            character = match.group()
            position = self.index+(len(self.buffer)-self.pointer)+match.start()
            raise ReaderError(self.name, position, character,
                    'unicode', "special characters are not allowed")

    def update(self, length):
        if self.raw_buffer is None:
            return
        self.buffer = self.buffer[self.pointer:]
        self.pointer = 0
        while len(self.buffer) < length:
            if not self.eof:
                self.update_raw()
            if self.raw_decode is not None:
                try:
                    data, converted = self.raw_decode(self.raw_buffer,
                            'strict', self.eof)
                except UnicodeDecodeError, exc:
                    character = exc.object[exc.start]
                    if self.stream is not None:
                        position = self.stream_pointer-len(self.raw_buffer)+exc.start
                    else:
                        position = exc.start
                    raise ReaderError(self.name, position, character,
                            exc.encoding, exc.reason)
            else:
                data = self.raw_buffer
                converted = len(data)
            self.check_printable(data)
            self.buffer += data
            self.raw_buffer = self.raw_buffer[converted:]
            if self.eof:
                self.buffer += u'\0'
                self.raw_buffer = None
                break

    def update_raw(self, size=1024):
        data = self.stream.read(size)
        if data:
            self.raw_buffer += data
            self.stream_pointer += len(data)
        else:
            self.eof = True

#try:
#    import psyco
#    psyco.bind(Reader)
#except ImportError:
#    pass


text:
			 0">
				Personal Information

		<li data-bind="css: {active: role().personalInformation() < 1}">
			 0">Insurance

 0">

		<div class="tab-pane outerPane" id="insurance"
			 data-bind="css: {active: role().personalInformation() < 1}, visible: role().insurance() > 0">