text:
package com.xinyu.mwp.networkapi;

import android.text.TextUtils;

/**
 * Created by wsz on 2016/4/27.
 */
public enum Host {
    INTERNAL_253("http://172.16.1.253"),
    INTERNAL_19("http://172.16.3.19"),
    INTERNAL_14("http://172.16.3.14/modou"),
    INTERNAL_165("http://172.16.1.165"),
    INTERNAL_TEST("http://code.ywwl.com/modou"),
    EXTERNAL_TEST("http://tandroidapi.modou.com"),
    EXTERNAL_RELEASE("http://androidapi.modou.com");

    private String host;
    private String oldHost;
    private int imPort = 5222;

    Host(String value) {
        this.host = value;
    }

    public String getValue() {
        return host;
    }

    public void switchHost() {
        if (!EXTERNAL_RELEASE.getValue().equals(host)) {
            oldHost = host;
            host = EXTERNAL_RELEASE.getValue();
        } else if (!TextUtils.isEmpty(oldHost)) {
            host = oldHost;
        }
    }

    public static int getImPort(Host host) {

        if (host == EXTERNAL_RELEASE) {
            return 5432;
        } else {
            return 5222;
        }
    }

    public static String getImHost(Host host) {

        if (host == EXTERNAL_RELEASE) {
            return "im.modou.com";
        } else if (host == INTERNAL_TEST) {
            return "code.ywwl.com";
        } else {
            return "tim.modou.com";
        }
    }

}


text:
package tv.floe.metronome.clustering.kmeans;

import static org.junit.Assert.*;

import org.junit.Test;

import tv.floe.metronome.clustering.kmeans.DistanceMeasurer;
import tv.floe.metronome.clustering.kmeans.Point;

public class DistanceMeasurerTest {

	@Test
	public void test1() {
		double [] d1 = {0,0};
		double [] d2 = {3,4};
		Point p1 = new Point(d1);
		Point p2 = new Point(d2);

		DistanceMeasurer measurer = new DistanceMeasurer();
		assertEquals(5.0, measurer.distance(p1, p2), 0.0000000001);
		assertEquals(5.0, measurer.distance(p2, p1), 0.0000000001);
	}

	@Test
	public void test2() {
		double [] d1 = {-2,-1};
		double [] d2 = {1,3};
		Point p1 = new Point(d1);
		Point p2 = new Point(d2);

		DistanceMeasurer measurer = new DistanceMeasurer();
		assertEquals(5.0, measurer.distance(p1, p2), 0.0000000001);
		assertEquals(5.0, measurer.distance(p2, p1), 0.0000000001);
	}

}

redpajama_set_name: RedPajamaGithub


text:
require 'pathname'
require_relative '../../spec_helper'
require_lib 'reek/configuration/app_configuration'
require_lib 'reek/configuration/directory_directives'
require_lib 'reek/configuration/default_directive'
require_lib 'reek/configuration/excluded_paths'

RSpec.describe Reek::Configuration::AppConfiguration do
  describe 'factory methods' do
    around do |example|
      Dir.mktmpdir do |tmp|
        Dir.chdir(tmp) do
          example.run
        end
      end
    end

    let(:expected_exclude_file_names) do
      %w(exclude_me.rb exclude_me_too.rb)
    end

    let(:expected_exclude_directories) do
      %w(directory_with_trailing_slash/ directory_without_trailing_slash)
    end

    let(:expected_excluded_paths) do
      (expected_exclude_file_names + expected_exclude_directories).map { |path| Pathname(path) }
    end

    let(:expected_default_directive) do
      { Reek::SmellDetectors::IrresponsibleModule => { 'enabled' => false } }
    end

    let(:expected_directory_directives) do
      { Pathname('directory_with_some_ruby_files') => {
        Reek::SmellDetectors::UtilityFunction => { 'enabled' => false }
      } }
    end

    describe '#from_path' do
      let(:configuration_path) { 'config.reek' }
      let(:configuration) do
        <<~YAML
          ---
          detectors:
            IrresponsibleModule:
              enabled: false
          directories:
            "directory_with_some_ruby_files":
              UtilityFunction:
                enabled: false
          exclude_paths:
            - "exclude_me.rb"
            - "exclude_me_too.rb"
            - "directory_with_trailing_slash/"
            - "directory_without_trailing_slash"
        YAML
      end

      before do
        File.write configuration_path, configuration
        FileUtils.touch expected_exclude_file_names
        FileUtils.mkdir expected_exclude_directories
      end

      it 'properly loads configuration and processes it' do
        config = described_class.from_path configuration_path

        expect(config.send(:excluded_paths)).to eq(expected_excluded_paths)
        expect(config.send(:default_directive)).to eq(expected_default_directive)
        expect(config.send(:directory_directives)).to eq(expected_directory_directives)
      end
    end

    describe '#from_hash' do
      before do
        FileUtils.touch expected_exclude_file_names
        FileUtils.mkdir expected_exclude_directories
      end

      let(:default_directive_value) do
        { Reek::DETECTORS_KEY => {
          'IrresponsibleModule' => { 'enabled' => false }
        } }
      end

      let(:directory_directives_value) do
        { Reek::DIRECTORIES_KEY => {
          'directory_with_some_ruby_files' => {
            'UtilityFunction' => { 'enabled' => false }
          }
        } }
      end

      let(:exclude_paths_value) do
        { Reek::EXCLUDE_PATHS_KEY => (expected_exclude_file_names + expected_exclude_directories) }
      end

      let(:combined_value) do
        directory_directives_value.
          merge(default_directive_value).
          merge(exclude_paths_value)
      end

      it 'sets the configuration a unified simple data structure' do
        config = described_class.from_hash(combined_value)

        expect(config.send(:excluded_paths)).to eq(expected_excluded_paths)
        expect(config.send(:default_directive)).to eq(expected_default_directive)
        expect(config.send(:directory_directives)).to eq(expected_directory_directives)
      end
    end
  end

  describe '#default' do
    it 'returns a blank AppConfiguration' do
      config = described_class.default
      expect(config).to be_instance_of described_class
      expect(config.send(:excluded_paths)).to eq([])
      expect(config.send(:default_directive)).to eq({})
      expect(config.send(:directory_directives)).to eq({})
    end
  end

  describe '#directive_for' do
    context 'with multiple directory directives and no default directive present' do
      let(:source_via) { 'samples/some_files/dummy1.rb' }
      let(:baz_config)  { { IrresponsibleModule: { enabled: false } } }
      let(:bang_config) { { Attribute: { enabled: true } } }
      let(:expected_result) { { Reek::SmellDetectors::Attribute => { enabled: true } } }

      let(:directory_directives) do
        {
          Reek::DIRECTORIES_KEY => {
            'samples/some_files'  => bang_config,
            'samples/other_files' => baz_config
          }
        }
      end

      it 'returns the corresponding directive' do
        configuration = described_class.from_hash directory_directives
        expect(configuration.directive_for(source_via)).to eq expected_result
      end
    end

    context 'with directory directive and default directive present' do
      let(:directory) { 'spec/samples/two_smelly_files/' }
      let(:source_via) { "#{directory}/dummy.rb" }

      let(:configuration_as_hash) do
        {
          Reek::DIRECTORIES_KEY => {
            directory => { TooManyStatements: { max_statements: 8 } }
          },
          Reek::DETECTORS_KEY   => {
            IrresponsibleModule: { enabled: false },
            TooManyStatements:   { max_statements: 15 }
          }
        }
      end

      it 'returns the directory directive with the default directive reverse-merged' do
        configuration = described_class.from_hash configuration_as_hash
        actual = configuration.directive_for(source_via)

        expect(actual[Reek::SmellDetectors::IrresponsibleModule]).to be_truthy
        expect(actual[Reek::SmellDetectors::TooManyStatements]).to be_truthy
        expect(actual[Reek::SmellDetectors::TooManyStatements][:max_statements]).to eq(8)
      end
    end

    context 'with a path not covered by a directory directive but a default directive present' do
      let(:source_via) { 'samples/some_files/dummy.rb' }

      let(:configuration_as_hash) do
        {
          Reek::DETECTORS_KEY   => {
            IrresponsibleModule: { enabled: false }
          },
          Reek::DIRECTORIES_KEY => {
            'samples/other_files' => { Attribute: { enabled: false } }
          }
        }
      end

      let(:expected_result) { { Reek::SmellDetectors::IrresponsibleModule => { enabled: false } } }

      it 'returns the default directive' do
        configuration = described_class.from_hash configuration_as_hash
        expect(configuration.directive_for(source_via)).to eq expected_result
      end
    end
  end
end


text:
package com.github.aahmedae.onlinebookclub;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class OnlineBookClubApplication {

	public static void main(String[] args) {
		SpringApplication.run(OnlineBookClubApplication.class, args);
	}
}


text:
<?php

namespace Numa\DOAAdminBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * UserItem
 */
class UserItem
{
    const SAVED_AD = 1;
    /**
     * @var integer
     */
    private $id;

    /**
     * @var integer
     */
    private $user_id;

    /**
     * @var integer
     */
    private $item_id;

    /**
     * @var boolean
     */
    private $active;

    /**
     * @var integer
     */
    private $item_type;

    /**
     * @var \DateTime
     */
    private $date_created;

    /**
     * @var \DateTime
     */
    private $date_updated;

    /**
     * @var \Numa\DOAAdminBundle\Entity\Item
     */
    private $Item;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set user_id
     *
     * @param integer $userId
     * @return UserItem
     */
    public function setUserId($userId)
    {
        $this->user_id = $userId;

        return $this;
    }

    /**
     * Get user_id
     *
     * @return integer
     */
    public function getUserId()
    {
        return $this->user_id;
    }

    /**
     * Set item_id
     *
     * @param integer $itemId
     * @return UserItem
     */
    public function setItemId($itemId)
    {
        $this->item_id = $itemId;

        return $this;
    }

    /**
     * Get item_id
     *
     * @return integer
     */
    public function getItemId()
    {
        return $this->item_id;
    }

    /**
     * Set active
     *
     * @param boolean $active
     * @return UserItem
     */
    public function setActive($active)
    {
        $this->active = $active;

        return $this;
    }

    /**
     * Get active
     *
     * @return boolean
     */
    public function getActive()
    {
        return $this->active;
    }

    /**
     * Set item_type
     *
     * @param integer $itemType
     * @return UserItem
     */
    public function setItemType($itemType)
    {
        $this->item_type = $itemType;

        return $this;
    }

    /**
     * Get item_type
     *
     * @return integer
     */
    public function getItemType()
    {
        return $this->item_type;
    }

    /**
     * Set date_created
     *
     * @param \DateTime $dateCreated
     * @return UserItem
     */
    public function setDateCreated($dateCreated)
    {
        $this->date_created = $dateCreated;

        return $this;
    }

    /**
     * Get date_created
     *
     * @return \DateTime
     */
    public function getDateCreated()
    {
        return $this->date_created;
    }

    /**
     * Set date_updated
     *
     * @param \DateTime $dateUpdated
     * @return UserItem
     */
    public function setDateUpdated($dateUpdated)
    {
        $this->date_updated = $dateUpdated;

        return $this;
    }

    /**
     * Get date_updated
     *
     * @return \DateTime
     */
    public function getDateUpdated()
    {
        return $this->date_updated;
    }

    /**
     * Set Item
     *
     * @param \Numa\DOAAdminBundle\Entity\Item $item
     * @return UserItem
     */
    public function setItem(\Numa\DOAAdminBundle\Entity\Item $item = null)
    {
        $this->Item = $item;

        return $this;
    }

    /**
     * Get Item
     *
     * @return \Numa\DOAAdminBundle\Entity\Item
     */
    public function getItem()
    {
        return $this->Item;
    }

    /**
     * @var \Numa\DOAAdminBundle\Entity\User
     */
    private $User;

    /**
     * Set User
     *
     * @param \Numa\DOAAdminBundle\Entity\User $user
     * @return UserItem
     */
    public function setUser(\Numa\DOAAdminBundle\Entity\User $user = null)
    {
        $this->User = $user;

        return $this;
    }

    /**
     * Get User
     *
     * @return \Numa\DOAAdminBundle\Entity\User
     */
    public function getUser()
    {
        return $this->User;
    }

    /**
     * @ORM\PrePersist
     */
    public function setCreatedAtValue()
    {
        // Add your code here
    }

    /**
     * @ORM\PreUpdate
     */
    public function setUpdatedAtValue()
    {
        // Add your code here
    }
}


text:
<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

    <services>
        <service id="controller_name_converter" class="Symfony\Bundle\FrameworkBundle\Controller\ControllerNameParser" public="false">
            <tag name="monolog.logger" channel="request" />
            <argument type="service" id="kernel" />
        </service>

        <service id="controller_resolver" class="Symfony\Bundle\FrameworkBundle\Controller\ControllerResolver" public="false">
            <tag name="monolog.logger" channel="request" />
            <argument type="service" id="service_container" />
            <argument type="service" id="controller_name_converter" />
            <argument type="service" id="logger" on-invalid="ignore" />
        </service>

        <service id="argument_metadata_factory" class="Symfony\Component\HttpKernel\ControllerMetadata\ArgumentMetadataFactory" public="false" />

        <service id="argument_resolver" class="Symfony\Component\HttpKernel\Controller\ArgumentResolver" public="false">
            <argument type="service" id="argument_metadata_factory" />
            <argument type="collection" />
        </service>

        <service id="argument_resolver.request_attribute" class="Symfony\Component\HttpKernel\Controller\ArgumentResolver\RequestAttributeValueResolver" public="false">
            <tag name="controller.argument_value_resolver" priority="100" />
        </service>

        <service id="argument_resolver.request" class="Symfony\Component\HttpKernel\Controller\ArgumentResolver\RequestValueResolver" public="false">
            <tag name="controller.argument_value_resolver" priority="50" />
        </service>

        <service id="argument_resolver.default" class="Symfony\Component\HttpKernel\Controller\ArgumentResolver\DefaultValueResolver" public="false">
            <tag name="controller.argument_value_resolver" priority="-100" />
        </service>

        <service id="argument_resolver.variadic" class="Symfony\Component\HttpKernel\Controller\ArgumentResolver\VariadicValueResolver" public="false">
            <tag name="controller.argument_value_resolver" priority="-150" />
        </service>

        <service id="response_listener" class="Symfony\Component\HttpKernel\EventListener\ResponseListener">
            <tag name="kernel.event_subscriber" />
            <argument>%kernel.charset%</argument>
        </service>

        <service id="streamed_response_listener" class="Symfony\Component\HttpKernel\EventListener\StreamedResponseListener">
            <tag name="kernel.event_subscriber" />
        </service>

        <service id="locale_listener" class="Symfony\Component\HttpKernel\EventListener\LocaleListener">
            <tag name="kernel.event_subscriber" />
            <argument type="service" id="request_stack" />
            <argument>%kernel.default_locale%</argument>
            <argument type="service" id="router" on-invalid="ignore" />
        </service>

        <service id="translator_listener" class="Symfony\Component\HttpKernel\EventListener\TranslatorListener">
            <argument type="service" id="translator" />
            <argument type="service" id="request_stack" />
            <tag name="kernel.event_subscriber" />
        </service>

        <service id="validate_request_listener" class="Symfony\Component\HttpKernel\EventListener\ValidateRequestListener">
            <tag name="kernel.event_subscriber" />
        </service>
    </services>
</container>


text:
import ShaderData from "openfl/display/ShaderData";
import ByteArray from "openfl/utils/ByteArray";
import * as assert from "assert";

describe ("TypeScript | ShaderData", function () {

	it ("new", function () {

		// TODO: Confirm functionality

		// #if !flash
		var shaderData = new ShaderData (new ByteArray ());
		var exists = shaderData;

		shaderData.testIsDynamic = true;

		assert.notEqual (exists, null);
		// #end

	});

});


text:
<component name="libraryTable">
  <library name="appcompat-v7-19.1.0">
    <CLASSES>
      <root url="file://$PROJECT_DIR$/app/build/exploded-bundles/ComAndroidSupportAppcompatV71910.aar/res" />
      <root url="jar://$PROJECT_DIR$/app/build/exploded-bundles/ComAndroidSupportAppcompatV71910.aar/classes.jar!/" />
    </CLASSES>
    <JAVADOC />
    <SOURCES />
  </library>
</component>


text:
//[Headers] You can add your own extra header files here...
#include "ompu/plug/game/event_handler.hpp"
#include "ompu/plug/game/drawer.hpp"
#include "ompu/plug/game/updater.hpp"

#include "ompu/game/game_data_snapshot.hpp"
//[/Headers]

#include "game_window.h"

//[MiscUserDefs] You can add your own user definitions and misc code here...
namespace ompu { namespace plug { namespace gui {
//[/MiscUserDefs]

//==============================================================================
GameWindow::GameWindow (App& app_)
    : AppComponent(app_),
      game_(app_.game())
{
    //[Constructor_pre] You can add your own custom stuff here..
    //[/Constructor_pre]

    setName ("GameWindow");

    //[UserPreSize]
    //[/UserPreSize]

    setSize (1600, 1200);

    //[Constructor] You can add your own custom stuff here..
    app().juce_component(this);
    gd_ss_ = game_->async_snapshot();

    this->update();
    this->setFramesPerSecond(app().desired_fps());
    //[/Constructor]
}

GameWindow::~GameWindow()
{
    //[Destructor_pre]. You can add your own custom destruction code here..
    //[/Destructor_pre]

    //[Destructor]. You can add your own custom destruction code here..
    //[/Destructor]
}

//==============================================================================
void GameWindow::paint (Graphics& g)
{
    //[UserPrePaint] Add your own custom painting code here..
    //[/UserPrePaint]

    //[UserPaint] Add your own custom painting code here..
    app().juce_draw_context(std::addressof(g));
    game_->synced_draw(gd_ss_);
    //[/UserPaint]
}

void GameWindow::resized()
{
    //[UserPreResize] Add your own custom resize code here..
    //[/UserPreResize]

    //[UserResized] Add your own custom resize handling here..
    //[/UserResized]
}

//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
void GameWindow::update()
{
    gd_ss_ = game_->synced_update();
}

}}} // ompu
//[/MiscUserCode]

//==============================================================================
#if 0
/*  -- Projucer information section --

    This is where the Projucer stores the metadata that describe this GUI layout, so
    make changes in here at your peril!

BEGIN_JUCER_METADATA

<JUCER_COMPONENT documentType="Component" className="GameWindow" componentName="GameWindow"
                 parentClasses="public ompu::plug::base::AppComponent<juce::AnimatedAppComponent>, private plug::detail::game_access"
                 constructorParams="App& app_" variableInitialisers="AppComponent(app_)
game_(app_.game())"
                 snapPixels="8" snapActive="1" snapShown="1" overlayOpacity="0.330"
                 fixedSize="1" initialWidth="1600" initialHeight="1200">
  <BACKGROUND backgroundColour="0"/>
</JUCER_COMPONENT>

END_JUCER_METADATA
*/
#endif

//[EndFile] You can add extra defines here...
//[/EndFile]


text:
package com.ft.membership.appName;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.dropwizard.Configuration;

import javax.validation.Valid;

/**
 * @author anuragkapur
 */
public class AppConfig extends Configuration {

    @Valid
    @JsonProperty
    private String secureConfigLocation;

    @Valid
    @JsonProperty
    private String greeting;

    public String getSecureConfigLocation() {
        return secureConfigLocation;
    }

    public void setSecureConfigLocation(String secureConfigLocation) {
        this.secureConfigLocation = secureConfigLocation;
    }

    public String getGreeting() {
        return greeting;
    }

    public void setGreeting(String greeting) {
        this.greeting = greeting;
    }
}


text:
using namespace std;

namespace LibKafka {

  TopicMetadata::TopicMetadata(Packet *packet) : WireFormatter(), PacketWriter(packet), ErrorHandler()
  {
    D(cout.flush() << "--------------TopicMetadata(buffer)\n";)

    // Kafka Protocol: short int topicErrorCode
    this->topicErrorCode = this->packet->readInt16();

    // Kafka Protocol: kafka string topicName
    this->topicName = this->packet->readString();

    // Kafka Protocol: PartitionMetadata[]
    this->partitionMetadataArraySize = this->packet->readInt32();
    this->partitionMetadataArray = new PartitionMetadata*[this->partitionMetadataArraySize];
    for (int i=0; i<this->partitionMetadataArraySize; i++) {
      this->partitionMetadataArray[i] = new PartitionMetadata(this->packet);
    }

    this->releaseArrays = true;
  }

  TopicMetadata::TopicMetadata(short int topicErrorCode, string topicName, int partitionMetadataArraySize, PartitionMetadata **partitionMetadataArray, bool releaseArrays) : WireFormatter(), PacketWriter(), ErrorHandler()
  {
    D(cout.flush() << "--------------TopicMetadata(params)\n";)

    this->topicErrorCode = topicErrorCode;
    this->topicName = topicName;
    this->partitionMetadataArraySize = partitionMetadataArraySize;
    this->partitionMetadataArray = partitionMetadataArray;
    this->releaseArrays = releaseArrays;
  }

  TopicMetadata::~TopicMetadata()
  {
    if (this->releaseArrays)
    {
      for (int i=0; i<this->partitionMetadataArraySize; i++) {
	delete this->partitionMetadataArray[i];
      }
      delete[] this->partitionMetadataArray;
    }
  }

  unsigned char* TopicMetadata::toWireFormat(bool updatePacketSize)
  {
    D(cout.flush() << "--------------TopicMetadata::toWireFormat()\n";)

    // Kafka Protocol: short int topicErrorCode
    this->packet->writeInt16(this->topicErrorCode);

    // Kafka Protocol: kafka string topicName
    this->packet->writeString(this->topicName);

    // Kafka Protocol: PartitionMetadata[]
    this->packet->writeInt32(this->partitionMetadataArraySize);
    for (int i=0; i<this->partitionMetadataArraySize; i++) {
      this->partitionMetadataArray[i]->packet = this->packet;
      this->partitionMetadataArray[i]->toWireFormat(false);
    }

    if (updatePacketSize) this->packet->updatePacketSize();
    return this->packet->getBuffer();
  }

  int TopicMetadata::getWireFormatSize(bool includePacketSize)
  {
    D(cout.flush() << "--------------TopicMetadata::getWireFormatSize()\n";)

    // Packet.size
    // topicErrorCode + topicName + partitionMetadataArraySize
    // partitionMetadataArraySize*PartitionMetadata

    int size = 0;
    if (includePacketSize) size += sizeof(int);
    size += sizeof(short int) + sizeof(short int) + this->topicName.length() + sizeof(int);
    for (int i=0; i<partitionMetadataArraySize; i++) {
      size += partitionMetadataArray[i]->getWireFormatSize(false);
    }
    return size;
  }

  bool TopicMetadata::hasErrorCode()
  {
    bool error = (this->topicErrorCode != ApiConstants::ERRORCODE_NO_ERROR);
    for (int i=0; i<partitionMetadataArraySize; i++) {
      error |= partitionMetadataArray[i]->hasErrorCode();
    }
    return error;
  }

  ostream& operator<< (ostream& os, const TopicMetadata& tm)
  {
    os << "TopicMetadata.topicName:" << tm.topicName << "\n";
    os << "TopicMetadata.topicErrorCode:" << tm.topicErrorCode << ":" << ApiConstants::getErrorString(tm.topicErrorCode) << "\n";
    os << "TopicMetadata.partitionMetadataArraySize:" << tm.partitionMetadataArraySize << "\n";
    for (int i=0; i<tm.partitionMetadataArraySize; i++) {
      os << "TopicMetadata.partitionMetadataArray[" << i << "]:" << *(tm.partitionMetadataArray[i]);
    }
    return os;
  }

}; // namespace LibKafka


text: select variance(distinct c_bigint), variance(distinct c_double) from datatype


text:
class AddRestetPasswordSentAtToUsers < ActiveRecord::Migration
  def change
    add_column :users, :reset_password_sent_at, :datetime
  end
end


text:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <inttypes.h>

#include "trousers/tss.h"
#include "trousers/trousers.h"
#include "trousers_types.h"
#include "spi_utils.h"
#include "capabilities.h"
#include "tsplog.h"
#include "obj.h"

TSS_RESULT
Tspi_TPM_CreateMaintenanceArchive(TSS_HTPM hTPM,			/* in */
				  TSS_BOOL fGenerateRndNumber,		/* in */
				  UINT32 * pulRndNumberLength,		/* out */
				  BYTE ** prgbRndNumber,		/* out */
				  UINT32 * pulArchiveDataLength,	/* out */
				  BYTE ** prgbArchiveData)		/* out */
{
	TSS_RESULT result;
	TSS_HCONTEXT tspContext;
	TSS_HPOLICY hOwnerPolicy;
	TPM_AUTH ownerAuth;
	TCPA_DIGEST digest;
	Trspi_HashCtx hashCtx;

	if (pulArchiveDataLength == NULL || prgbArchiveData == NULL)
		return TSPERR(TSS_E_BAD_PARAMETER);

	if (fGenerateRndNumber &&
	    (pulRndNumberLength == NULL || prgbRndNumber == NULL))
		return TSPERR(TSS_E_BAD_PARAMETER);

	if ((result = obj_tpm_get_tsp_context(hTPM, &tspContext)))
		return result;

	if ((result = obj_tpm_get_policy(hTPM, TSS_POLICY_USAGE, &hOwnerPolicy)))
		return result;

	result = Trspi_HashInit(&hashCtx, TSS_HASH_SHA1);
	result |= Trspi_Hash_UINT32(&hashCtx, TPM_ORD_CreateMaintenanceArchive);
	result |= Trspi_Hash_BYTE(&hashCtx, fGenerateRndNumber);
	if ((result |= Trspi_HashFinal(&hashCtx, digest.digest)))
		return result;

	if ((result = secret_PerformAuth_OIAP(hTPM, TPM_ORD_CreateMaintenanceArchive, hOwnerPolicy,
					      FALSE, &digest, &ownerAuth)))
		return result;

	if ((result = TCS_API(tspContext)->CreateMaintenanceArchive(tspContext, fGenerateRndNumber,
								    &ownerAuth, pulRndNumberLength,
								    prgbRndNumber,
								    pulArchiveDataLength,
								    prgbArchiveData)))
		return result;

	result = Trspi_HashInit(&hashCtx, TSS_HASH_SHA1);
	result |= Trspi_Hash_UINT32(&hashCtx, result);
	result |= Trspi_Hash_UINT32(&hashCtx, TPM_ORD_CreateMaintenanceArchive);
	result |= Trspi_Hash_UINT32(&hashCtx, *pulRndNumberLength);
	result |= Trspi_HashUpdate(&hashCtx, *pulRndNumberLength, *prgbRndNumber);
	result |= Trspi_Hash_UINT32(&hashCtx, *pulArchiveDataLength);
	result |= Trspi_HashUpdate(&hashCtx, *pulArchiveDataLength, *prgbArchiveData);
	if ((result |= Trspi_HashFinal(&hashCtx, digest.digest)))
		goto error1;

	if ((result = obj_policy_validate_auth_oiap(hOwnerPolicy, &digest, &ownerAuth)))
		goto error1;

	if ((result = __tspi_add_mem_entry(tspContext, *prgbRndNumber)))
		goto error1;

	if ((result = __tspi_add_mem_entry(tspContext, *prgbArchiveData))) {
		free_tspi(tspContext, *prgbRndNumber);
		goto error2;
	}

	return TSS_SUCCESS;
error1:
	free(*prgbRndNumber);
error2:
	free(*prgbArchiveData);
	return result;
}

TSS_RESULT
Tspi_TPM_KillMaintenanceFeature(TSS_HTPM hTPM)	/*  in */
{
	TSS_RESULT result;
	TSS_HCONTEXT tspContext;
	TSS_HPOLICY hOwnerPolicy;
	TPM_AUTH ownerAuth;
	TCPA_DIGEST digest;
	Trspi_HashCtx hashCtx;

	if ((result = obj_tpm_get_tsp_context(hTPM, &tspContext)))
		return result;

	if ((result = obj_tpm_get_policy(hTPM, TSS_POLICY_USAGE, &hOwnerPolicy)))
		return result;

	result = Trspi_HashInit(&hashCtx, TSS_HASH_SHA1);
	result |= Trspi_Hash_UINT32(&hashCtx, TPM_ORD_KillMaintenanceFeature);
	if ((result |= Trspi_HashFinal(&hashCtx, digest.digest)))
		return result;

	if ((result = secret_PerformAuth_OIAP(hTPM, TPM_ORD_KillMaintenanceFeature, hOwnerPolicy,
					      FALSE, &digest, &ownerAuth)))
		return result;

	if ((result = TCS_API(tspContext)->KillMaintenanceFeature(tspContext, &ownerAuth)))
		return result;

	result = Trspi_HashInit(&hashCtx, TSS_HASH_SHA1);
	result |= Trspi_Hash_UINT32(&hashCtx, result);
	result |= Trspi_Hash_UINT32(&hashCtx, TPM_ORD_KillMaintenanceFeature);
	if ((result |= Trspi_HashFinal(&hashCtx, digest.digest)))
		return result;

	if ((result = obj_policy_validate_auth_oiap(hOwnerPolicy, &digest, &ownerAuth)))
		return result;

	return TSS_SUCCESS;
}

TSS_RESULT
Tspi_TPM_LoadMaintenancePubKey(TSS_HTPM hTPM,				/* in */
			       TSS_HKEY hMaintenanceKey,		/* in */
			       TSS_VALIDATION * pValidationData)	/* in, out */
{
	TSS_RESULT result;
	TSS_HCONTEXT tspContext;
	TCPA_DIGEST checkSum, digest;
	TCPA_NONCE nonce;
	UINT64 offset;
	UINT32 pubBlobSize;
	BYTE hashBlob[512], *pubBlob;

	if ((result = obj_tpm_get_tsp_context(hTPM, &tspContext)))
		return result;

	if (pValidationData == NULL) {
		if ((result = get_local_random(tspContext, FALSE, sizeof(TCPA_NONCE),
					       (BYTE **)nonce.nonce)))
			return result;
	} else {
		if (pValidationData->ulExternalDataLength < sizeof(nonce.nonce))
			return TSPERR(TSS_E_BAD_PARAMETER);

		memcpy(&nonce.nonce, pValidationData->rgbExternalData, sizeof(nonce.nonce));
	}

	if ((result = obj_rsakey_get_pub_blob(hMaintenanceKey, &pubBlobSize, &pubBlob)))
		return result;

	if ((result = TCS_API(tspContext)->LoadManuMaintPub(tspContext, nonce, pubBlobSize, pubBlob,
							    &checkSum)))
		return result;

	offset = 0;
	Trspi_LoadBlob(&offset, pubBlobSize, hashBlob, pubBlob);
	Trspi_LoadBlob(&offset, TCPA_SHA1_160_HASH_LEN, hashBlob, (BYTE *)&nonce.nonce);

	if (pValidationData == NULL) {
		if ((result = Trspi_Hash(TSS_HASH_SHA1, offset, hashBlob, digest.digest)))
			return result;

		if (memcmp(&digest.digest, &checkSum.digest, TCPA_SHA1_160_HASH_LEN))
			result = TSPERR(TSS_E_FAIL);
	} else {
		if ((pValidationData->rgbData = calloc_tspi(tspContext, offset)) == NULL)
			return TSPERR(TSS_E_OUTOFMEMORY);

		pValidationData->ulDataLength = offset;
		memcpy(pValidationData->rgbData, hashBlob, offset);

		if ((pValidationData->rgbValidationData = calloc_tspi(tspContext,
								      TPM_SHA1_160_HASH_LEN))
		     == NULL) {
			free_tspi(tspContext, pValidationData->rgbData);
			pValidationData->rgbData = NULL;
			pValidationData->ulDataLength = 0;
			return TSPERR(TSS_E_OUTOFMEMORY);
		}
		pValidationData->ulValidationDataLength = TCPA_SHA1_160_HASH_LEN;

		memcpy(pValidationData->rgbValidationData, checkSum.digest, TCPA_SHA1_160_HASH_LEN);
	}

	return result;
}

TSS_RESULT
Tspi_TPM_CheckMaintenancePubKey(TSS_HTPM hTPM,				/* in */
				TSS_HKEY hMaintenanceKey,		/* in */
				TSS_VALIDATION * pValidationData)	/* in, out */
{
	TSS_RESULT result;
	TSS_HCONTEXT tspContext;
	TCPA_DIGEST checkSum, digest;
	TCPA_NONCE nonce;
	UINT32 pubBlobSize;
	BYTE *pubBlob;
	Trspi_HashCtx hashCtx;

	if ((pValidationData && hMaintenanceKey) || (!pValidationData && !hMaintenanceKey))
		return TSPERR(TSS_E_BAD_PARAMETER);

	if ((result = obj_tpm_get_tsp_context(hTPM, &tspContext)))
		return result;

	if (pValidationData == NULL) {
		if ((result = get_local_random(tspContext, FALSE, sizeof(TCPA_NONCE),
					       (BYTE **)nonce.nonce)))
			return result;
	} else {
		if (pValidationData->ulExternalDataLength < sizeof(nonce.nonce))
			return TSPERR(TSS_E_BAD_PARAMETER);

		memcpy(&nonce.nonce, pValidationData->rgbExternalData, sizeof(nonce.nonce));
	}

	if ((result = TCS_API(tspContext)->ReadManuMaintPub(tspContext, nonce, &checkSum)))
		return result;

	if (pValidationData == NULL) {
		if ((result = obj_rsakey_get_pub_blob(hMaintenanceKey, &pubBlobSize, &pubBlob)))
			return result;

		result = Trspi_HashInit(&hashCtx, TSS_HASH_SHA1);
		result |= Trspi_HashUpdate(&hashCtx, pubBlobSize, pubBlob);
		result |= Trspi_HashUpdate(&hashCtx, TCPA_SHA1_160_HASH_LEN, (BYTE *)&nonce.nonce);
		if ((result |= Trspi_HashFinal(&hashCtx, digest.digest)))
			return result;

		if (memcmp(&digest.digest, &checkSum.digest, TCPA_SHA1_160_HASH_LEN))
			result = TSPERR(TSS_E_FAIL);

		free_tspi(tspContext, pubBlob);
	} else {
		/* Ignore Data and DataLength, the application must already have this data.
		 * Do, however, copy out the checksum so that the application can verify */
		if ((pValidationData->rgbValidationData = calloc_tspi(tspContext,
								      TCPA_SHA1_160_HASH_LEN))
		     == NULL) {
			return TSPERR(TSS_E_OUTOFMEMORY);
		}

		pValidationData->ulValidationDataLength = TCPA_SHA1_160_HASH_LEN;
		memcpy(pValidationData->rgbValidationData, checkSum.digest, TCPA_SHA1_160_HASH_LEN);
	}

	return result;
}


text:
package jump61;

/** A Player that gets its moves from manual input.
 *  @author Rafatel Mkrtchyan
 */
class HumanPlayer extends Player {

    /** A new player initially playing COLOR taking manual input of
     *  moves from GAME's input source. */
    HumanPlayer(Game game, Side color) {
        super(game, color);
    }

    @Override
    /** Retrieve moves using getGame().getMove() until a legal one is found and
     *  make that move in getGame().  Report erroneous moves to player. */
    void makeMove() {
        int[] smalldata = new int[2];
        Side mySide = getSide();
        Game myGame = getGame();
        if (myGame.getMove(smalldata)) {
            int first = smalldata[0];
            int second = smalldata[1];
            myGame.makeMove(first, second);
        }
    }
}


text:
<?php
/**
 * Test for net::stubbles::streams::memory::stubMemoryStreamWrapper.
 *
 * @package     stubbles
 * @subpackage  streams_memory_test
 * @version     $Id: stubMemoryStreamWrapperTestCase.php 2857 2011-01-10 13:43:39Z mikey $
 */
stubClassLoader::load('net::stubbles::streams::memory::stubMemoryStreamWrapper');
/**
 * Test for net::stubbles::streams::memory::stubMemoryStreamWrapper.
 *
 * @package     stubbles
 * @subpackage  streams_memory_test
 * @group       streams
 * @group       streams_memory
 */
class stubMemoryStreamWrapperTestCase extends PHPUnit_Framework_TestCase
{
    /**
     * url of test stream
     *
     * @var  string
     */
    protected $url = 'memory://foo';
    /**
     * file pointer
     *
     * @var  resource
     */
    protected $fp;

    /**
     * set up test environment
     */
    public function setUp()
    {
        file_put_contents($this->url, 'foo');
        $this->fp = fopen($this->url, 'rw');
    }

    /**
     * clean up test environment
     */
    public function tearDown()
    {
        if (null !== $this->fp) {
            fclose($this->fp);
        }

        unlink($this->url);
    }

    /**
     * read data from stream
     *
     * @test
     */
    public function read()
    {
        $this->assertFalse(feof($this->fp));
        $this->assertEquals('foo', fread($this->fp, 3));
        $this->assertTrue(feof($this->fp));
    }

    /**
     * write data to stream
     *
     * @test
     */
    public function write()
    {
        $this->assertEquals(5, fwrite($this->fp, 'hello'));
        fseek($this->fp, 0);
        $this->assertEquals('hello', fread($this->fp, 4096));
    }

    /**
     * seek in memory stream
     *
     * @test
     */
    public function seek_SET()
    {
        $this->assertEquals(0, ftell($this->fp));
        $this->assertEquals(0, fseek($this->fp, 2));
        $this->assertEquals(2, ftell($this->fp));
        $this->assertEquals('o', fread($this->fp, 1));
        $this->assertEquals(0, fseek($this->fp, 0, SEEK_SET));
        $this->assertEquals(0, ftell($this->fp));
        $this->assertEquals('foo', fread($this->fp, 3));
    }

    /**
     * seek in memory stream
     *
     * @test
     */
    public function seek_CURRENT()
    {
        $this->assertEquals(0, fseek($this->fp, 1, SEEK_CUR));
        $this->assertEquals(1, ftell($this->fp));
        $this->assertEquals('oo', fread($this->fp, 2));
    }

    /**
     * seek in memory stream
     *
     * @test
     */
    public function seek_END()
    {
        $this->assertEquals(0, fseek($this->fp, -2, SEEK_END));
        $this->assertEquals(1, ftell($this->fp));
        $this->assertEquals('oo', fread($this->fp, 2));
    }

    /**
     * unlink() removes buffer from memory
     *
     * @test
     */
    public function unlinkRemovesBufferFromMemory()
    {
        $this->assertTrue(file_exists($this->url));
        $this->assertTrue(unlink($this->url));
        $this->assertFalse(file_exists($this->url));
        $this->assertFalse(unlink($this->url));
    }

    /**
     * fstat() and stat() return the size of the buffer
     *
     * @test
     */
    public function statReturnsSizeOfBuffer()
    {
        $statData = fstat($this->fp);
        $this->assertEquals(3, $statData['size']);
        $statData = stat($this->url);
        $this->assertEquals(3, $statData['size']);
        $this->assertFalse(@stat('memory://doesNotExist'));
    }

    /**
     * trying to open a non existing file with mode r or r+ will fail
     *
     * @test
     */
    public function openNonExistingBufferWithModeRFails()
    {
        $this->assertFalse(@fopen('memory://doesNotExist', 'r'));
        $this->assertFalse(@fopen('memory://doesNotExist', 'rb'));
        $this->assertFalse(@fopen('memory://doesNotExist', 'r+'));
        $this->assertFalse(@fopen('memory://doesNotExist', 'rb+'));
    }

    /**
     * opening an existing file with mode r or r+ sets pointer to beginning of buffer
     *
     * @test
     */
    public function openExistingBufferWithModeRSetsPositionTo0()
    {
        $fp = fopen('memory://foo', 'r');
        $this->assertEquals(0, ftell($fp));
        $this->assertFalse(feof($fp));
        fclose($fp);
        $fp = fopen('memory://foo', 'rb');
        $this->assertEquals(0, ftell($fp));
        $this->assertFalse(feof($fp));
        fclose($fp);
        $fp = fopen('memory://foo', 'r+');
        $this->assertEquals(0, ftell($fp));
        $this->assertFalse(feof($fp));
        fclose($fp);
        $fp = fopen('memory://foo', 'rb+');
        $this->assertEquals(0, ftell($fp));
        $this->assertFalse(feof($fp));
        fclose($fp);
    }

    /**
     * opening a file with mode w or w+ sets pointer to beginning of buffer and truncates it
     *
     * @test
     */
    public function openBufferWithModeWSetsPositionTo0AndTruncatesBuffer()
    {
        $fp = fopen('memory://foo', 'w');
        $this->assertEquals(0, ftell($fp));
        $this->assertTrue(feof($fp));
        fclose($fp);
        $fp = fopen('memory://foo', 'wb');
        $this->assertEquals(0, ftell($fp));
        $this->assertTrue(feof($fp));
        fclose($fp);
        $fp = fopen('memory://foo', 'w+');
        $this->assertEquals(0, ftell($fp));
        $this->assertTrue(feof($fp));
        fclose($fp);
        $fp = fopen('memory://foo', 'wb+');
        $this->assertEquals(0, ftell($fp));
        $this->assertTrue(feof($fp));
        fclose($fp);
        $fp = fopen('memory://doesNotExist', 'w');
        $this->assertEquals(0, ftell($fp));
        $this->assertTrue(feof($fp));
        fclose($fp);
        unlink('memory://doesNotExist');
        $fp = fopen('memory://doesNotExist', 'wb');
        $this->assertEquals(0, ftell($fp));
        $this->assertTrue(feof($fp));
        fclose($fp);
        unlink('memory://doesNotExist');
        $fp = fopen('memory://doesNotExist', 'w+');
        $this->assertEquals(0, ftell($fp));
        $this->assertTrue(feof($fp));
        fclose($fp);
        unlink('memory://doesNotExist');
        $fp = fopen('memory://doesNotExist', 'wb+');
        $this->assertEquals(0, ftell($fp));
        $this->assertTrue(feof($fp));
        fclose($fp);
        unlink('memory://doesNotExist');
    }

    /**
     * opening a file with mode a or a+ sets pointer to end of buffer
     *
     * @test
     */
    public function openBufferWithModeASetsPositionToEndOfBuffer()
    {
        $fp = fopen('memory://foo', 'a');
        $this->assertEquals(3, ftell($fp));
        $this->assertTrue(feof($fp));
        fclose($fp);
        $fp = fopen('memory://foo', 'ab');
        $this->assertEquals(3, ftell($fp));
        $this->assertTrue(feof($fp));
        fclose($fp);
        $fp = fopen('memory://foo', 'a+');
        $this->assertEquals(3, ftell($fp));
        $this->assertTrue(feof($fp));
        fclose($fp);
        $fp = fopen('memory://foo', 'ab+');
        $this->assertEquals(3, ftell($fp));
        $this->assertTrue(feof($fp));
        fclose($fp);
        $fp = fopen('memory://doesNotExist', 'a');
        $this->assertEquals(0, ftell($fp));
        $this->assertTrue(feof($fp));
        fclose($fp);
        unlink('memory://doesNotExist');
        $fp = fopen('memory://doesNotExist', 'ab');
        $this->assertEquals(0, ftell($fp));
        $this->assertTrue(feof($fp));
        fclose($fp);
        unlink('memory://doesNotExist');
        $fp = fopen('memory://doesNotExist', 'a+');
        $this->assertEquals(0, ftell($fp));
        $this->assertTrue(feof($fp));
        fclose($fp);
        unlink('memory://doesNotExist');
        $fp = fopen('memory://doesNotExist', 'ab+');
        $this->assertEquals(0, ftell($fp));
        $this->assertTrue(feof($fp));
        fclose($fp);
        unlink('memory://doesNotExist');
    }

    /**
     * trying to open an existing file with mode x or x+ will fail
     *
     * @test
     */
    public function openExistingBufferWithModeXFails()
    {
        $this->assertFalse(@fopen('memory://foo', 'x'));
        $this->assertFalse(@fopen('memory://foo', 'xb'));
        $this->assertFalse(@fopen('memory://foo', 'x+'));
        $this->assertFalse(@fopen('memory://foo', 'xb+'));
    }

    /**
     * opening an existing file with mode r or r+ sets pointer to beginning of buffer
     *
     * @test
     */
    public function openNonExistingBufferWithModeXSetsPositionTo0()
    {
        $fp = fopen('memory://doesNotExist', 'x');
        $this->assertEquals(0, ftell($fp));
        $this->assertTrue(feof($fp));
        fclose($fp);
        unlink('memory://doesNotExist');
        $fp = fopen('memory://doesNotExist', 'xb');
        $this->assertEquals(0, ftell($fp));
        $this->assertTrue(feof($fp));
        fclose($fp);
        unlink('memory://doesNotExist');
        $fp = fopen('memory://doesNotExist', 'x+');
        $this->assertEquals(0, ftell($fp));
        $this->assertTrue(feof($fp));
        fclose($fp);
        unlink('memory://doesNotExist');
        $fp = fopen('memory://doesNotExist', 'xb+');
        $this->assertEquals(0, ftell($fp));
        $this->assertTrue(feof($fp));
        fclose($fp);
        unlink('memory://doesNotExist');
    }

}
?>


text:
/* -*- c++ -*- */
/*
 * Copyright 2016 Innovative Integration, Inc..
 *
 * This is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3, or (at your option)
 * any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this software; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street,
 * Boston, MA 02110-1301, USA.
 */

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include <gnuradio/io_signature.h>
#include <volk/volk.h>
#include "duc_sink_impl.h"

namespace gr {
  namespace II_K7 {

    duc_sink::sptr
    duc_sink::make(II_K7::DucFmcModule fmc_module, short max_ch, const char*  duc_filter_path,
                   float ch0_tune_freq, float ch1_tune_freq, float ch2_tune_freq, float ch3_tune_freq,
                   float ch4_tune_freq, float ch5_tune_freq, float ch6_tune_freq, float ch7_tune_freq)
    {
      return gnuradio::get_initial_sptr
        (new duc_sink_impl(fmc_module, max_ch, duc_filter_path,
                           ch0_tune_freq, ch1_tune_freq, ch2_tune_freq, ch3_tune_freq,
                           ch4_tune_freq, ch5_tune_freq, ch6_tune_freq, ch7_tune_freq));
    }

    /*
     * The private constructor
     */
    duc_sink_impl::duc_sink_impl(II_K7::DucFmcModule fmc_module, short max_ch, const char*  duc_filter_path,
                                 float ch0_tune_freq, float ch1_tune_freq, float ch2_tune_freq, float ch3_tune_freq,
                                 float ch4_tune_freq, float ch5_tune_freq, float ch6_tune_freq, float ch7_tune_freq)
      :
        Settings(duc_filter_path, // labeled as "DUC Bandwidth" in GR block
                 max_ch,
                 ch0_tune_freq, ch1_tune_freq, ch2_tune_freq, ch3_tune_freq,
                 ch4_tune_freq, ch5_tune_freq, ch6_tune_freq, ch7_tune_freq),
        gr::sync_block("duc_sink",
              gr::io_signature::make(1, gr::io_signature::IO_INFINITE, sizeof(gr_complex)),
              gr::io_signature::make(0, 0, 0))
    {
        GR_LOG_DEBUG(d_debug_logger, "Constructor called.");
        Io = new GRGpK7Interface(this, static_cast<GRGpK7Interface::LibIoSelector>(fmc_module));

        const int alignment_multiple = volk_get_alignment() / sizeof(float);
        set_alignment(std::max(1, alignment_multiple));

        Io->SetDucSettings(Settings);
        // TODO:GR_LOG_DEBUG(d_debug_logger, "Max channels: "+IntToString(Settings.MaxChannels));
        GR_LOG_DEBUG(d_debug_logger, "Constructor finished.");
    }

    /*
     * Our virtual destructor.
     */
    duc_sink_impl::~duc_sink_impl()
    {
        GR_LOG_DEBUG(d_debug_logger, "destructor called.");
        delete Io;
    }

    bool duc_sink_impl::start()
    {
        GR_LOG_DEBUG(d_debug_logger, "start() called.");
        // Requires hardware:
        Io->OpenDriver();
        GR_LOG_DEBUG(d_debug_logger, "open() finished.");
        // Requires hardware:
        Io->Start();
        // TODO: return value?
        GR_LOG_DEBUG(d_debug_logger, "start() finished.");
    }

    int
    duc_sink_impl::work(int noutput_items,
        gr_vector_const_void_star &input_items,
        gr_vector_void_star &output_items)
    {
        return Io->DucWork(noutput_items, input_items, output_items);
    }

    bool duc_sink_impl::stop()
    {
        return Io->Stop();
    }
  } /* namespace II_K7 */
} /* namespace gr */