text:
bool load(const std::string& file, Json::Value& root);
bool load(const Json::Value& node, const std::string& name, int& i);
bool load(const Json::Value& node, const std::string& name, unsigned int& i);
bool load(const Json::Value& node, const std::string& name, float& f);
bool load(const Json::Value& node, const std::string& name, bool& b);
bool load(const Json::Value& node, const std::string& name, glm::vec3& vec);
bool load(const Json::Value& node, const std::string& name, std::string& str);

redpajama_set_name: RedPajamaGithub


text:
package de.sebb767.pvs.helper;

/**
 * Created by proj on 3/23/17.
 */
public class ThreadCountHelper {
    public static int getCpuCount()
    {
        return Runtime.getRuntime().availableProcessors();
    }

    public static int getIdealThreadCount()
    {
        return getCpuCount() * 2;
    }
}


text:
<!--
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-->
<html>
<head>
  <title>no_listeners</title>
</head>
<body></body>
</html>


text:
<?php

namespace Composer\Satis\Builder;

use Composer\Json\JsonFile;
use Composer\Package\Dumper\ArrayDumper;
use Composer\Util\Filesystem;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * Builds the JSON files.
 *
 * @author James Hautot <james@rezo.net>
 */
class PackagesBuilder extends Builder
{
    /** @var string packages.json file name. */
    private $filename;

    /** @var string included json filename template */
    private $includeFileName;

    private $writtenIncludeJsons = [];

    /**
     * Dedicated Packages Constructor.
     *
     * @param OutputInterface $output     The output Interface
     * @param string          $outputDir  The directory where to build
     * @param array           $config     The parameters from ./satis.json
     * @param bool            $skipErrors Escapes Exceptions if true
     */
    public function __construct(OutputInterface $output, $outputDir, $config, $skipErrors)
    {
        parent::__construct($output, $outputDir, $config, $skipErrors);

        $this->filename = $this->outputDir . '/packages.json';
        $this->includeFileName = isset($config['include-filename']) ? $config['include-filename'] : 'include/all$%hash%.json';
    }

    /**
     * Builds the JSON stuff of the repository.
     *
     * @param \Composer\Package\PackageInterface[] $packages List of packages to dump
     */
    public function dump(array $packages)
    {
        $packagesByName = [];
        $dumper = new ArrayDumper();
        foreach ($packages as $package) {
            $packagesByName[$package->getName()][$package->getPrettyVersion()] = $dumper->dump($package);
        }

        $repo = ['packages' => []];
        if (isset($this->config['providers']) && $this->config['providers']) {
            $providersUrl = 'p/%package%$%hash%.json';
            if (!empty($this->config['homepage'])) {
                $repo['providers-url'] = parse_url(rtrim($this->config['homepage'], '/'), PHP_URL_PATH) . '/' . $providersUrl;
            } else {
                $repo['providers-url'] = $providersUrl;
            }
            $repo['providers'] = [];
            $i = 1;
            // Give each version a unique ID
            foreach ($packagesByName as $packageName => $versionPackages) {
                foreach ($versionPackages as $version => $versionPackage) {
                    $packagesByName[$packageName][$version]['uid'] = $i++;
                }
            }
            // Dump the packages along with packages they're replaced by
            foreach ($packagesByName as $packageName => $versionPackages) {
                $dumpPackages = $this->findReplacements($packagesByName, $packageName);
                $dumpPackages[$packageName] = $versionPackages;
                $includes = $this->dumpPackageIncludeJson(
                    $dumpPackages,
                    str_replace('%package%', $packageName, $providersUrl),
                    'sha256'
                );
                $repo['providers'][$packageName] = current($includes);
            }
        } else {
            $repo['includes'] = $this->dumpPackageIncludeJson($packagesByName, $this->includeFileName);
        }

        $this->dumpPackagesJson($repo);

        $this->pruneIncludeDirectories();
    }

    /**
     * Find packages replacing the $replaced packages
     *
     * @param array $packages
     * @param string $replaced
     *
     * @return array
     */
    private function findReplacements($packages, $replaced)
    {
        $replacements = [];
        foreach ($packages as $packageName => $packageConfig) {
            foreach ($packageConfig as $versionConfig) {
                if (!empty($versionConfig['replace']) && array_key_exists($replaced, $versionConfig['replace'])) {
                    $replacements[$packageName] = $packageConfig;
                    break;
                }
            }
        }

        return $replacements;
    }

    /**
     * Remove all files matching the includeUrl pattern next to just created include jsons
     */
    private function pruneIncludeDirectories()
    {
        $this->output->writeln('<info>Pruning include directories</info>');
        $paths = [];
        while ($this->writtenIncludeJsons) {
            list($hash, $includesUrl) = array_shift($this->writtenIncludeJsons);
            $path = $this->outputDir . '/' . ltrim($includesUrl, '/');
            $dirname = dirname($path);
            $basename = basename($path);
            if (strpos($dirname, '%hash%') !== false) {
                throw new \RuntimeException('Refusing to prune when %hash% is in dirname');
            }
            $pattern = '#^' . str_replace('%hash%', '([0-9a-zA-Z]{' . strlen($hash) . '})', preg_quote($basename, '#')) . '$#';
            $paths[$dirname][] = [$pattern, $hash];
        }
        foreach ($paths as $dirname => $entries) {
            foreach (new \DirectoryIterator($dirname) as $file) {
                foreach ($entries as $entry) {
                    list($pattern, $hash) = $entry;
                    if (preg_match($pattern, $file->getFilename(), $matches) && $matches[1] !== $hash) {
                        unlink($file->getPathname());
                        $this->output->writeln('<comment>Deleted ' . $file->getPathname() . '</comment>');
                    }
                }
            }
        }
    }

    /**
     * Writes includes JSON Files.
     *
     * @param array $packages List of packages to dump
     * @param string $includesUrl The includes url (optionally containing %hash%)
     * @param string $hashAlgorithm Hash algorithm {@see hash()}
     *
     * @return array The object for includes key in packages.json
     */
    private function dumpPackageIncludeJson(array $packages, $includesUrl, $hashAlgorithm = 'sha1')
    {
        $filename = str_replace('%hash%', 'prep', $includesUrl);
        $path = $tmpPath = $this->outputDir . '/' . ltrim($filename, '/');

        $repoJson = new JsonFile($path);
        $contents = $repoJson->encode(['packages' => $packages]) . "\n";

        $hash = hash($hashAlgorithm, $contents);

        if (strpos($includesUrl, '%hash%') !== false) {
            $this->writtenIncludeJsons[] = [$hash, $includesUrl];
            $filename = str_replace('%hash%', $hash, $includesUrl);
            if (file_exists($path = $this->outputDir . '/' . ltrim($filename, '/'))) {
                // When the file exists, we don't need to override it as we assume,
                // the contents satisfy the hash
                $path = null;
            }
        }
        if ($path) {
            $this->writeToFile($path, $contents);
            $this->output->writeln("<info>wrote packages to $path</info>");
        }

        return [
            $filename => [$hashAlgorithm => $hash],
        ];
    }

    /**
     * Write to a file
     *
     * @param string $path
     * @param string $contents
     *
     * @throws \UnexpectedValueException
     * @throws \Exception
     */
    private function writeToFile($path, $contents)
    {
        $dir = dirname($path);
        if (!is_dir($dir)) {
            if (file_exists($dir)) {
                throw new \UnexpectedValueException(
                    $dir . ' exists and is not a directory.'
                );
            }
            if (!@mkdir($dir, 0777, true)) {
                throw new \UnexpectedValueException(
                    $dir . ' does not exist and could not be created.'
                );
            }
        }

        $retries = 3;
        while ($retries--) {
            try {
                file_put_contents($path, $contents);
                break;
            } catch (\Exception $e) {
                if ($retries) {
                    usleep(500000);
                    continue;
                }

                throw $e;
            }
        }
    }

    /**
     * Writes the packages.json of the repository.
     *
     * @param array $repo Repository information
     */
    private function dumpPackagesJson($repo)
    {
        if (isset($this->config['notify-batch'])) {
            $repo['notify-batch'] = $this->config['notify-batch'];
        }

        $this->output->writeln('<info>Writing packages.json</info>');
        $repoJson = new JsonFile($this->filename);
        $repoJson->write($repo);
    }
}


text:
#pragma once

#include "pilz_industrial_motion_planner/limits_container.h"

#include <memory>
#include <vector>

#include <moveit/planning_interface/planning_interface.h>

#include "pilz_industrial_motion_planner/limits_container.h"

namespace pilz_industrial_motion_planner
{
/**
 * @brief Base class for all PlanningContextLoaders.
 * Since planning_interface::PlanningContext has a non empty ctor,
 * classes derived from it can not be plugins.
 * This class serves as base class for wrappers.
 */
class PlanningContextLoader
{
public:
  PlanningContextLoader();
  virtual ~PlanningContextLoader();

  /// Return the algorithm the loader uses
  virtual std::string getAlgorithm() const;

  /**
   * @brief Sets the robot model that can be passed to the planning context
   * @param model The robot model
   * @return false if could not be set
   */
  virtual bool setModel(const moveit::core::RobotModelConstPtr& model);

  /**
   * @brief Sets limits the planner can pass to the contexts
   * @param limits container of limits, no guarantee to contain the limits for
   * all joints of the model
   * @return true if limits could be set
   */
  virtual bool setLimits(const pilz_industrial_motion_planner::LimitsContainer& limits);

  /**
   * @brief Return the planning context
   * @param planning_context
   * @param name context name
   * @param group name of the planning group
   * @return true on success, false otherwise
   */
  virtual bool loadContext(planning_interface::PlanningContextPtr& planning_context, const std::string& name,
                           const std::string& group) const = 0;

protected:
  /**
   * @brief Return the planning context of type T
   * @param planning_context
   * @param name context name
   * @param group name of the planning group
   * @return true on success, false otherwise
   */
  template <typename T>
  bool loadContext(planning_interface::PlanningContextPtr& planning_context, const std::string& name,
                   const std::string& group) const;

protected:
  /// Name of the algorithm
  std::string alg_;

  /// True if limits are set
  bool limits_set_;

  /// Limits to be used during planning
  pilz_industrial_motion_planner::LimitsContainer limits_;

  /// True if model is set
  bool model_set_;

  /// The robot model
  moveit::core::RobotModelConstPtr model_;
};

typedef boost::shared_ptr<PlanningContextLoader> PlanningContextLoaderPtr;
typedef boost::shared_ptr<const PlanningContextLoader> PlanningContextLoaderConstPtr;

template <typename T>
bool PlanningContextLoader::loadContext(planning_interface::PlanningContextPtr& planning_context,
                                        const std::string& name, const std::string& group) const
{
  if (limits_set_ && model_set_)
  {
    planning_context = std::make_shared<T>(name, group, model_, limits_);
    return true;
  }
  else
  {
    if (!limits_set_)
    {
      ROS_ERROR_STREAM("Limits are not defined. Cannot load planning context. "
                       "Call setLimits loadContext");
    }
    if (!model_set_)
    {
      ROS_ERROR_STREAM("Robot model was not set");
    }
    return false;
  }
}

}  // namespace pilz_industrial_motion_planner


text:
include config.mk

SRC = lockx.c
OBJ = ${SRC:.c=.o}

all: options lockx

options:
	@echo lockx build options:
	@echo "CFLAGS   = ${CFLAGS}"
	@echo "LDFLAGS  = ${LDFLAGS}"
	@echo "CC       = ${CC}"

.c.o:
	@echo CC $<
	@${CC} -c ${CFLAGS} $<

${OBJ}: config.mk

lockx: ${OBJ}
	@echo CC -o $@
	@${CC} -o $@ ${OBJ} ${LDFLAGS}

clean:
	@echo cleaning
	@rm -f lockx ${OBJ} lockx-${VERSION}.tar.gz

dist: clean
	@echo creating dist tarball
	@mkdir -p lockx-${VERSION}
	@cp -R LICENSE Makefile README config.mk ${SRC} lockx-${VERSION}
	@tar -cf lockx-${VERSION}.tar lockx-${VERSION}
	@gzip lockx-${VERSION}.tar
	@rm -rf lockx-${VERSION}

install: all
	@echo installing executable file to ${DESTDIR}${PREFIX}/bin
	@mkdir -p ${DESTDIR}${PREFIX}/bin
	@cp -f lockx ${DESTDIR}${PREFIX}/bin
	@chmod 755 ${DESTDIR}${PREFIX}/bin/lockx
	@chmod u+s ${DESTDIR}${PREFIX}/bin/lockx

uninstall:
	@echo removing executable file from ${DESTDIR}${PREFIX}/bin
	@rm -f ${DESTDIR}${PREFIX}/bin/lockx

.PHONY: all options clean dist install uninstall


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>All Classes</title>
<meta name="date" content="2016-06-21">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">

All Classes

AbstractMessage

InMemoryMessageRepository

Message

MessageBus

MessageBusImp

MessageRepository

PublisherCallback

PublishingStrategy

Subscriber

SubscriptionToken

ThreadOption

TokenGenerator

UUIDToken

UUIDTokenGenerator