text:
package com.google.cloud.genomics.dataflow.functions;

import org.apache.beam.sdk.options.Default;
import org.apache.beam.sdk.options.Description;
import org.apache.beam.sdk.options.PipelineOptions;
import org.apache.beam.sdk.metrics.Metrics;
import org.apache.beam.sdk.transforms.DoFn;
import org.apache.beam.sdk.values.KV;
import com.google.cloud.genomics.utils.Contig;
import com.google.genomics.v1.Read;

import java.util.logging.Logger;

/*
 * Takes a read and associates it with a Contig.
 * This can be used to shard Reads so they can be written to disk in parallel.
 * The size of the Contigs is determined by Options.getLociPerWritingShard.
 */
public class KeyReadsFn extends DoFn<Read, KV<Contig,Read>> {
  private static final Logger LOG = Logger.getLogger(KeyReadsFn.class.getName());

  public static interface Options extends PipelineOptions {
    @Description("Loci per writing shard")
    @Default.Long(10000)
    long getLociPerWritingShard();

    void setLociPerWritingShard(long lociPerShard);
  }

  private long lociPerShard;
  private long count;
  private long minPos = Long.MAX_VALUE;
  private long maxPos = Long.MIN_VALUE;

  @StartBundle
  public void startBundle(StartBundleContext c) {
    lociPerShard = c.getPipelineOptions()
      .as(Options.class)
      .getLociPerWritingShard();
    count = 0;
  }

  @FinishBundle
  public void finishBundle(FinishBundleContext c) {
    LOG.info("KeyReadsDone: Processed " + count + " reads" + "min=" + minPos +
        " max=" + maxPos);
  }

  @ProcessElement
  public void processElement(DoFn<Read, KV<Contig, Read>>.ProcessContext c)
    throws Exception {
    final Read read = c.element();
    long pos = read.getAlignment().getPosition().getPosition();
    minPos = Math.min(minPos, pos);
    maxPos = Math.max(maxPos, pos);
    count++;
    c.output(
        KV.of(
            shardKeyForRead(read, lociPerShard),
            read));
    Metrics.counter(KeyReadsFn.class, "Keyed reads").inc();
    if (isUnmapped(read)) {
      Metrics.counter(KeyReadsFn.class, "Keyed unmapped reads").inc();
    }
  }

  static boolean isUnmapped(Read read) {
    if (read.getAlignment() == null || read.getAlignment().getPosition() == null) {
      return true;
    }
    final String reference = read.getAlignment().getPosition().getReferenceName();
    if (reference == null || reference.isEmpty() || reference.equals("*")) {
      return true;
    }
    return false;
  }

  public static Contig shardKeyForRead(Read read, long lociPerShard) {
    String referenceName = null;
    Long alignmentStart = null;
    if (read.getAlignment() != null) {
      if (read.getAlignment().getPosition() != null ) {
        referenceName = read.getAlignment().getPosition().getReferenceName();
        alignmentStart = read.getAlignment().getPosition().getPosition();
      }
    }
    // If this read is unmapped but its mate is mapped, group them together.
    if (referenceName == null || referenceName.isEmpty() ||
        referenceName.equals("*") || alignmentStart == null) {
      if (read.getNextMatePosition() != null) {
        referenceName = read.getNextMatePosition().getReferenceName();
        alignmentStart = read.getNextMatePosition().getPosition();
      }
    }
    if (referenceName == null || referenceName.isEmpty()) {
      referenceName = "*";
    }
    if (alignmentStart == null) {
      alignmentStart = new Long(0);
    }
    return shardFromAlignmentStart(referenceName, alignmentStart, lociPerShard);
  }

  static Contig shardFromAlignmentStart(String referenceName, long alignmentStart, long lociPerShard) {
    final long shardStart = (alignmentStart / lociPerShard) * lociPerShard;
    return new Contig(referenceName, shardStart, shardStart + lociPerShard);
  }
}


text:
module.exports = function () {
  blacklistSongById = function (songid, from) {
    models.Play.findOne({
      include: [
        {
          model: models.Song,
          where: { $and: [{ site: config.site }, { host_id: songid }] },
        },
        models.User,
      ],
      order: [["created_at", "DESC"]],
    }).then(function (row) {
      if (!row) {
        bot.sendChat("I have not seen a song with id `" + songid + "` played in this room!");
      } else {
        var userData = {
          type: "blacklist",
          details: "Blacklisted " + row.Song.name + " (spun by " + row.User.username + ")",
          user_id: row.User.id,
          mod_user_id: from.db.id,
        };
        models.Karma.create(userData);
        models.Song.update({ is_banned: 1 }, { where: { host_id: songid } });
        bot.sendChat('The song "' + row.Song.name + '" has been blacklisted.');
        message = "[BLACKLIST] " + from.username + " blacklisted " + row.Song.name + " (ID:" + row.Song.host_id + ")";
        console.log(message);
        sendToWebhooks(message);
      }
    });
  };

  monitorDJList = function () {};

  idleWaitListProcess = function () {
    // Check for active mods
    roomHasActiveStaff = false;

    // @FIXME - This should probably be recoded using Promise.all so it's in order
    var idleDJs = [];
    Promise.map(bot.getUsers(), function (dj) {
      if (dj.id) {
        return models.User.find({
          where: { site_id: dj.id, site: config.site },
          include: {
            model: models.Karma,
            required: false,
            where: {
              type: "warn",
              created_at: {
                gte: moment.utc().subtract(config.queue.djIdleAfterMins, "minutes").toDate(),
              },
            },
            limit: 1,
            order: [["created_at", "DESC"]],
          },
        }).then(function (dbUser) {
          if (dbUser) {
            var position = bot.getWaitListPosition(dj.id);

            if (botUser.db.id !== dbUser.id && dbUser.role > 1 && (secondsSince(dbUser.last_active) <= 300 || position >= 0)) {
              console.log("[STAFF-ACTIVE]", dbUser.username + " last active " + timeSince(dbUser.last_active));
              roomHasActiveStaff = true;
            }

            if (position < 1) {
              // Don't do anything, user is not in line
            } else if (settings.djidle && secondsSince(dbUser.last_active) >= settings.maxdjidletime && moment.utc().isAfter(moment.utc(startupTimestamp).add(config.queue.djIdleAfterMins, "minutes"))) {
              console.log("[WL-IDLE]", position + ". " + dbUser.username + " last active " + timeSince(dbUser.last_active));
              if (dbUser.Karmas.length > 0) {
                console.log("[WL-IDLE]", dbUser.username + " was last warned " + timeSince(dbUser.Karmas[0].created_at));
                bot.moderateRemoveDJ(dj.id);
                bot.sendChat("@" + dbUser.username + " " + config.responses.activeDJRemoveMessage);
                var userData = {
                  type: "remove",
                  details: "Removed from position " + position + ": AFK for " + timeSince(dbUser.last_active, true),
                  user_id: dbUser.id,
                  mod_user_id: botUser.db.id,
                };
                models.Karma.create(userData);
              } else if (position > 1) {
                var userData = {
                  type: "warn",
                  details: "Warned in position " + position + ": AFK for " + timeSince(dbUser.last_active, true),
                  user_id: dbUser.id,
                  mod_user_id: botUser.db.id,
                };
                models.Karma.create(userData);
                idleDJs.push(dbUser.username);
              }
            } else {
              console.log("[WL-ACTIVE]", position + ". " + dbUser.username + " last active " + timeSince(dbUser.last_active));
            }
          }
        });
      }
    }).then(function () {
      if (idleDJs.length > 0) {
        var idleDJsList = idleDJs.join(" @");
        bot.sendChat("@" + idleDJsList + " " + config.responses.activeDJReminder);
      }

      if (moment.utc().isAfter(moment.utc(startupTimestamp).add(5, "minutes"))) {
        if (roomHasActiveStaff && (settings.rdjplus || settings.bouncerplus)) {
          bot.sendChat("Active @staff detected. Revoking temporary extra permissions @rdjs");
          settings.rdjplus = false;
          settings.bouncerplus = false;
        } else if (!roomHasActiveStaff && (!settings.rdjplus || !settings.bouncerplus)) {
          bot.sendChat("No active @staff detected. Granting Bouncers and @rdjs temporary extra permissions");
          settings.rdjplus = true;
          settings.bouncerplus = true;
        }
      }
    });
    saveWaitList(true);

    var waitListSize = bot.getWaitList().length;

    if (waitListSize >= settings.djidleminqueue && settings.djidle == false) {
      settings.djidle = true;
      bot.changeDJCycle(false);
      bot.sendChat("Wait List at " + waitListSize + " @djs.  Idle timer enabled and cycle disabled");
    } else if (waitListSize < settings.djidleminqueue && settings.djidle == true) {
      settings.djidle = false;
      bot.changeDJCycle(true);
      bot.sendChat("Wait List at " + waitListSize + " @djs.  Idle timer disabled and cycle enabled");
    }
  };

  removeIfDownvoting = function (mehUsername) {
    var mehWaitList = bot.getWaitList();
    var mehUser = findUserInList(mehWaitList, mehUsername);

    if (config.verboseLogging) {
      console.log("[WAITLIST]" + JSON.stringify(mehWaitList, null, 2));
    }

    if (mehUser !== undefined && mehUser.vote == -1) {
      console.log("[REMOVE] Removed " + mehUser.username + " from wait list for mehing");
      var position = bot.getWaitListPosition(mehUser.id);
      bot.moderateRemoveDJ(mehUser.id);
      bot.sendChat("@" + mehUser.username + ", voting MEH/Chato/:thumbsdown: while in line is prohibited. Check .rules.");
      getDbUserFromSiteUser(mehUser.id, function (row) {
        var userData = {
          type: "remove",
          details: "Removed from position " + position + " for mehing",
          user_id: row.id,
          mod_user_id: botUser.db.id,
        };
        models.Karma.create(userData);
      });
    }
  };

  addKarma = function (data) {
    var userData = {
      type: data.type,
      details: data.details,
      user_id: data.user_id,
      mod_user_id: data.mod_user_id,
    };
    models.Karma.create(userData).then(function () {
      models.Karma.findAndCount({
        where: {
          user_id: data.user_id,
          created_at: { gte: moment.utc().subtract(1, "hours").toDate() },
        },
      }).then(function (results) {
        if (results.count > 2) {
          bot.moderateBanUser(data.site_id, PlugAPI.BAN_REASON.SPAMMING_TROLLING, PlugAPI.BAN.DAY);
        }
      });
    });
    console.log(data.message);
    sendToWebhooks(data.message);
  };
};

redpajama_set_name: RedPajamaGithub


text:
package wrr

import (
	"net/http"
	"net/http/httptest"
	"testing"

	"github.com/stretchr/testify/assert"
	"github.com/traefik/traefik/v2/pkg/config/dynamic"
)

func Int(v int) *int { return &v }

type responseRecorder struct {
	*httptest.ResponseRecorder
	save     map[string]int
	sequence []string
}

func (r *responseRecorder) WriteHeader(statusCode int) {
	r.save[r.Header().Get("server")]++
	r.sequence = append(r.sequence, r.Header().Get("server"))
	r.ResponseRecorder.WriteHeader(statusCode)
}

func TestBalancer(t *testing.T) {
	balancer := New(nil)

	balancer.AddService("first", http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
		rw.Header().Set("server", "first")
		rw.WriteHeader(http.StatusOK)
	}), Int(3))

	balancer.AddService("second", http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
		rw.Header().Set("server", "second")
		rw.WriteHeader(http.StatusOK)
	}), Int(1))

	recorder := &responseRecorder{ResponseRecorder: httptest.NewRecorder(), save: map[string]int{}}
	for i := 0; i < 4; i++ {
		balancer.ServeHTTP(recorder, httptest.NewRequest(http.MethodGet, "/", nil))
	}

	assert.Equal(t, 3, recorder.save["first"])
	assert.Equal(t, 1, recorder.save["second"])
}

func TestBalancerNoService(t *testing.T) {
	balancer := New(nil)

	recorder := httptest.NewRecorder()
	balancer.ServeHTTP(recorder, httptest.NewRequest(http.MethodGet, "/", nil))

	assert.Equal(t, http.StatusInternalServerError, recorder.Result().StatusCode)
}

func TestBalancerOneServerZeroWeight(t *testing.T) {
	balancer := New(nil)

	balancer.AddService("first", http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
		rw.Header().Set("server", "first")
		rw.WriteHeader(http.StatusOK)
	}), Int(1))

	balancer.AddService("second", http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {}), Int(0))

	recorder := &responseRecorder{ResponseRecorder: httptest.NewRecorder(), save: map[string]int{}}
	for i := 0; i < 3; i++ {
		balancer.ServeHTTP(recorder, httptest.NewRequest(http.MethodGet, "/", nil))
	}

	assert.Equal(t, 3, recorder.save["first"])
}

func TestBalancerAllServersZeroWeight(t *testing.T) {
	balancer := New(nil)

	balancer.AddService("test", http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {}), Int(0))
	balancer.AddService("test2", http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {}), Int(0))

	recorder := httptest.NewRecorder()
	balancer.ServeHTTP(recorder, httptest.NewRequest(http.MethodGet, "/", nil))

	assert.Equal(t, http.StatusInternalServerError, recorder.Result().StatusCode)
}

func TestSticky(t *testing.T) {
	balancer := New(&dynamic.Sticky{
		Cookie: &dynamic.Cookie{Name: "test"},
	})

	balancer.AddService("first", http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
		rw.Header().Set("server", "first")
		rw.WriteHeader(http.StatusOK)
	}), Int(1))

	balancer.AddService("second", http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
		rw.Header().Set("server", "second")
		rw.WriteHeader(http.StatusOK)
	}), Int(2))

	recorder := &responseRecorder{ResponseRecorder: httptest.NewRecorder(), save: map[string]int{}}

	req := httptest.NewRequest(http.MethodGet, "/", nil)
	for i := 0; i < 3; i++ {
		for _, cookie := range recorder.Result().Cookies() {
			req.AddCookie(cookie)
		}
		recorder.ResponseRecorder = httptest.NewRecorder()

		balancer.ServeHTTP(recorder, req)
	}

	assert.Equal(t, 0, recorder.save["first"])
	assert.Equal(t, 3, recorder.save["second"])
}

// TestBalancerBias makes sure that the WRR algorithm spreads elements evenly right from the start,
// and that it does not "over-favor" the high-weighted ones with a biased start-up regime.
func TestBalancerBias(t *testing.T) {
	balancer := New(nil)

	balancer.AddService("first", http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
		rw.Header().Set("server", "A")
		rw.WriteHeader(http.StatusOK)
	}), Int(11))

	balancer.AddService("second", http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {
		rw.Header().Set("server", "B")
		rw.WriteHeader(http.StatusOK)
	}), Int(3))

	recorder := &responseRecorder{ResponseRecorder: httptest.NewRecorder(), save: map[string]int{}}

	for i := 0; i < 14; i++ {
		balancer.ServeHTTP(recorder, httptest.NewRequest(http.MethodGet, "/", nil))
	}

	wantSequence := []string{"A", "A", "A", "B", "A", "A", "A", "A", "B", "A", "A", "A", "B", "A"}

	assert.Equal(t, wantSequence, recorder.sequence)
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Eimbo.Dominio.Comum.Entidade;
using FluentNHibernate.Mapping;

namespace Eimbo.Infraestrutura.Repositorio.NHibernate.Cadastro.Mapeamento
{
    public class CidadeMap :ClassMap<Cidade>
    {
        public CidadeMap()
        {
            this.Table("cidades");

            this.Id(c => c.Id)
                 .Column("id")
                 .Not.Nullable()
                 .Index("idx_cidade_pkey")
                 .GeneratedBy
                 .SequenceIdentity("seq_cidades");

            this.Map(c => c.Nome)
                .Column("nome")
                .Not.Nullable()
                .Length(300);

            this.Map(c => c.Status)
                .Column("status")
                .CustomType(typeof(int))
                .Not.Nullable()
                .Length(1);

            this.References(c => c.Estado)
                           .Column("estado_id")
                           .Not.Nullable()
                           .Index("idx_estado_fkey")
                           .Cascade.Delete()
                           .ForeignKey("cidade_estado_fkey");

        }
    }
}


text:
module Corkboard
  # Providers are the heart of Corkboard's aggregation of content.
  # Each provider defined must include this module.
  module Provider
    extend ActiveSupport::Concern

    included do |base|
      base.extend(ActiveModel::Naming)
    end

    module ClassMethods
      def service
        @service ||= self.model_name.element.intern
      end
    end

    def service
      @service ||= self.class.service
    end
  end
end


text:
require 'sinatra/base'
require 'rbconfig'
require 'open-uri'
require 'sinatra/runner'

module IntegrationHelper
  class BaseServer < Sinatra::Runner
    extend Enumerable
    attr_accessor :server, :port
    alias name server

    def self.all
      @all ||= []
    end

    def self.each(&block)
      all.each(&block)
    end

    def self.run(server, port)
      new(server, port).run
    end

    def app_file
      File.expand_path('integration/app.rb', __dir__)
    end

    def environment
      "development"
    end

    def initialize(server, port)
      @installed, @pipe, @server, @port = nil, nil, server, port
      Server.all << self
    end

    def run
      return unless installed?
      kill
      @log     = ""
      super
      at_exit { kill }
    end

    def installed?
      return @installed unless @installed.nil?
      s = server == 'HTTP' ? 'net/http/server' : server
      require s
      @installed = true
    rescue LoadError
      warn "#{server} is not installed, skipping integration tests"
      @installed = false
    end

    def command
      @command ||= begin
        cmd = ["APP_ENV=#{environment}", "exec"]
        if RbConfig.respond_to? :ruby
          cmd << RbConfig.ruby.inspect
        else
          file, dir = RbConfig::CONFIG.values_at('ruby_install_name', 'bindir')
          cmd << File.expand_path(file, dir).inspect
        end
        cmd << "-w" unless net_http_server?
        cmd << "-I" << File.expand_path('../lib', __dir__).inspect
        cmd << app_file.inspect << '-s' << server << '-o' << '127.0.0.1' << '-p' << port
        cmd << "-e" << environment.to_s << '2>&1'
        cmd.join " "
      end
    end

    def webrick?
      name.to_s == "webrick"
    end

    def rainbows?
      name.to_s == "rainbows"
    end

    def puma?
      name.to_s == "puma"
    end

    def falcon?
      name.to_s == "falcon"
    end

    def trinidad?
      name.to_s == "trinidad"
    end

    def net_http_server?
      name.to_s == 'HTTP'
    end

    def warnings
      log.scan(%r[(?:\(eval|lib/sinatra).*warning:.*$])
    end

    def run_test(target, &block)
      retries ||= 3
      target.server = self
      run unless alive?
      target.instance_eval(&block)
    rescue Exception => error
      retries -= 1
      kill
      retries < 0 ? retry : raise(error)
    end
  end

  Server = BaseServer

  def it(message, &block)
    Server.each do |server|
      next unless server.installed?
      super("with #{server.name}: #{message}") { server.run_test(self, &block) }
    end
  end

  def self.extend_object(obj)
    super

    base_port = 5000 + Process.pid % 100
    servers = Sinatra::Base.server.dup

    # TruffleRuby doesn't support `Fiber.set_scheduler` yet
    unless Fiber.respond_to?(:set_scheduler)
      warn "skip falcon server"
      servers.delete('falcon')
    end

    servers.each_with_index do |server, index|
      Server.run(server, base_port+index)
    end
  end
end


text:
namespace NorthwindWindowsStore.Service.Map.Table
{
    using NorthwindWindowsStore.DAL.Model;
    using NorthwindWindowsStore.ViewModel;

    public class CustomerMap : BaseMapper<Customer, CustomerViewModel>
    {
        public override System.Action<Nelibur.ObjectMapper.Bindings.IBindingConfig<Customer, CustomerViewModel>> GetConfig()
        {
            return new System.Action<Nelibur.ObjectMapper.Bindings.IBindingConfig<Customer, CustomerViewModel>>(config =>
            {
                config.Bind(x => x.CustomerID, o => o.CustomerID);
                config.Bind(x => x.CompanyName, o => o.CompanyName);
                config.Bind(x => x.ContactName, o => o.ContactName);
                config.Bind(x => x.ContactTitle, o => o.ContactTitle);
                config.Bind(x => x.Address, o => o.Address);
                config.Bind(x => x.City, o => o.City);
                config.Bind(x => x.Region, o => o.Region);
                config.Bind(x => x.PostalCode, o => o.PostalCode);
                config.Bind(x => x.Country, o => o.Country);
                config.Bind(x => x.Phone, o => o.Phone);
                config.Bind(x => x.Fax, o => o.Fax);
                config.Ignore(x => x.Orders);
                config.Ignore(x => x.CustomerDemographics);
            });
        }
    }
}


text:
#include "xcam_utils.h"
#include "base/xcam_3a_result.h"
#include "cl_rgb_pipe_handler.h"

namespace XCam {

CLRgbPipeImageKernel::CLRgbPipeImageKernel (SmartPtr<CLContext> &context)
    : CLImageKernel (context, "kernel_rgb_pipe")
{
    _tnr_config.thr_r = 0.064;
    _tnr_config.thr_g = 0.045;
    _tnr_config.thr_b = 0.073;
}

bool
CLRgbPipeImageKernel::set_tnr_config (const XCam3aResultTemporalNoiseReduction& config)
{
    _tnr_config.gain = (float)config.gain;
    _tnr_config.thr_r  = (float)config.threshold[0];
    _tnr_config.thr_g  = (float)config.threshold[1];
    _tnr_config.thr_b  = (float)config.threshold[2];
    XCAM_LOG_DEBUG ("set TNR RGB config: _gain(%f), _thr_r(%f), _thr_g(%f), _thr_b(%f)",
                    _tnr_config.gain, _tnr_config.thr_r, _tnr_config.thr_g, _tnr_config.thr_b);

    return true;
}

XCamReturn
CLRgbPipeImageKernel::prepare_arguments (
    SmartPtr<DrmBoBuffer> &input, SmartPtr<DrmBoBuffer> &output,
    CLArgument args[], uint32_t &arg_count,
    CLWorkSize &work_size)
{
    SmartPtr<CLContext> context = get_context ();
    const VideoBufferInfo & video_info = input->get_video_info ();

    _image_in = new CLVaImage (context, input);
    _image_out = new CLVaImage (context, output);

    if (_image_in_list.size () < 4) {
        while (_image_in_list.size () < 4) {
            _image_in_list.push_back (_image_in);
        }
    } else {
        _image_in_list.pop_front ();
        _image_in_list.push_back (_image_in);
    }
    XCAM_ASSERT (_image_in->is_valid () && _image_out->is_valid ());
    XCAM_FAIL_RETURN (
        WARNING,
        _image_in->is_valid () && _image_out->is_valid (),
        XCAM_RETURN_ERROR_MEM,
        "cl image kernel(%s) in/out memory not available", get_kernel_name ());

    //set args;
    args[0].arg_adress = &_image_out->get_mem_id ();
    args[0].arg_size = sizeof (cl_mem);
    args[1].arg_adress = &_tnr_config;
    args[1].arg_size = sizeof (CLRgbPipeTnrConfig);

    uint8_t index = 0;
    for (std::list<SmartPtr<CLImage>>::iterator it = _image_in_list.begin (); it != _image_in_list.end (); it++) {
        args[2 + index].arg_adress = &(*it)->get_mem_id ();
        args[2 + index].arg_size = sizeof (cl_mem);
        index++;
    }

    arg_count = 2 + index;

    work_size.dim = XCAM_DEFAULT_IMAGE_DIM;
    work_size.global[0] = XCAM_ALIGN_UP(video_info.width, 16);
    work_size.global[1] = XCAM_ALIGN_UP(video_info.height, 16);
    work_size.local[0] = 8;
    work_size.local[1] = 4;

    return XCAM_RETURN_NO_ERROR;
}

CLRgbPipeImageHandler::CLRgbPipeImageHandler (const char *name)
    : CLImageHandler (name)
{
}

bool
CLRgbPipeImageHandler::set_rgb_pipe_kernel(SmartPtr<CLRgbPipeImageKernel> &kernel)
{
    SmartPtr<CLImageKernel> image_kernel = kernel;
    add_kernel (image_kernel);
    _rgb_pipe_kernel = kernel;
    return true;
}

bool
CLRgbPipeImageHandler::set_tnr_config (const XCam3aResultTemporalNoiseReduction& config)
{
    if (!_rgb_pipe_kernel->is_valid ()) {
        XCAM_LOG_ERROR ("set config error, invalid TNR kernel !");
    }

    _rgb_pipe_kernel->set_tnr_config (config);

    return true;
}

SmartPtr<CLImageHandler>
create_cl_rgb_pipe_image_handler (SmartPtr<CLContext> &context)
{
    SmartPtr<CLRgbPipeImageHandler> rgb_pipe_handler;
    SmartPtr<CLRgbPipeImageKernel> rgb_pipe_kernel;
    XCamReturn ret = XCAM_RETURN_NO_ERROR;

    rgb_pipe_kernel = new CLRgbPipeImageKernel (context);
    {
        XCAM_CL_KERNEL_FUNC_SOURCE_BEGIN(kernel_rgb_pipe)
#include "kernel_rgb_pipe.clx"
        XCAM_CL_KERNEL_FUNC_END;
        ret = rgb_pipe_kernel->load_from_source (kernel_rgb_pipe_body, strlen (kernel_rgb_pipe_body));
        XCAM_FAIL_RETURN (
            WARNING,
            ret == XCAM_RETURN_NO_ERROR,
            NULL,
            "CL image handler(%s) load source failed", rgb_pipe_kernel->get_kernel_name());
    }
    XCAM_ASSERT (rgb_pipe_kernel->is_valid ());
    rgb_pipe_handler = new CLRgbPipeImageHandler ("cl_handler_rgb_pipe");
    rgb_pipe_handler->set_rgb_pipe_kernel  (rgb_pipe_kernel);

    return rgb_pipe_handler;
}

};


text:
namespace Kvasir {
//Supply Controller
    namespace SupcCr{    ///<Supply Controller Control Register
        using Addr = Register::Address<0x400e1410,0x00fffff3,0x00000000,unsigned>;
        ///Voltage Regulator Off
        enum class VroffVal {
            noEffect=0x00000000,     ///<no effect.
            stopVreg=0x00000001,     ///<if KEY is correct, asserts vddcore_nreset and stops the voltage regulator.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::Access<Register::AccessType::writeOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,VroffVal> vroff{};
        namespace VroffValC{
            constexpr Register::FieldValue<decltype(vroff)::Type,VroffVal::noEffect> noEffect{};
            constexpr Register::FieldValue<decltype(vroff)::Type,VroffVal::stopVreg> stopVreg{};
        }
        ///Crystal Oscillator Select
        enum class XtalselVal {
            noEffect=0x00000000,     ///<no effect.
            crystalSel=0x00000001,     ///<if KEY is correct, switches the slow clock on the crystal oscillator output.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::Access<Register::AccessType::writeOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,XtalselVal> xtalsel{};
        namespace XtalselValC{
            constexpr Register::FieldValue<decltype(xtalsel)::Type,XtalselVal::noEffect> noEffect{};
            constexpr Register::FieldValue<decltype(xtalsel)::Type,XtalselVal::crystalSel> crystalSel{};
        }
        ///Password
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,24),Register::Access<Register::AccessType::writeOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,unsigned> key{};
    }
    namespace SupcSmmr{    ///<Supply Controller Supply Monitor Mode Register
        using Addr = Register::Address<0x400e1414,0xffffc8f0,0x00000000,unsigned>;
        ///Supply Monitor Threshold
        enum class SmthVal {
            v19v=0x00000000,     ///<1.9 V
            v20v=0x00000001,     ///<2.0 V
            v21v=0x00000002,     ///<2.1 V
            v22v=0x00000003,     ///<2.2 V
            v23v=0x00000004,     ///<2.3 V
            v24v=0x00000005,     ///<2.4 V
            v25v=0x00000006,     ///<2.5 V
            v26v=0x00000007,     ///<2.6 V
            v27v=0x00000008,     ///<2.7 V
            v28v=0x00000009,     ///<2.8 V
            v29v=0x0000000a,     ///<2.9 V
            v30v=0x0000000b,     ///<3.0 V
            v31v=0x0000000c,     ///<3.1 V
            v32v=0x0000000d,     ///<3.2 V
            v33v=0x0000000e,     ///<3.3 V
            v34v=0x0000000f,     ///<3.4 V
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,0),Register::ReadWriteAccess,SmthVal> smth{};
        namespace SmthValC{
            constexpr Register::FieldValue<decltype(smth)::Type,SmthVal::v19v> v19v{};
            constexpr Register::FieldValue<decltype(smth)::Type,SmthVal::v20v> v20v{};
            constexpr Register::FieldValue<decltype(smth)::Type,SmthVal::v21v> v21v{};
            constexpr Register::FieldValue<decltype(smth)::Type,SmthVal::v22v> v22v{};
            constexpr Register::FieldValue<decltype(smth)::Type,SmthVal::v23v> v23v{};
            constexpr Register::FieldValue<decltype(smth)::Type,SmthVal::v24v> v24v{};
            constexpr Register::FieldValue<decltype(smth)::Type,SmthVal::v25v> v25v{};
            constexpr Register::FieldValue<decltype(smth)::Type,SmthVal::v26v> v26v{};
            constexpr Register::FieldValue<decltype(smth)::Type,SmthVal::v27v> v27v{};
            constexpr Register::FieldValue<decltype(smth)::Type,SmthVal::v28v> v28v{};
            constexpr Register::FieldValue<decltype(smth)::Type,SmthVal::v29v> v29v{};
            constexpr Register::FieldValue<decltype(smth)::Type,SmthVal::v30v> v30v{};
            constexpr Register::FieldValue<decltype(smth)::Type,SmthVal::v31v> v31v{};
            constexpr Register::FieldValue<decltype(smth)::Type,SmthVal::v32v> v32v{};
            constexpr Register::FieldValue<decltype(smth)::Type,SmthVal::v33v> v33v{};
            constexpr Register::FieldValue<decltype(smth)::Type,SmthVal::v34v> v34v{};
        }
        ///Supply Monitor Sampling Period
        enum class SmsmplVal {
            smd=0x00000000,     ///<Supply Monitor disabled
            csm=0x00000001,     ///<Continuous Supply Monitor
            v32slck=0x00000002,     ///<Supply Monitor enabled one SLCK period every 32 SLCK periods
            v256slck=0x00000003,     ///<Supply Monitor enabled one SLCK period every 256 SLCK periods
            v2048slck=0x00000004,     ///<Supply Monitor enabled one SLCK period every 2,048 SLCK periods
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,8),Register::ReadWriteAccess,SmsmplVal> smsmpl{};
        namespace SmsmplValC{
            constexpr Register::FieldValue<decltype(smsmpl)::Type,SmsmplVal::smd> smd{};
            constexpr Register::FieldValue<decltype(smsmpl)::Type,SmsmplVal::csm> csm{};
            constexpr Register::FieldValue<decltype(smsmpl)::Type,SmsmplVal::v32slck> v32slck{};
            constexpr Register::FieldValue<decltype(smsmpl)::Type,SmsmplVal::v256slck> v256slck{};
            constexpr Register::FieldValue<decltype(smsmpl)::Type,SmsmplVal::v2048slck> v2048slck{};
        }
        ///Supply Monitor Reset Enable
        enum class SmrstenVal {
            notEnable=0x00000000,     ///<the core reset signal "vddcore_nreset" is not affected when a supply monitor detection occurs.
            enable=0x00000001,     ///<the core reset signal, vddcore_nreset is asserted when a supply monitor detection occurs.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(12,12),Register::ReadWriteAccess,SmrstenVal> smrsten{};
        namespace SmrstenValC{
            constexpr Register::FieldValue<decltype(smrsten)::Type,SmrstenVal::notEnable> notEnable{};
            constexpr Register::FieldValue<decltype(smrsten)::Type,SmrstenVal::enable> enable{};
        }
        ///Supply Monitor Interrupt Enable
        enum class SmienVal {
            notEnable=0x00000000,     ///<the SUPC interrupt signal is not affected when a supply monitor detection occurs.
            enable=0x00000001,     ///<the SUPC interrupt signal is asserted when a supply monitor detection occurs.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,13),Register::ReadWriteAccess,SmienVal> smien{};
        namespace SmienValC{
            constexpr Register::FieldValue<decltype(smien)::Type,SmienVal::notEnable> notEnable{};
            constexpr Register::FieldValue<decltype(smien)::Type,SmienVal::enable> enable{};
        }
    }
    namespace SupcMr{    ///<Supply Controller Mode Register
        using Addr = Register::Address<0x400e1418,0x00ef8fff,0x00000000,unsigned>;
        ///Brownout Detector Reset Enable
        enum class BodrstenVal {
            notEnable=0x00000000,     ///<the core reset signal "vddcore_nreset" is not affected when a brownout detection occurs.
            enable=0x00000001,     ///<the core reset signal, vddcore_nreset is asserted when a brownout detection occurs.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(12,12),Register::ReadWriteAccess,BodrstenVal> bodrsten{};
        namespace BodrstenValC{
            constexpr Register::FieldValue<decltype(bodrsten)::Type,BodrstenVal::notEnable> notEnable{};
            constexpr Register::FieldValue<decltype(bodrsten)::Type,BodrstenVal::enable> enable{};
        }
        ///Brownout Detector Disable
        enum class BoddisVal {
            enable=0x00000000,     ///<the core brownout detector is enabled.
            disable=0x00000001,     ///<the core brownout detector is disabled.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,13),Register::ReadWriteAccess,BoddisVal> boddis{};
        namespace BoddisValC{
            constexpr Register::FieldValue<decltype(boddis)::Type,BoddisVal::enable> enable{};
            constexpr Register::FieldValue<decltype(boddis)::Type,BoddisVal::disable> disable{};
        }
        ///Voltage Regulator enable
        enum class OnregVal {
            onregUnused=0x00000000,     ///<Voltage Regulator is not used
            onregUsed=0x00000001,     ///<Voltage Regulator is used
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,14),Register::ReadWriteAccess,OnregVal> onreg{};
        namespace OnregValC{
            constexpr Register::FieldValue<decltype(onreg)::Type,OnregVal::onregUnused> onregUnused{};
            constexpr Register::FieldValue<decltype(onreg)::Type,OnregVal::onregUsed> onregUsed{};
        }
        ///Oscillator Bypass
        enum class OscbypassVal {
            noEffect=0x00000000,     ///<no effect. Clock selection depends on XTALSEL value.
            bypass=0x00000001,     ///<the 32-KHz XTAL oscillator is selected and is put in bypass mode.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,OscbypassVal> oscbypass{};
        namespace OscbypassValC{
            constexpr Register::FieldValue<decltype(oscbypass)::Type,OscbypassVal::noEffect> noEffect{};
            constexpr Register::FieldValue<decltype(oscbypass)::Type,OscbypassVal::bypass> bypass{};
        }
        ///Password Key
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,24),Register::ReadWriteAccess,unsigned> key{};
    }
    namespace SupcWumr{    ///<Supply Controller Wake Up Mode Register
        using Addr = Register::Address<0x400e141c,0xffff8ff1,0x00000000,unsigned>;
        ///Supply Monitor Wake Up Enable
        enum class SmenVal {
            notEnable=0x00000000,     ///<the supply monitor detection has no wake up effect.
            enable=0x00000001,     ///<the supply monitor detection forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,SmenVal> smen{};
        namespace SmenValC{
            constexpr Register::FieldValue<decltype(smen)::Type,SmenVal::notEnable> notEnable{};
            constexpr Register::FieldValue<decltype(smen)::Type,SmenVal::enable> enable{};
        }
        ///Real Time Timer Wake Up Enable
        enum class RttenVal {
            notEnable=0x00000000,     ///<the RTT alarm signal has no wake up effect.
            enable=0x00000001,     ///<the RTT alarm signal forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,RttenVal> rtten{};
        namespace RttenValC{
            constexpr Register::FieldValue<decltype(rtten)::Type,RttenVal::notEnable> notEnable{};
            constexpr Register::FieldValue<decltype(rtten)::Type,RttenVal::enable> enable{};
        }
        ///Real Time Clock Wake Up Enable
        enum class RtcenVal {
            notEnable=0x00000000,     ///<the RTC alarm signal has no wake up effect.
            enable=0x00000001,     ///<the RTC alarm signal forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,RtcenVal> rtcen{};
        namespace RtcenValC{
            constexpr Register::FieldValue<decltype(rtcen)::Type,RtcenVal::notEnable> notEnable{};
            constexpr Register::FieldValue<decltype(rtcen)::Type,RtcenVal::enable> enable{};
        }
        ///Wake Up Inputs Debouncer Period
        enum class WkupdbcVal {
            immediate=0x00000000,     ///<Immediate, no debouncing, detected active at least on one Slow Clock edge.
            v3Sclk=0x00000001,     ///<WKUPx shall be in its active state for at least 3 SLCK periods
            v32Sclk=0x00000002,     ///<WKUPx shall be in its active state for at least 32 SLCK periods
            v512Sclk=0x00000003,     ///<WKUPx shall be in its active state for at least 512 SLCK periods
            v4096Sclk=0x00000004,     ///<WKUPx shall be in its active state for at least 4,096 SLCK periods
            v32768Sclk=0x00000005,     ///<WKUPx shall be in its active state for at least 32,768 SLCK periods
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,12),Register::ReadWriteAccess,WkupdbcVal> wkupdbc{};
        namespace WkupdbcValC{
            constexpr Register::FieldValue<decltype(wkupdbc)::Type,WkupdbcVal::immediate> immediate{};
            constexpr Register::FieldValue<decltype(wkupdbc)::Type,WkupdbcVal::v3Sclk> v3Sclk{};
            constexpr Register::FieldValue<decltype(wkupdbc)::Type,WkupdbcVal::v32Sclk> v32Sclk{};
            constexpr Register::FieldValue<decltype(wkupdbc)::Type,WkupdbcVal::v512Sclk> v512Sclk{};
            constexpr Register::FieldValue<decltype(wkupdbc)::Type,WkupdbcVal::v4096Sclk> v4096Sclk{};
            constexpr Register::FieldValue<decltype(wkupdbc)::Type,WkupdbcVal::v32768Sclk> v32768Sclk{};
        }
    }
    namespace SupcWuir{    ///<Supply Controller Wake Up Inputs Register
        using Addr = Register::Address<0x400e1420,0x00000000,0x00000000,unsigned>;
        ///Wake Up Input Enable 0
        enum class Wkupen0Val {
            disable=0x00000000,     ///<the corresponding wake-up input has no wake up effect.
            enable=0x00000001,     ///<the corresponding wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(0,0),Register::ReadWriteAccess,Wkupen0Val> wkupen0{};
        namespace Wkupen0ValC{
            constexpr Register::FieldValue<decltype(wkupen0)::Type,Wkupen0Val::disable> disable{};
            constexpr Register::FieldValue<decltype(wkupen0)::Type,Wkupen0Val::enable> enable{};
        }
        ///Wake Up Input Enable 1
        enum class Wkupen1Val {
            disable=0x00000000,     ///<the corresponding wake-up input has no wake up effect.
            enable=0x00000001,     ///<the corresponding wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::ReadWriteAccess,Wkupen1Val> wkupen1{};
        namespace Wkupen1ValC{
            constexpr Register::FieldValue<decltype(wkupen1)::Type,Wkupen1Val::disable> disable{};
            constexpr Register::FieldValue<decltype(wkupen1)::Type,Wkupen1Val::enable> enable{};
        }
        ///Wake Up Input Enable 2
        enum class Wkupen2Val {
            disable=0x00000000,     ///<the corresponding wake-up input has no wake up effect.
            enable=0x00000001,     ///<the corresponding wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::ReadWriteAccess,Wkupen2Val> wkupen2{};
        namespace Wkupen2ValC{
            constexpr Register::FieldValue<decltype(wkupen2)::Type,Wkupen2Val::disable> disable{};
            constexpr Register::FieldValue<decltype(wkupen2)::Type,Wkupen2Val::enable> enable{};
        }
        ///Wake Up Input Enable 3
        enum class Wkupen3Val {
            disable=0x00000000,     ///<the corresponding wake-up input has no wake up effect.
            enable=0x00000001,     ///<the corresponding wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::ReadWriteAccess,Wkupen3Val> wkupen3{};
        namespace Wkupen3ValC{
            constexpr Register::FieldValue<decltype(wkupen3)::Type,Wkupen3Val::disable> disable{};
            constexpr Register::FieldValue<decltype(wkupen3)::Type,Wkupen3Val::enable> enable{};
        }
        ///Wake Up Input Enable 4
        enum class Wkupen4Val {
            disable=0x00000000,     ///<the corresponding wake-up input has no wake up effect.
            enable=0x00000001,     ///<the corresponding wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::ReadWriteAccess,Wkupen4Val> wkupen4{};
        namespace Wkupen4ValC{
            constexpr Register::FieldValue<decltype(wkupen4)::Type,Wkupen4Val::disable> disable{};
            constexpr Register::FieldValue<decltype(wkupen4)::Type,Wkupen4Val::enable> enable{};
        }
        ///Wake Up Input Enable 5
        enum class Wkupen5Val {
            disable=0x00000000,     ///<the corresponding wake-up input has no wake up effect.
            enable=0x00000001,     ///<the corresponding wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::ReadWriteAccess,Wkupen5Val> wkupen5{};
        namespace Wkupen5ValC{
            constexpr Register::FieldValue<decltype(wkupen5)::Type,Wkupen5Val::disable> disable{};
            constexpr Register::FieldValue<decltype(wkupen5)::Type,Wkupen5Val::enable> enable{};
        }
        ///Wake Up Input Enable 6
        enum class Wkupen6Val {
            disable=0x00000000,     ///<the corresponding wake-up input has no wake up effect.
            enable=0x00000001,     ///<the corresponding wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::ReadWriteAccess,Wkupen6Val> wkupen6{};
        namespace Wkupen6ValC{
            constexpr Register::FieldValue<decltype(wkupen6)::Type,Wkupen6Val::disable> disable{};
            constexpr Register::FieldValue<decltype(wkupen6)::Type,Wkupen6Val::enable> enable{};
        }
        ///Wake Up Input Enable 7
        enum class Wkupen7Val {
            disable=0x00000000,     ///<the corresponding wake-up input has no wake up effect.
            enable=0x00000001,     ///<the corresponding wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,7),Register::ReadWriteAccess,Wkupen7Val> wkupen7{};
        namespace Wkupen7ValC{
            constexpr Register::FieldValue<decltype(wkupen7)::Type,Wkupen7Val::disable> disable{};
            constexpr Register::FieldValue<decltype(wkupen7)::Type,Wkupen7Val::enable> enable{};
        }
        ///Wake Up Input Enable 8
        enum class Wkupen8Val {
            disable=0x00000000,     ///<the corresponding wake-up input has no wake up effect.
            enable=0x00000001,     ///<the corresponding wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(8,8),Register::ReadWriteAccess,Wkupen8Val> wkupen8{};
        namespace Wkupen8ValC{
            constexpr Register::FieldValue<decltype(wkupen8)::Type,Wkupen8Val::disable> disable{};
            constexpr Register::FieldValue<decltype(wkupen8)::Type,Wkupen8Val::enable> enable{};
        }
        ///Wake Up Input Enable 9
        enum class Wkupen9Val {
            disable=0x00000000,     ///<the corresponding wake-up input has no wake up effect.
            enable=0x00000001,     ///<the corresponding wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(9,9),Register::ReadWriteAccess,Wkupen9Val> wkupen9{};
        namespace Wkupen9ValC{
            constexpr Register::FieldValue<decltype(wkupen9)::Type,Wkupen9Val::disable> disable{};
            constexpr Register::FieldValue<decltype(wkupen9)::Type,Wkupen9Val::enable> enable{};
        }
        ///Wake Up Input Enable 10
        enum class Wkupen10Val {
            disable=0x00000000,     ///<the corresponding wake-up input has no wake up effect.
            enable=0x00000001,     ///<the corresponding wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(10,10),Register::ReadWriteAccess,Wkupen10Val> wkupen10{};
        namespace Wkupen10ValC{
            constexpr Register::FieldValue<decltype(wkupen10)::Type,Wkupen10Val::disable> disable{};
            constexpr Register::FieldValue<decltype(wkupen10)::Type,Wkupen10Val::enable> enable{};
        }
        ///Wake Up Input Enable 11
        enum class Wkupen11Val {
            disable=0x00000000,     ///<the corresponding wake-up input has no wake up effect.
            enable=0x00000001,     ///<the corresponding wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(11,11),Register::ReadWriteAccess,Wkupen11Val> wkupen11{};
        namespace Wkupen11ValC{
            constexpr Register::FieldValue<decltype(wkupen11)::Type,Wkupen11Val::disable> disable{};
            constexpr Register::FieldValue<decltype(wkupen11)::Type,Wkupen11Val::enable> enable{};
        }
        ///Wake Up Input Enable 12
        enum class Wkupen12Val {
            disable=0x00000000,     ///<the corresponding wake-up input has no wake up effect.
            enable=0x00000001,     ///<the corresponding wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(12,12),Register::ReadWriteAccess,Wkupen12Val> wkupen12{};
        namespace Wkupen12ValC{
            constexpr Register::FieldValue<decltype(wkupen12)::Type,Wkupen12Val::disable> disable{};
            constexpr Register::FieldValue<decltype(wkupen12)::Type,Wkupen12Val::enable> enable{};
        }
        ///Wake Up Input Enable 13
        enum class Wkupen13Val {
            disable=0x00000000,     ///<the corresponding wake-up input has no wake up effect.
            enable=0x00000001,     ///<the corresponding wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(13,13),Register::ReadWriteAccess,Wkupen13Val> wkupen13{};
        namespace Wkupen13ValC{
            constexpr Register::FieldValue<decltype(wkupen13)::Type,Wkupen13Val::disable> disable{};
            constexpr Register::FieldValue<decltype(wkupen13)::Type,Wkupen13Val::enable> enable{};
        }
        ///Wake Up Input Enable 14
        enum class Wkupen14Val {
            disable=0x00000000,     ///<the corresponding wake-up input has no wake up effect.
            enable=0x00000001,     ///<the corresponding wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(14,14),Register::ReadWriteAccess,Wkupen14Val> wkupen14{};
        namespace Wkupen14ValC{
            constexpr Register::FieldValue<decltype(wkupen14)::Type,Wkupen14Val::disable> disable{};
            constexpr Register::FieldValue<decltype(wkupen14)::Type,Wkupen14Val::enable> enable{};
        }
        ///Wake Up Input Enable 15
        enum class Wkupen15Val {
            disable=0x00000000,     ///<the corresponding wake-up input has no wake up effect.
            enable=0x00000001,     ///<the corresponding wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(15,15),Register::ReadWriteAccess,Wkupen15Val> wkupen15{};
        namespace Wkupen15ValC{
            constexpr Register::FieldValue<decltype(wkupen15)::Type,Wkupen15Val::disable> disable{};
            constexpr Register::FieldValue<decltype(wkupen15)::Type,Wkupen15Val::enable> enable{};
        }
        ///Wake Up Input Type 0
        enum class Wkupt0Val {
            highToLow=0x00000000,     ///<a high to low level transition for a period defined by WKUPDBC on the corresponding wake-up input forces the wake up of the core power supply.
            lowToHigh=0x00000001,     ///<a low to high level transition for a period defined by WKUPDBC on the correspond-ing wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,16),Register::ReadWriteAccess,Wkupt0Val> wkupt0{};
        namespace Wkupt0ValC{
            constexpr Register::FieldValue<decltype(wkupt0)::Type,Wkupt0Val::highToLow> highToLow{};
            constexpr Register::FieldValue<decltype(wkupt0)::Type,Wkupt0Val::lowToHigh> lowToHigh{};
        }
        ///Wake Up Input Type 1
        enum class Wkupt1Val {
            highToLow=0x00000000,     ///<a high to low level transition for a period defined by WKUPDBC on the corresponding wake-up input forces the wake up of the core power supply.
            lowToHigh=0x00000001,     ///<a low to high level transition for a period defined by WKUPDBC on the correspond-ing wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,17),Register::ReadWriteAccess,Wkupt1Val> wkupt1{};
        namespace Wkupt1ValC{
            constexpr Register::FieldValue<decltype(wkupt1)::Type,Wkupt1Val::highToLow> highToLow{};
            constexpr Register::FieldValue<decltype(wkupt1)::Type,Wkupt1Val::lowToHigh> lowToHigh{};
        }
        ///Wake Up Input Type 2
        enum class Wkupt2Val {
            highToLow=0x00000000,     ///<a high to low level transition for a period defined by WKUPDBC on the corresponding wake-up input forces the wake up of the core power supply.
            lowToHigh=0x00000001,     ///<a low to high level transition for a period defined by WKUPDBC on the correspond-ing wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(18,18),Register::ReadWriteAccess,Wkupt2Val> wkupt2{};
        namespace Wkupt2ValC{
            constexpr Register::FieldValue<decltype(wkupt2)::Type,Wkupt2Val::highToLow> highToLow{};
            constexpr Register::FieldValue<decltype(wkupt2)::Type,Wkupt2Val::lowToHigh> lowToHigh{};
        }
        ///Wake Up Input Type 3
        enum class Wkupt3Val {
            highToLow=0x00000000,     ///<a high to low level transition for a period defined by WKUPDBC on the corresponding wake-up input forces the wake up of the core power supply.
            lowToHigh=0x00000001,     ///<a low to high level transition for a period defined by WKUPDBC on the correspond-ing wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,19),Register::ReadWriteAccess,Wkupt3Val> wkupt3{};
        namespace Wkupt3ValC{
            constexpr Register::FieldValue<decltype(wkupt3)::Type,Wkupt3Val::highToLow> highToLow{};
            constexpr Register::FieldValue<decltype(wkupt3)::Type,Wkupt3Val::lowToHigh> lowToHigh{};
        }
        ///Wake Up Input Type 4
        enum class Wkupt4Val {
            highToLow=0x00000000,     ///<a high to low level transition for a period defined by WKUPDBC on the corresponding wake-up input forces the wake up of the core power supply.
            lowToHigh=0x00000001,     ///<a low to high level transition for a period defined by WKUPDBC on the correspond-ing wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::ReadWriteAccess,Wkupt4Val> wkupt4{};
        namespace Wkupt4ValC{
            constexpr Register::FieldValue<decltype(wkupt4)::Type,Wkupt4Val::highToLow> highToLow{};
            constexpr Register::FieldValue<decltype(wkupt4)::Type,Wkupt4Val::lowToHigh> lowToHigh{};
        }
        ///Wake Up Input Type 5
        enum class Wkupt5Val {
            highToLow=0x00000000,     ///<a high to low level transition for a period defined by WKUPDBC on the corresponding wake-up input forces the wake up of the core power supply.
            lowToHigh=0x00000001,     ///<a low to high level transition for a period defined by WKUPDBC on the correspond-ing wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,21),Register::ReadWriteAccess,Wkupt5Val> wkupt5{};
        namespace Wkupt5ValC{
            constexpr Register::FieldValue<decltype(wkupt5)::Type,Wkupt5Val::highToLow> highToLow{};
            constexpr Register::FieldValue<decltype(wkupt5)::Type,Wkupt5Val::lowToHigh> lowToHigh{};
        }
        ///Wake Up Input Type 6
        enum class Wkupt6Val {
            highToLow=0x00000000,     ///<a high to low level transition for a period defined by WKUPDBC on the corresponding wake-up input forces the wake up of the core power supply.
            lowToHigh=0x00000001,     ///<a low to high level transition for a period defined by WKUPDBC on the correspond-ing wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,22),Register::ReadWriteAccess,Wkupt6Val> wkupt6{};
        namespace Wkupt6ValC{
            constexpr Register::FieldValue<decltype(wkupt6)::Type,Wkupt6Val::highToLow> highToLow{};
            constexpr Register::FieldValue<decltype(wkupt6)::Type,Wkupt6Val::lowToHigh> lowToHigh{};
        }
        ///Wake Up Input Type 7
        enum class Wkupt7Val {
            highToLow=0x00000000,     ///<a high to low level transition for a period defined by WKUPDBC on the corresponding wake-up input forces the wake up of the core power supply.
            lowToHigh=0x00000001,     ///<a low to high level transition for a period defined by WKUPDBC on the correspond-ing wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,23),Register::ReadWriteAccess,Wkupt7Val> wkupt7{};
        namespace Wkupt7ValC{
            constexpr Register::FieldValue<decltype(wkupt7)::Type,Wkupt7Val::highToLow> highToLow{};
            constexpr Register::FieldValue<decltype(wkupt7)::Type,Wkupt7Val::lowToHigh> lowToHigh{};
        }
        ///Wake Up Input Type 8
        enum class Wkupt8Val {
            highToLow=0x00000000,     ///<a high to low level transition for a period defined by WKUPDBC on the corresponding wake-up input forces the wake up of the core power supply.
            lowToHigh=0x00000001,     ///<a low to high level transition for a period defined by WKUPDBC on the correspond-ing wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::ReadWriteAccess,Wkupt8Val> wkupt8{};
        namespace Wkupt8ValC{
            constexpr Register::FieldValue<decltype(wkupt8)::Type,Wkupt8Val::highToLow> highToLow{};
            constexpr Register::FieldValue<decltype(wkupt8)::Type,Wkupt8Val::lowToHigh> lowToHigh{};
        }
        ///Wake Up Input Type 9
        enum class Wkupt9Val {
            highToLow=0x00000000,     ///<a high to low level transition for a period defined by WKUPDBC on the corresponding wake-up input forces the wake up of the core power supply.
            lowToHigh=0x00000001,     ///<a low to high level transition for a period defined by WKUPDBC on the correspond-ing wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,25),Register::ReadWriteAccess,Wkupt9Val> wkupt9{};
        namespace Wkupt9ValC{
            constexpr Register::FieldValue<decltype(wkupt9)::Type,Wkupt9Val::highToLow> highToLow{};
            constexpr Register::FieldValue<decltype(wkupt9)::Type,Wkupt9Val::lowToHigh> lowToHigh{};
        }
        ///Wake Up Input Type 10
        enum class Wkupt10Val {
            highToLow=0x00000000,     ///<a high to low level transition for a period defined by WKUPDBC on the corresponding wake-up input forces the wake up of the core power supply.
            lowToHigh=0x00000001,     ///<a low to high level transition for a period defined by WKUPDBC on the correspond-ing wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(26,26),Register::ReadWriteAccess,Wkupt10Val> wkupt10{};
        namespace Wkupt10ValC{
            constexpr Register::FieldValue<decltype(wkupt10)::Type,Wkupt10Val::highToLow> highToLow{};
            constexpr Register::FieldValue<decltype(wkupt10)::Type,Wkupt10Val::lowToHigh> lowToHigh{};
        }
        ///Wake Up Input Type 11
        enum class Wkupt11Val {
            highToLow=0x00000000,     ///<a high to low level transition for a period defined by WKUPDBC on the corresponding wake-up input forces the wake up of the core power supply.
            lowToHigh=0x00000001,     ///<a low to high level transition for a period defined by WKUPDBC on the correspond-ing wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(27,27),Register::ReadWriteAccess,Wkupt11Val> wkupt11{};
        namespace Wkupt11ValC{
            constexpr Register::FieldValue<decltype(wkupt11)::Type,Wkupt11Val::highToLow> highToLow{};
            constexpr Register::FieldValue<decltype(wkupt11)::Type,Wkupt11Val::lowToHigh> lowToHigh{};
        }
        ///Wake Up Input Type 12
        enum class Wkupt12Val {
            highToLow=0x00000000,     ///<a high to low level transition for a period defined by WKUPDBC on the corresponding wake-up input forces the wake up of the core power supply.
            lowToHigh=0x00000001,     ///<a low to high level transition for a period defined by WKUPDBC on the correspond-ing wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(28,28),Register::ReadWriteAccess,Wkupt12Val> wkupt12{};
        namespace Wkupt12ValC{
            constexpr Register::FieldValue<decltype(wkupt12)::Type,Wkupt12Val::highToLow> highToLow{};
            constexpr Register::FieldValue<decltype(wkupt12)::Type,Wkupt12Val::lowToHigh> lowToHigh{};
        }
        ///Wake Up Input Type 13
        enum class Wkupt13Val {
            highToLow=0x00000000,     ///<a high to low level transition for a period defined by WKUPDBC on the corresponding wake-up input forces the wake up of the core power supply.
            lowToHigh=0x00000001,     ///<a low to high level transition for a period defined by WKUPDBC on the correspond-ing wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,29),Register::ReadWriteAccess,Wkupt13Val> wkupt13{};
        namespace Wkupt13ValC{
            constexpr Register::FieldValue<decltype(wkupt13)::Type,Wkupt13Val::highToLow> highToLow{};
            constexpr Register::FieldValue<decltype(wkupt13)::Type,Wkupt13Val::lowToHigh> lowToHigh{};
        }
        ///Wake Up Input Type 14
        enum class Wkupt14Val {
            highToLow=0x00000000,     ///<a high to low level transition for a period defined by WKUPDBC on the corresponding wake-up input forces the wake up of the core power supply.
            lowToHigh=0x00000001,     ///<a low to high level transition for a period defined by WKUPDBC on the correspond-ing wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,30),Register::ReadWriteAccess,Wkupt14Val> wkupt14{};
        namespace Wkupt14ValC{
            constexpr Register::FieldValue<decltype(wkupt14)::Type,Wkupt14Val::highToLow> highToLow{};
            constexpr Register::FieldValue<decltype(wkupt14)::Type,Wkupt14Val::lowToHigh> lowToHigh{};
        }
        ///Wake Up Input Type 15
        enum class Wkupt15Val {
            highToLow=0x00000000,     ///<a high to low level transition for a period defined by WKUPDBC on the corresponding wake-up input forces the wake up of the core power supply.
            lowToHigh=0x00000001,     ///<a low to high level transition for a period defined by WKUPDBC on the correspond-ing wake-up input forces the wake up of the core power supply.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::ReadWriteAccess,Wkupt15Val> wkupt15{};
        namespace Wkupt15ValC{
            constexpr Register::FieldValue<decltype(wkupt15)::Type,Wkupt15Val::highToLow> highToLow{};
            constexpr Register::FieldValue<decltype(wkupt15)::Type,Wkupt15Val::lowToHigh> lowToHigh{};
        }
    }
    namespace SupcSr{    ///<Supply Controller Status Register
        using Addr = Register::Address<0x400e1424,0x0000ff01,0x00000000,unsigned>;
        ///WKUP Wake Up Status
        enum class WkupsVal {
            no=0x00000000,     ///<no wake up due to the assertion of the WKUP pins has occurred since the last read of SUPC_SR.
            present=0x00000001,     ///<at least one wake up due to the assertion of the WKUP pins has occurred since the last read of SUPC_SR.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(1,1),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,WkupsVal> wkups{};
        namespace WkupsValC{
            constexpr Register::FieldValue<decltype(wkups)::Type,WkupsVal::no> no{};
            constexpr Register::FieldValue<decltype(wkups)::Type,WkupsVal::present> present{};
        }
        ///Supply Monitor Detection Wake Up Status
        enum class SmwsVal {
            no=0x00000000,     ///<no wake up due to a supply monitor detection has occurred since the last read of SUPC_SR.
            present=0x00000001,     ///<at least one wake up due to a supply monitor detection has occurred since the last read of SUPC_SR.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(2,2),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,SmwsVal> smws{};
        namespace SmwsValC{
            constexpr Register::FieldValue<decltype(smws)::Type,SmwsVal::no> no{};
            constexpr Register::FieldValue<decltype(smws)::Type,SmwsVal::present> present{};
        }
        ///Brownout Detector Reset Status
        enum class BodrstsVal {
            no=0x00000000,     ///<no core brownout rising edge event has been detected since the last read of the SUPC_SR.
            present=0x00000001,     ///<at least one brownout output rising edge event has been detected since the last read of the SUPC_SR.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(3,3),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,BodrstsVal> bodrsts{};
        namespace BodrstsValC{
            constexpr Register::FieldValue<decltype(bodrsts)::Type,BodrstsVal::no> no{};
            constexpr Register::FieldValue<decltype(bodrsts)::Type,BodrstsVal::present> present{};
        }
        ///Supply Monitor Reset Status
        enum class SmrstsVal {
            no=0x00000000,     ///<no supply monitor detection has generated a core reset since the last read of the SUPC_SR.
            present=0x00000001,     ///<at least one supply monitor detection has generated a core reset since the last read of the SUPC_SR.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(4,4),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,SmrstsVal> smrsts{};
        namespace SmrstsValC{
            constexpr Register::FieldValue<decltype(smrsts)::Type,SmrstsVal::no> no{};
            constexpr Register::FieldValue<decltype(smrsts)::Type,SmrstsVal::present> present{};
        }
        ///Supply Monitor Status
        enum class SmsVal {
            no=0x00000000,     ///<no supply monitor detection since the last read of SUPC_SR.
            present=0x00000001,     ///<at least one supply monitor detection since the last read of SUPC_SR.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(5,5),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,SmsVal> sms{};
        namespace SmsValC{
            constexpr Register::FieldValue<decltype(sms)::Type,SmsVal::no> no{};
            constexpr Register::FieldValue<decltype(sms)::Type,SmsVal::present> present{};
        }
        ///Supply Monitor Output Status
        enum class SmosVal {
            high=0x00000000,     ///<the supply monitor detected VDDIO higher than its threshold at its last measurement.
            low=0x00000001,     ///<the supply monitor detected VDDIO lower than its threshold at its last measurement.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(6,6),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,SmosVal> smos{};
        namespace SmosValC{
            constexpr Register::FieldValue<decltype(smos)::Type,SmosVal::high> high{};
            constexpr Register::FieldValue<decltype(smos)::Type,SmosVal::low> low{};
        }
        ///32-kHz Oscillator Selection Status
        enum class OscselVal {
            rc=0x00000000,     ///<the slow clock, SLCK is generated by the embedded 32-kHz RC oscillator.
            cryst=0x00000001,     ///<the slow clock, SLCK is generated by the 32-kHz crystal oscillator.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(7,7),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,OscselVal> oscsel{};
        namespace OscselValC{
            constexpr Register::FieldValue<decltype(oscsel)::Type,OscselVal::rc> rc{};
            constexpr Register::FieldValue<decltype(oscsel)::Type,OscselVal::cryst> cryst{};
        }
        ///WKUP Input Status 0
        enum class Wkupis0Val {
            dis=0x00000000,     ///<the corresponding wake-up input is disabled, or was inactive at the time the debouncer triggered a wake up event.
            en=0x00000001,     ///<the corresponding wake-up input was active at the time the debouncer triggered a wake up event.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(16,16),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,Wkupis0Val> wkupis0{};
        namespace Wkupis0ValC{
            constexpr Register::FieldValue<decltype(wkupis0)::Type,Wkupis0Val::dis> dis{};
            constexpr Register::FieldValue<decltype(wkupis0)::Type,Wkupis0Val::en> en{};
        }
        ///WKUP Input Status 1
        enum class Wkupis1Val {
            dis=0x00000000,     ///<the corresponding wake-up input is disabled, or was inactive at the time the debouncer triggered a wake up event.
            en=0x00000001,     ///<the corresponding wake-up input was active at the time the debouncer triggered a wake up event.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(17,17),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,Wkupis1Val> wkupis1{};
        namespace Wkupis1ValC{
            constexpr Register::FieldValue<decltype(wkupis1)::Type,Wkupis1Val::dis> dis{};
            constexpr Register::FieldValue<decltype(wkupis1)::Type,Wkupis1Val::en> en{};
        }
        ///WKUP Input Status 2
        enum class Wkupis2Val {
            dis=0x00000000,     ///<the corresponding wake-up input is disabled, or was inactive at the time the debouncer triggered a wake up event.
            en=0x00000001,     ///<the corresponding wake-up input was active at the time the debouncer triggered a wake up event.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(18,18),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,Wkupis2Val> wkupis2{};
        namespace Wkupis2ValC{
            constexpr Register::FieldValue<decltype(wkupis2)::Type,Wkupis2Val::dis> dis{};
            constexpr Register::FieldValue<decltype(wkupis2)::Type,Wkupis2Val::en> en{};
        }
        ///WKUP Input Status 3
        enum class Wkupis3Val {
            dis=0x00000000,     ///<the corresponding wake-up input is disabled, or was inactive at the time the debouncer triggered a wake up event.
            en=0x00000001,     ///<the corresponding wake-up input was active at the time the debouncer triggered a wake up event.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(19,19),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,Wkupis3Val> wkupis3{};
        namespace Wkupis3ValC{
            constexpr Register::FieldValue<decltype(wkupis3)::Type,Wkupis3Val::dis> dis{};
            constexpr Register::FieldValue<decltype(wkupis3)::Type,Wkupis3Val::en> en{};
        }
        ///WKUP Input Status 4
        enum class Wkupis4Val {
            dis=0x00000000,     ///<the corresponding wake-up input is disabled, or was inactive at the time the debouncer triggered a wake up event.
            en=0x00000001,     ///<the corresponding wake-up input was active at the time the debouncer triggered a wake up event.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(20,20),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,Wkupis4Val> wkupis4{};
        namespace Wkupis4ValC{
            constexpr Register::FieldValue<decltype(wkupis4)::Type,Wkupis4Val::dis> dis{};
            constexpr Register::FieldValue<decltype(wkupis4)::Type,Wkupis4Val::en> en{};
        }
        ///WKUP Input Status 5
        enum class Wkupis5Val {
            dis=0x00000000,     ///<the corresponding wake-up input is disabled, or was inactive at the time the debouncer triggered a wake up event.
            en=0x00000001,     ///<the corresponding wake-up input was active at the time the debouncer triggered a wake up event.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(21,21),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,Wkupis5Val> wkupis5{};
        namespace Wkupis5ValC{
            constexpr Register::FieldValue<decltype(wkupis5)::Type,Wkupis5Val::dis> dis{};
            constexpr Register::FieldValue<decltype(wkupis5)::Type,Wkupis5Val::en> en{};
        }
        ///WKUP Input Status 6
        enum class Wkupis6Val {
            dis=0x00000000,     ///<the corresponding wake-up input is disabled, or was inactive at the time the debouncer triggered a wake up event.
            en=0x00000001,     ///<the corresponding wake-up input was active at the time the debouncer triggered a wake up event.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(22,22),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,Wkupis6Val> wkupis6{};
        namespace Wkupis6ValC{
            constexpr Register::FieldValue<decltype(wkupis6)::Type,Wkupis6Val::dis> dis{};
            constexpr Register::FieldValue<decltype(wkupis6)::Type,Wkupis6Val::en> en{};
        }
        ///WKUP Input Status 7
        enum class Wkupis7Val {
            dis=0x00000000,     ///<the corresponding wake-up input is disabled, or was inactive at the time the debouncer triggered a wake up event.
            en=0x00000001,     ///<the corresponding wake-up input was active at the time the debouncer triggered a wake up event.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(23,23),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,Wkupis7Val> wkupis7{};
        namespace Wkupis7ValC{
            constexpr Register::FieldValue<decltype(wkupis7)::Type,Wkupis7Val::dis> dis{};
            constexpr Register::FieldValue<decltype(wkupis7)::Type,Wkupis7Val::en> en{};
        }
        ///WKUP Input Status 8
        enum class Wkupis8Val {
            dis=0x00000000,     ///<the corresponding wake-up input is disabled, or was inactive at the time the debouncer triggered a wake up event.
            en=0x00000001,     ///<the corresponding wake-up input was active at the time the debouncer triggered a wake up event.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(24,24),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,Wkupis8Val> wkupis8{};
        namespace Wkupis8ValC{
            constexpr Register::FieldValue<decltype(wkupis8)::Type,Wkupis8Val::dis> dis{};
            constexpr Register::FieldValue<decltype(wkupis8)::Type,Wkupis8Val::en> en{};
        }
        ///WKUP Input Status 9
        enum class Wkupis9Val {
            dis=0x00000000,     ///<the corresponding wake-up input is disabled, or was inactive at the time the debouncer triggered a wake up event.
            en=0x00000001,     ///<the corresponding wake-up input was active at the time the debouncer triggered a wake up event.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(25,25),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,Wkupis9Val> wkupis9{};
        namespace Wkupis9ValC{
            constexpr Register::FieldValue<decltype(wkupis9)::Type,Wkupis9Val::dis> dis{};
            constexpr Register::FieldValue<decltype(wkupis9)::Type,Wkupis9Val::en> en{};
        }
        ///WKUP Input Status 10
        enum class Wkupis10Val {
            dis=0x00000000,     ///<the corresponding wake-up input is disabled, or was inactive at the time the debouncer triggered a wake up event.
            en=0x00000001,     ///<the corresponding wake-up input was active at the time the debouncer triggered a wake up event.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(26,26),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,Wkupis10Val> wkupis10{};
        namespace Wkupis10ValC{
            constexpr Register::FieldValue<decltype(wkupis10)::Type,Wkupis10Val::dis> dis{};
            constexpr Register::FieldValue<decltype(wkupis10)::Type,Wkupis10Val::en> en{};
        }
        ///WKUP Input Status 11
        enum class Wkupis11Val {
            dis=0x00000000,     ///<the corresponding wake-up input is disabled, or was inactive at the time the debouncer triggered a wake up event.
            en=0x00000001,     ///<the corresponding wake-up input was active at the time the debouncer triggered a wake up event.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(27,27),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,Wkupis11Val> wkupis11{};
        namespace Wkupis11ValC{
            constexpr Register::FieldValue<decltype(wkupis11)::Type,Wkupis11Val::dis> dis{};
            constexpr Register::FieldValue<decltype(wkupis11)::Type,Wkupis11Val::en> en{};
        }
        ///WKUP Input Status 12
        enum class Wkupis12Val {
            dis=0x00000000,     ///<the corresponding wake-up input is disabled, or was inactive at the time the debouncer triggered a wake up event.
            en=0x00000001,     ///<the corresponding wake-up input was active at the time the debouncer triggered a wake up event.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(28,28),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,Wkupis12Val> wkupis12{};
        namespace Wkupis12ValC{
            constexpr Register::FieldValue<decltype(wkupis12)::Type,Wkupis12Val::dis> dis{};
            constexpr Register::FieldValue<decltype(wkupis12)::Type,Wkupis12Val::en> en{};
        }
        ///WKUP Input Status 13
        enum class Wkupis13Val {
            dis=0x00000000,     ///<the corresponding wake-up input is disabled, or was inactive at the time the debouncer triggered a wake up event.
            en=0x00000001,     ///<the corresponding wake-up input was active at the time the debouncer triggered a wake up event.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(29,29),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,Wkupis13Val> wkupis13{};
        namespace Wkupis13ValC{
            constexpr Register::FieldValue<decltype(wkupis13)::Type,Wkupis13Val::dis> dis{};
            constexpr Register::FieldValue<decltype(wkupis13)::Type,Wkupis13Val::en> en{};
        }
        ///WKUP Input Status 14
        enum class Wkupis14Val {
            dis=0x00000000,     ///<the corresponding wake-up input is disabled, or was inactive at the time the debouncer triggered a wake up event.
            en=0x00000001,     ///<the corresponding wake-up input was active at the time the debouncer triggered a wake up event.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(30,30),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,Wkupis14Val> wkupis14{};
        namespace Wkupis14ValC{
            constexpr Register::FieldValue<decltype(wkupis14)::Type,Wkupis14Val::dis> dis{};
            constexpr Register::FieldValue<decltype(wkupis14)::Type,Wkupis14Val::en> en{};
        }
        ///WKUP Input Status 15
        enum class Wkupis15Val {
            dis=0x00000000,     ///<the corresponding wake-up input is disabled, or was inactive at the time the debouncer triggered a wake up event.
            en=0x00000001,     ///<the corresponding wake-up input was active at the time the debouncer triggered a wake up event.
        };
        constexpr Register::FieldLocation<Addr,Register::maskFromRange(31,31),Register::Access<Register::AccessType::readOnly,Register::ReadActionType::normal,Register::ModifiedWriteValueType::normal>,Wkupis15Val> wkupis15{};
        namespace Wkupis15ValC{
            constexpr Register::FieldValue<decltype(wkupis15)::Type,Wkupis15Val::dis> dis{};
            constexpr Register::FieldValue<decltype(wkupis15)::Type,Wkupis15Val::en> en{};
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _08_Upgraded_Matcher
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] names = Console.ReadLine().Split();
            long[] quantity = Console.ReadLine().Split().Select(long.Parse).ToArray();
            decimal[] price = Console.ReadLine().Split().Select(decimal.Parse).ToArray();

            string[] inputName = Console.ReadLine().Split();

            while (inputName[0] != "done")
            {
                long qtityToOrder = long.Parse(inputName[1]);

                for (int cycle = 0; cycle < names.Length; cycle++)
                {
                    if (inputName[0] == names[cycle])
                    {
                        if (cycle < quantity.Length && quantity[cycle] >= qtityToOrder)
                        {
                            Console.WriteLine($"{names[cycle]} x {qtityToOrder} costs {qtityToOrder * price[cycle]:f2}");
                            quantity[cycle] -= qtityToOrder;
                        }
                        else
                        {
                            Console.WriteLine($"We do not have enough {names[cycle]}");
                        }
                    }
                }

                inputName = Console.ReadLine().Split();
            }
        }
    }
}


text:
#import "UIImage+UIPrivate.h"
#import "UIImageAppKitIntegration.h"
#import "UIColor.h"
#import "UIGraphics.h"
#import "UIImageRep.h"
#import <AppKit/NSImage.h>

NSMutableDictionary *imageCache = nil;

@implementation UIImage (UIPrivate)

+ (void)load
{
    imageCache = [[NSMutableDictionary alloc] init];
}

+ (void)_cacheImage:(UIImage *)image forName:(NSString *)name
{
    if (image && name) {
        [imageCache setObject:image forKey:name];
    }
}

+ (UIImage *)_cachedImageForName:(NSString *)name
{
    return [imageCache objectForKey:name];
}

+ (UIImage *)_frameworkImageWithName:(NSString *)name leftCapWidth:(NSUInteger)leftCapWidth topCapHeight:(NSUInteger)topCapHeight
{
    UIImage *image = [self _cachedImageForName:name];

    if (!image) {
        NSBundle *frameworkBundle = [NSBundle bundleWithIdentifier:@"org.chameleonproject.UIKit"];
        NSString *frameworkFile = [[frameworkBundle resourcePath] stringByAppendingPathComponent:name];
        image = [[self imageWithContentsOfFile:frameworkFile] stretchableImageWithLeftCapWidth:leftCapWidth topCapHeight:topCapHeight];
        [self _cacheImage:image forName:name];
    }

    return image;
}

+ (UIImage *)_backButtonImage
{
    return [self _frameworkImageWithName:@"<UINavigationBar> back.png" leftCapWidth:18 topCapHeight:0];
}

+ (UIImage *)_highlightedBackButtonImage
{
    return [self _frameworkImageWithName:@"<UINavigationBar> back-highlighted.png" leftCapWidth:18 topCapHeight:0];
}

+ (UIImage *)_toolbarButtonImage
{
    return [self _frameworkImageWithName:@"<UIToolbar> button.png" leftCapWidth:6 topCapHeight:0];
}

+ (UIImage *)_highlightedToolbarButtonImage
{
    return [self _frameworkImageWithName:@"<UIToolbar> button-highlighted.png" leftCapWidth:6 topCapHeight:0];
}

+ (UIImage *)_leftPopoverArrowImage
{
    return [self _frameworkImageWithName:@"<UIPopoverView> arrow-left.png" leftCapWidth:0 topCapHeight:0];
}

+ (UIImage *)_rightPopoverArrowImage
{
    return [self _frameworkImageWithName:@"<UIPopoverView> arrow-right.png" leftCapWidth:0 topCapHeight:0];
}

+ (UIImage *)_topPopoverArrowImage
{
    return [self _frameworkImageWithName:@"<UIPopoverView> arrow-top.png" leftCapWidth:0 topCapHeight:0];
}

+ (UIImage *)_bottomPopoverArrowImage
{
    return [self _frameworkImageWithName:@"<UIPopoverView> arrow-bottom.png" leftCapWidth:0 topCapHeight:0];
}

+ (UIImage *)_popoverBackgroundImage
{
    return [self _frameworkImageWithName:@"<UIPopoverView> background.png" leftCapWidth:23 topCapHeight:23];
}

+ (UIImage *)_roundedRectButtonImage
{
    return [self _frameworkImageWithName:@"<UIRoundedRectButton> normal.png" leftCapWidth:12 topCapHeight:9];
}

+ (UIImage *)_highlightedRoundedRectButtonImage
{
    return [self _frameworkImageWithName:@"<UIRoundedRectButton> highlighted.png" leftCapWidth:12 topCapHeight:9];
}

+ (UIImage *)_windowResizeGrabberImage
{
    return [self _frameworkImageWithName:@"<UIScreen> grabber.png" leftCapWidth:0 topCapHeight:0];
}

+ (UIImage *)_buttonBarSystemItemAdd
{
    return [self _frameworkImageWithName:@"<UIBarButtonSystemItem> add.png" leftCapWidth:0 topCapHeight:0];
}

+ (UIImage *)_buttonBarSystemItemReply
{
    return [self _frameworkImageWithName:@"<UIBarButtonSystemItem> reply.png" leftCapWidth:0 topCapHeight:0];
}

+ (UIImage *)_tabBarBackgroundImage
{
  return [self _frameworkImageWithName:@"<UITabBar> background.png" leftCapWidth:6 topCapHeight:0];
}

+ (UIImage *)_tabBarItemImage
{
  return [self _frameworkImageWithName:@"<UITabBar> item.png" leftCapWidth:8 topCapHeight:0];
}

- (id)_initWithRepresentations:(NSArray *)reps
{
    if ([reps count] == 0) {
        self = nil;
    } else if ((self=[super init])) {
        _representations = [reps copy];
    }

    return self;
}

- (NSArray *)_representations
{
    return _representations;
}

- (UIImageRep *)_bestRepresentationForProposedScale:(CGFloat)scale
{
    UIImageRep *bestRep = nil;

    for (UIImageRep *rep in [self _representations]) {
        if (rep.scale > scale) {
            break;
        } else {
            bestRep = rep;
        }
    }

    return bestRep ?: [[self _representations] lastObject];
}

- (BOOL)_isOpaque
{
    for (UIImageRep *rep in [self _representations]) {
        if (!rep.opaque) {
            return NO;
        }
    }
    return YES;
}

- (void)_drawRepresentation:(UIImageRep *)rep inRect:(CGRect)rect
{
    [rep drawInRect:rect fromRect:CGRectNull];
}

- (UIImage *)_toolbarImage
{
    // NOTE.. I don't know where to put this, really, but it seems like the real UIKit reduces image size by 75% if they are too
    // big for a toolbar. That seems funky, but I guess here is as good a place as any to do that? I don't really know...

    CGSize imageSize = self.size;
    CGSize size = CGSizeZero;

    if (imageSize.width > 24 || imageSize.height > 24) {
        size.height = imageSize.height * 0.75f;
        size.width = imageSize.width / imageSize.height * size.height;
    } else {
        size = imageSize;
    }

    CGRect rect = CGRectMake(0,0,size.width,size.height);

    UIGraphicsBeginImageContextWithOptions(size, NO, self.scale);
    [[UIColor colorWithRed:101/255.f green:104/255.f blue:121/255.f alpha:1] setFill];
    UIRectFill(rect);
    [self drawInRect:rect blendMode:kCGBlendModeDestinationIn alpha:1];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();

    return image;
}

@end


text:
#include "stdafx.h"
#include "RedirectorAccess.h"
#include "Public.h"

TransferResult UsbDkRedirectorAccess::TransactPipe(USB_DK_TRANSFER_REQUEST &Request,
                                                   DWORD OpCode,
                                                   LPOVERLAPPED Overlapped)
{
    static DWORD BytesTransferredDummy;

    auto res = Ioctl(OpCode, false,
                     &Request, sizeof(Request),
                     &Request.Result.GenResult, sizeof(Request.Result.GenResult),
                     &BytesTransferredDummy, Overlapped);

    return res;
}

TransferResult UsbDkRedirectorAccess::ReadPipe(USB_DK_TRANSFER_REQUEST &Request,
                                               LPOVERLAPPED Overlapped)
{
    return TransactPipe(Request, IOCTL_USBDK_DEVICE_READ_PIPE, Overlapped);
}

TransferResult UsbDkRedirectorAccess::WritePipe(USB_DK_TRANSFER_REQUEST &Request,
                                                LPOVERLAPPED Overlapped)
{
    return TransactPipe(Request, IOCTL_USBDK_DEVICE_WRITE_PIPE, Overlapped);
}

void UsbDkRedirectorAccess::AbortPipe(ULONG64 PipeAddress)
{
    IoctlSync(IOCTL_USBDK_DEVICE_ABORT_PIPE, false, &PipeAddress, sizeof(PipeAddress));
}

void UsbDkRedirectorAccess::ResetPipe(ULONG64 PipeAddress)
{
    IoctlSync(IOCTL_USBDK_DEVICE_RESET_PIPE, false, &PipeAddress, sizeof(PipeAddress));
}

void UsbDkRedirectorAccess::SetAltsetting(ULONG64 InterfaceIdx, ULONG64 AltSettingIdx)
{
    USBDK_ALTSETTINGS_IDXS AltSetting;
    AltSetting.InterfaceIdx = InterfaceIdx;
    AltSetting.AltSettingIdx = AltSettingIdx;

    IoctlSync(IOCTL_USBDK_DEVICE_SET_ALTSETTING, false, &AltSetting, sizeof(AltSetting));
}

void UsbDkRedirectorAccess::ResetDevice()
{
    IoctlSync(IOCTL_USBDK_DEVICE_RESET_DEVICE);
}

bool UsbDkRedirectorAccess::IoctlSync(DWORD Code,
                                      bool ShortBufferOk,
                                      LPVOID InBuffer,
                                      DWORD InBufferSize,
                                      LPVOID OutBuffer,
                                      DWORD OutBufferSize,
                                      LPDWORD BytesReturned)
{
    UsbDkHandleHolder<HANDLE> Event(CreateEvent(nullptr, FALSE, FALSE, nullptr));
    if (!Event)
    {
        throw UsbDkDriverFileException(TEXT("CreateEvent failed"));
    }

    OVERLAPPED Overlapped;
    Overlapped.hEvent = Event;
    auto res = Ioctl(Code, ShortBufferOk, InBuffer, InBufferSize, OutBuffer, OutBufferSize, BytesReturned, &Overlapped);

    switch (res)
    {
    case TransferSuccessAsync:
        DWORD NumberOfBytesTransferred;
        if (!GetOverlappedResult(m_hDriver, &Overlapped, &NumberOfBytesTransferred, TRUE))
        {
            throw UsbDkDriverFileException(TEXT("GetOverlappedResult failed"));
        }
        return true;
    case TransferSuccess:
        return true;
    case TransferFailure:
        return false;
    }

    return false;
}


text:
'use strict';

/**
 * Module dependencies.
 */
var mongoose = require('mongoose'),
    Schema = mongoose.Schema;

var ResumeSchema = new Schema({
    created: {
        type: Date,
        default: Date.now
    },
    name: {
        type: String,
        required: 'Please fill in a name'
    },
    resumeURL: {
        type: Array,
        default: ''
    }
});

mongoose.model('Resume', ResumeSchema);


text:
package net.ibogner.kinesis;

import com.amazonaws.ClientConfiguration;
import com.amazonaws.Request;
import com.amazonaws.Response;
import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.auth.AWSCredentialsProviderChain;
import com.amazonaws.auth.InstanceProfileCredentialsProvider;
import com.amazonaws.auth.profile.ProfileCredentialsProvider;
import com.amazonaws.metrics.AwsSdkMetrics;
import com.amazonaws.metrics.RequestMetricCollector;
import com.amazonaws.regions.Region;
import com.amazonaws.regions.Regions;
import com.amazonaws.services.kinesis.AmazonKinesisClient;
import com.amazonaws.services.kinesis.clientlibrary.lib.worker.KinesisClientLibConfiguration;
import com.amazonaws.services.kinesis.clientlibrary.lib.worker.Worker;
import com.amazonaws.services.kinesis.model.PutRecordsRequest;
import com.amazonaws.services.kinesis.model.PutRecordsRequestEntry;
import com.google.common.base.Charsets;
import com.google.common.base.Strings;
import com.google.common.util.concurrent.MoreExecutors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.nio.ByteBuffer;
import java.util.Optional;
import java.util.Random;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;

public class KinesisStressExample {

    private static final Logger logger = LoggerFactory.getLogger(KinesisStressExample.class);

    private volatile boolean keepGoing = true;

    private final String streamName;
    private final String regionName;
    private final Integer numThreads;
    private final Integer numRecordsPerPut;
    private final Long numMessagesToProduce;

    private final AWSCredentialsProvider awsCredentialsProvider;
    private final Random random = new Random();
    private final AtomicLong msgsProduced = new AtomicLong(0);
    private final ExecutorService threadPool;
    private final AmazonKinesisClient kinesisClient;

    private Worker worker;

    public KinesisStressExample(String streamName, String regionName, Integer numThreads, Integer numRecordsPerPut, Long numMessagesToProduce, String credentialsProfileName) {
        this.streamName = streamName;
        this.regionName = regionName;
        this.numThreads = numThreads;
        this.numRecordsPerPut = numRecordsPerPut;
        this.numMessagesToProduce = numMessagesToProduce;

        final ClientConfiguration clientConfiguration = new ClientConfiguration();
        awsCredentialsProvider = getCredentialsProvider(credentialsProfileName);

        kinesisClient = new AmazonKinesisClient(awsCredentialsProvider, clientConfiguration, new RequestMetricCollector() {
            @Override
            public void collectMetrics(Request<?> request, Response<?> response) {

            }
        });
        kinesisClient.setRegion(Region.getRegion(Regions.fromName(regionName)));
        AwsSdkMetrics.enableDefaultMetrics();
        threadPool = Executors.newFixedThreadPool(numThreads);
    }

    public void startProducers() {
        for (int threadNum = 0; threadNum < numThreads; ++threadNum) {
            threadPool.submit((Runnable) () -> produce());
        }
    }

    public void startConsumers() {
        final String kclWorkerId = UUID.randomUUID().toString();
        worker = new Worker.Builder()
                .recordProcessorFactory(new RecordProcessorFactory())
                .config(new KinesisClientLibConfiguration(streamName + "kcl-shutdown-example",
                                                          streamName,
                                                          awsCredentialsProvider,
                                                          kclWorkerId)
                                .withRegionName(regionName))
                .build();
        new Thread(worker).start();
    }

    public void awaitCompletion() throws InterruptedException {
        while (msgsProduced.get() < numMessagesToProduce) {
            Thread.sleep(1000);
        }
        worker.shutdown();
        logger.info("Done shutting down worker");

        keepGoing = false;
        logger.info("Stopping producer pool...");
        MoreExecutors.shutdownAndAwaitTermination(threadPool, 10, TimeUnit.SECONDS);
    }

    private void produce() {
        logger.info("starting producer");
        while (keepGoing) {
            final PutRecordsRequest putRecordsRequest = new PutRecordsRequest();
            for (int msgNum = 0; msgNum < numRecordsPerPut; ++msgNum) {
                msgsProduced.incrementAndGet();

                final ByteBuffer randomByteBuffer = buildRandomByteBuffer();

                putRecordsRequest.withStreamName(streamName)
                                 .withRecords(new PutRecordsRequestEntry().withData(randomByteBuffer)
                                                                          .withPartitionKey(Integer.toString(random.nextInt())));
            }
            logger.info("Sending to {}", streamName);
            kinesisClient.putRecords(putRecordsRequest);
            logger.info("Sent {} to {}", msgsProduced.get(), streamName);
        }
    }

    /**
     * Build up a ByteBuffer that's roughly 5KB
     */
    private ByteBuffer buildRandomByteBuffer() {
        final String randomString = Strings.repeat(UUID.randomUUID().toString(), 136);
        return ByteBuffer.wrap(randomString.getBytes(Charsets.UTF_8));
    }

    private AWSCredentialsProvider getCredentialsProvider(String profileName) {
        return new AWSCredentialsProviderChain(new ProfileCredentialsProvider(profileName),
                                               new InstanceProfileCredentialsProvider());
    }

    /**
     *  Usage: [className] [streamName] [numberOfProducerThreads] [numberOfRecordsPerRequest] [numberOfTotalRecordsToPut] [optionalProfileName]
     */
    public static void main(String[] args) throws InterruptedException {
        checkArgument(args.length >= 5, "Incorrect number of arguments");

        final String streamName = checkNotNull(args[0], "You must provide a stream name");
        final String regionName = checkNotNull(args[1], "You must provide a region name");
        final String numProducers = checkNotNull(args[2], "You must define the number of producers");
        final String numRecordsPerPut = checkNotNull(args[3], "You must define how many records to put per request");
        final String numRecordsToPut = checkNotNull(args[4], "You must define how many records to write during the test");
        final Optional<String> profileName = args.length > 5 ? Optional.of(args[5]) : Optional.empty();

        final KinesisStressExample example = new KinesisStressExample(streamName, regionName, Integer.valueOf(numProducers), Integer.valueOf(numRecordsPerPut), Long.valueOf(numRecordsToPut), profileName.orElse(null));
        example.startProducers();
        example.startConsumers();
        example.awaitCompletion();
        logger.info("Test run complete");
    }

}


text:
from nova.api.validation import parameter_types

service_update = {
    'type': 'object',
    'properties': {
        'host': parameter_types.hostname,
        'binary': {
            'type': 'string', 'minLength': 1, 'maxLength': 255,
        },
        'disabled_reason': {
            'type': 'string', 'minLength': 1, 'maxLength': 255,
        }
    },
    'required': ['host', 'binary'],
    'additionalProperties': False
}

service_update_v211 = {
    'type': 'object',
    'properties': {
        'host': parameter_types.hostname,
        'binary': {
            'type': 'string', 'minLength': 1, 'maxLength': 255,
        },
        'disabled_reason': {
            'type': 'string', 'minLength': 1, 'maxLength': 255,
        },
        'forced_down': parameter_types.boolean
    },
    'required': ['host', 'binary'],
    'additionalProperties': False
}

# The 2.53 body is for updating a service's status and/or forced_down fields.
# There are no required attributes since the service is identified using a
# unique service_id on the request path, and status and/or forced_down can
# be specified in the body. If status=='disabled', then 'disabled_reason' is
# also checked in the body but is not required. Requesting status='enabled' and
# including a 'disabled_reason' results in a 400, but this is checked in code.
service_update_v2_53 = {
    'type': 'object',
    'properties': {
        'status': {
            'type': 'string',
            'enum': ['enabled', 'disabled'],
        },
        'disabled_reason': {
            'type': 'string', 'minLength': 1, 'maxLength': 255,
        },
        'forced_down': parameter_types.boolean
    },
    'additionalProperties': False
}