<commit_before>//=====================================================================//
/*! @file
    @brief  SCI (UART) サンプル
    @author 平松邦仁 (hira@rvf-rc45.net)
	@copyright	Copyright (C) 2018, 2022 Kunihito Hiramatsu @n
				Released under the MIT license @n
				https://github.com/hirakuni45/RX/blob/master/LICENSE
*/
//=====================================================================//
#include "common/renesas.hpp"

#include "common/fixed_fifo.hpp"
#include "common/sci_io.hpp"
#include "common/cmt_mgr.hpp"
#include "common/command.hpp"

#include "common/format.hpp"
#include "common/input.hpp"

namespace {

#if defined(SIG_RX63T)
	// DIY RX63T board
	static const char* system_str_ = { "RX63T DIY" };
	static constexpr bool LED_ACTIVE = 0;
	typedef device::PORT<device::PORTB, device::bitpos::B7, LED_ACTIVE> LED;
	typedef device::SCI1 SCI_CH;
#elif defined(SIG_RX62N)
  #if defined(CQ_FRK)
    // FRK-RX62N(CQ 出版社)
	static const char* system_str_ = { "RX62N FRK-RX62N" };
	static constexpr bool LED_ACTIVE = 0;
	typedef device::PORT<device::PORT1, device::bitpos::B5, LED_ACTIVE> LED;
	typedef device::SCI1 SCI_CH;
  #else
    // BlueBoard-RX62N_100pin
	static const char* system_str_ = { "RX62N BlueBoard-RX62N_100pin" };
	static constexpr bool LED_ACTIVE = 0;
	typedef device::PORT<device::PORT0, device::bitpos::B5, LED_ACTIVE> LED;
	typedef device::SCI1 SCI_CH;
  #endif
#elif defined(SIG_RX24T)
	static const char* system_str_ = { "RX24T DIY" };
	typedef device::PORT<device::PORT0, device::bitpos::B0, false> LED;
	typedef device::SCI1 SCI_CH;
#elif defined(SIG_RX71M)
	static const char* system_str_ = { "RX71M DIY" };
	typedef device::PORT<device::PORT0, device::bitpos::B7, false> LED;
	typedef device::SCI1 SCI_CH;
#elif defined(SIG_RX64M)
	static const char* system_str_ = { "RX64M DIY" };
	typedef device::PORT<device::PORT0, device::bitpos::B7, false> LED;
	typedef device::SCI1 SCI_CH;
#elif defined(SIG_RX65N)
	static const char* system_str_ = { "RX65N Envision Kit" };
	typedef device::PORT<device::PORT7, device::bitpos::B0, false> LED;
	typedef device::SCI9 SCI_CH;
#elif defined(SIG_RX66T)
	static const char* system_str_ = { "RX66T DIY" };
	typedef device::PORT<device::PORT0, device::bitpos::B0, false> LED;
	typedef device::SCI1 SCI_CH;
#elif defined(SIG_RX72T)
	static const char* system_str_ = { "RX72T DIY" };
	typedef device::PORT<device::PORT0, device::bitpos::B1, false> LED;
	typedef device::SCI1 SCI_CH;
#elif defined(SIG_RX72N)
	static const char* system_str_ = { "RX72N Envision Kit" };
	typedef device::PORT<device::PORT4, device::bitpos::B0, false> LED;
	typedef device::SCI2 SCI_CH;
#endif

	typedef utils::fixed_fifo<char, 512> RXB;  // RX (受信) バッファの定義
	typedef utils::fixed_fifo<char, 256> TXB;  // TX (送信) バッファの定義

	typedef device::sci_io<SCI_CH, RXB, TXB> SCI;
// SCI ポートの第二候補を選択する場合
//	typedef device::sci_io<SCI_CH, RXB, TXB, device::port_map::ORDER::SECOND> SCI;
	SCI		sci_;

	typedef device::cmt_mgr<device::CMT0> CMT;
	CMT		cmt_;

	typedef utils::command<256> CMD;
	CMD 	cmd_;
}

extern "C" {

	// syscalls.c から呼ばれる、標準出力（stdout, stderr）
	void sci_putch(char ch)
	{
		sci_.putch(ch);
	}

	void sci_puts(const char* str)
	{
		sci_.puts(str);
	}

	// syscalls.c から呼ばれる、標準入力（stdin）
	char sci_getch(void)
	{
		return sci_.getch();
	}

	uint16_t sci_length()
	{
		return sci_.recv_length();
	}
}

int main(int argc, char** argv);

int main(int argc, char** argv)
{
	SYSTEM_IO::boost_master_clock();

	{  // タイマー設定（100Hz）
		uint8_t intr = 4;
		cmt_.start(100, intr);
	}

	{  // SCI の開始
		uint8_t intr = 2;        // 割り込みレベル（０を指定すると、ポーリング動作になる）
		uint32_t baud = 115200;  // ボーレート（任意の整数値を指定可能）
		sci_.start(baud, intr);  // 標準では、８ビット、１ストップビットを選択
// 通信プロトコルを設定する場合は、通信プロトコルのタイプを指定する事が出来る。
// sci_io.hpp PROTOCOL enum class のタイプを参照
//		sci_.start(baud, intr, SCI::PROTOCOL::B8_E_1S);
	}

	auto clk = device::clock_profile::ICLK / 1'000'000;
	utils::format("\nStart SCI (UART) sample for '%s' %d[MHz]\n") % system_str_ % clk;

	LED::DIR = 1;
	LED::P = 0;

	{  // SCI/CMT の設定レポート表示
		utils::format("SCI PCLK: %u\n") % SCI_CH::PCLK;
		utils::format("SCI Baud rate (set):  %u\n") % sci_.get_baud_rate();
		float rate = 1.0f - static_cast<float>(sci_.get_baud_rate()) / sci_.get_baud_rate(true);
		rate *= 100.0f;
		utils::format("  Baud rate (real): %u (%3.2f [%%])\n") % sci_.get_baud_rate(true) % rate;
		utils::format("  SEMR_BRME: %s\n") % utils::str::get_bool_text(SCI_CH::SEMR_BRME);
		utils::format("  SEMR_BGDM: %s\n") % utils::str::get_bool_text(SCI_CH::SEMR_BGDM);
		utils::format("CMT Timer (set):  %d [Hz]\n") % cmt_.get_rate();
		rate = 1.0f - static_cast<float>(cmt_.get_rate()) / cmt_.get_rate(true);
		rate *= 100.0f;
		utils::format("  Timer (real): %d [Hz] (%3.2f [%%])\n") % cmt_.get_rate(true) % rate;
	}

	cmd_.set_prompt("# ");

	uint8_t cnt = 0;
	while(1) {

		cmt_.sync();

		if(cmd_.service()) {
			uint32_t cmdn = cmd_.get_words();
			uint32_t n = 0;
			while(n < cmdn) {
				char tmp[256];
				if(cmd_.get_word(n, tmp, sizeof(tmp))) {
					utils::format("Param%d: '%s'\n") % n % tmp;
				}
				++n;
			}
		}

		++cnt;
		if(cnt >= 50) {
			cnt = 0;
		}
		if(cnt < 25) {
			LED::P = 0;
		} else {
			LED::P = 1;
		}
	}
}
<commit_msg>Update: add debug-monitor<commit_after>//=====================================================================//
/*! @file
    @brief  SCI (UART) サンプル
    @author 平松邦仁 (hira@rvf-rc45.net)
	@copyright	Copyright (C) 2018, 2022 Kunihito Hiramatsu @n
				Released under the MIT license @n
				https://github.com/hirakuni45/RX/blob/master/LICENSE
*/
//=====================================================================//
#include "common/renesas.hpp"

#include "common/fixed_fifo.hpp"
#include "common/sci_io.hpp"
#include "common/cmt_mgr.hpp"
#include "common/command.hpp"

#include "common/format.hpp"
#include "common/input.hpp"

#include "common/monitor.hpp"

// debug monitor を有効にする場合
#define MEMORY_MONITOR

namespace {

#if defined(SIG_RX63T)
	// DIY RX63T board
	static const char* system_str_ = { "RX63T DIY" };
	static constexpr bool LED_ACTIVE = 0;
	typedef device::PORT<device::PORTB, device::bitpos::B7, LED_ACTIVE> LED;
	typedef device::SCI1 SCI_CH;
#elif defined(SIG_RX62N)
  #if defined(CQ_FRK)
    // FRK-RX62N(CQ 出版社)
	static const char* system_str_ = { "RX62N FRK-RX62N" };
	static constexpr bool LED_ACTIVE = 0;
	typedef device::PORT<device::PORT1, device::bitpos::B5, LED_ACTIVE> LED;
	typedef device::SCI1 SCI_CH;
  #else
    // BlueBoard-RX62N_100pin
	static const char* system_str_ = { "RX62N BlueBoard-RX62N_100pin" };
	static constexpr bool LED_ACTIVE = 0;
	typedef device::PORT<device::PORT0, device::bitpos::B5, LED_ACTIVE> LED;
	typedef device::SCI1 SCI_CH;
  #endif
#elif defined(SIG_RX24T)
	static const char* system_str_ = { "RX24T DIY" };
	static constexpr bool LED_ACTIVE = 0;
	typedef device::PORT<device::PORT0, device::bitpos::B0, LED_ACTIVE> LED;
	typedef device::SCI1 SCI_CH;
#elif defined(SIG_RX71M)
	static const char* system_str_ = { "RX71M DIY" };
	static constexpr bool LED_ACTIVE = 0;
	typedef device::PORT<device::PORT0, device::bitpos::B7, LED_ACTIVE> LED;
	typedef device::SCI1 SCI_CH;
#elif defined(SIG_RX64M)
	static const char* system_str_ = { "RX64M DIY" };
	static constexpr bool LED_ACTIVE = 0;
	typedef device::PORT<device::PORT0, device::bitpos::B7, LED_ACTIVE> LED;
	typedef device::SCI1 SCI_CH;
#elif defined(SIG_RX65N)
	static const char* system_str_ = { "RX65N Envision Kit" };
	static constexpr bool LED_ACTIVE = 0;
	typedef device::PORT<device::PORT7, device::bitpos::B0, LED_ACTIVE> LED;
	typedef device::SCI9 SCI_CH;
#elif defined(SIG_RX66T)
	static const char* system_str_ = { "RX66T DIY" };
	static constexpr bool LED_ACTIVE = 0;
	typedef device::PORT<device::PORT0, device::bitpos::B0, LED_ACTIVE> LED;
	typedef device::SCI1 SCI_CH;
#elif defined(SIG_RX72T)
	static const char* system_str_ = { "RX72T DIY" };
	static constexpr bool LED_ACTIVE = 0;
	typedef device::PORT<device::PORT0, device::bitpos::B1, LED_ACTIVE> LED;
	typedef device::SCI1 SCI_CH;
#elif defined(SIG_RX72N)
	static const char* system_str_ = { "RX72N Envision Kit" };
	static constexpr bool LED_ACTIVE = 0;
	typedef device::PORT<device::PORT4, device::bitpos::B0, LED_ACTIVE> LED;
	typedef device::SCI2 SCI_CH;
#endif

	typedef utils::fixed_fifo<char, 512> RXB;  // RX (受信) バッファの定義
	typedef utils::fixed_fifo<char, 256> TXB;  // TX (送信) バッファの定義

	typedef device::sci_io<SCI_CH, RXB, TXB> SCI;
// SCI ポートの第二候補を選択する場合
//	typedef device::sci_io<SCI_CH, RXB, TXB, device::port_map::ORDER::SECOND> SCI;
	SCI		sci_;

	typedef device::cmt_mgr<device::CMT0> CMT;
	CMT		cmt_;

#ifdef MEMORY_MONITOR
	static constexpr uint32_t S_NUM = 64;
	typedef utils::monitor<S_NUM> MONITOR;
	MONITOR	monitor_;
#else
	typedef utils::command<256> CMD;
	CMD 	cmd_;
#endif
}

extern "C" {

	// syscalls.c から呼ばれる、標準出力（stdout, stderr）
	void sci_putch(char ch)
	{
		sci_.putch(ch);
	}

	void sci_puts(const char* str)
	{
		sci_.puts(str);
	}

	// syscalls.c から呼ばれる、標準入力（stdin）
	char sci_getch(void)
	{
		return sci_.getch();
	}

	uint16_t sci_length()
	{
		return sci_.recv_length();
	}
}

int main(int argc, char** argv);

int main(int argc, char** argv)
{
	SYSTEM_IO::boost_master_clock();

	{  // タイマー設定（100Hz）
		uint8_t intr = 4;
		cmt_.start(100, intr);
	}

	{  // SCI の開始
		uint8_t intr = 2;        // 割り込みレベル（０を指定すると、ポーリング動作になる）
		uint32_t baud = 115200;  // ボーレート（任意の整数値を指定可能）
		sci_.start(baud, intr);  // 標準では、８ビット、１ストップビットを選択
// 通信プロトコルを設定する場合は、通信プロトコルのタイプを指定する事が出来る。
// sci_io.hpp PROTOCOL enum class のタイプを参照
//		sci_.start(baud, intr, SCI::PROTOCOL::B8_E_1S);
	}

	auto clk = device::clock_profile::ICLK / 1'000'000;
	utils::format("\nStart SCI (UART) sample for '%s' %d[MHz]\n") % system_str_ % clk;

	LED::DIR = 1;
	LED::P = 0;

	{  // SCI/CMT の設定レポート表示
		utils::format("SCI PCLK: %u\n") % SCI_CH::PCLK;
		utils::format("SCI Baud rate (set):  %u\n") % sci_.get_baud_rate();
		float rate = 1.0f - static_cast<float>(sci_.get_baud_rate()) / sci_.get_baud_rate(true);
		rate *= 100.0f;
		utils::format("  Baud rate (real): %u (%3.2f [%%])\n") % sci_.get_baud_rate(true) % rate;
		utils::format("  SEMR_BRME: %s\n") % utils::str::get_bool_text(SCI_CH::SEMR_BRME);
		utils::format("  SEMR_BGDM: %s\n") % utils::str::get_bool_text(SCI_CH::SEMR_BGDM);
		utils::format("CMT Timer (set):  %d [Hz]\n") % cmt_.get_rate();
		rate = 1.0f - static_cast<float>(cmt_.get_rate()) / cmt_.get_rate(true);
		rate *= 100.0f;
		utils::format("  Timer (real): %d [Hz] (%3.2f [%%])\n") % cmt_.get_rate(true) % rate;
	}

#ifndef MEMORY_MONITOR
	cmd_.set_prompt("# ");
#endif

	uint8_t cnt = 0;
	while(1) {

		cmt_.sync();
#ifdef MEMORY_MONITOR
		monitor_.service();
#else
		if(cmd_.service()) {
			uint32_t cmdn = cmd_.get_words();
			uint32_t n = 0;
			while(n < cmdn) {
				char tmp[256];
				if(cmd_.get_word(n, tmp, sizeof(tmp))) {
					utils::format("Param%d: '%s'\n") % n % tmp;
				}
				++n;
			}
		}
#endif
		++cnt;
		if(cnt >= 50) {
			cnt = 0;
		}
		if(cnt < 25) {
			LED::P = 0;
		} else {
			LED::P = 1;
		}
	}
}
<|endoftext|>


<commit_before>/**
 *  \file RMF/Category.h
 *  \brief Handle read/write of Model data from/to files.
 *
 *  Copyright 2007-2013 IMP Inventors. All rights reserved.
 *
 */

#include "RMF/utility.h"

#include <boost/shared_ptr.hpp>
#include <algorithm>
#include <iostream>
#include <string>

#include "RMF/FileConstHandle.h"
#include "RMF/FileHandle.h"
#include "RMF/NodeConstHandle.h"
#include "RMF/NodeHandle.h"
#include "RMF/compiler_macros.h"
#include "RMF/decorator/alias.h"
#include "RMF/decorator/physics.h"
#include "RMF/decorator/shape.h"
#include "RMF/CoordinateTransformer.h"
#include "RMF/exceptions.h"
#include "RMF/infrastructure_macros.h"
#include "RMF/internal/utility.h"
#include "RMF/utility.h"
#include "internal/clone_shared_data.h"
#include "internal/shared_data_equality.h"
#include <boost/range/algorithm/max_element.hpp>
#include <limits>

RMF_ENABLE_WARNINGS

namespace RMF {

void clone_file_info(FileConstHandle input, FileHandle output) {
  internal::clone_file(input.shared_.get(), output.shared_.get());
}

void clone_hierarchy(FileConstHandle input, FileHandle output) {
  internal::clone_hierarchy(input.shared_.get(), output.shared_.get());
}

void clone_loaded_frame(FileConstHandle input, FileHandle output) {
  internal::clone_loaded_data(input.shared_.get(), output.shared_.get());
}

void clone_static_frame(FileConstHandle input, FileHandle output) {
  internal::clone_static_data(input.shared_.get(), output.shared_.get());
}

namespace {
bool get_equal_node_structure(NodeConstHandle in, NodeConstHandle out,
                              bool print_diff) {
  bool ret = true;
  if (in.get_type() != out.get_type()) {
    if (print_diff) {
      std::cout << "Node types differ at " << in << " vs " << out << std::endl;
    }
    ret = false;
  }
  if (in.get_name() != out.get_name()) {
    if (print_diff) {
      std::cout << "Node names differ at " << in << " vs " << out << std::endl;
    }
    ret = false;
  }
  NodeConstHandles inch = in.get_children();
  NodeConstHandles outch = out.get_children();
  if (inch.size() != outch.size()) {
    if (print_diff) {
      std::cout << "Node number of children differ at " << in << " vs " << out
                << std::endl;
    }
    ret = false;
  }
  for (unsigned int i = 0; i < std::min(inch.size(), outch.size()); ++i) {
    ret = get_equal_node_structure(inch[i], outch[i], print_diff) && ret;
  }
  return ret;
}
}

bool get_equal_structure(FileConstHandle in, FileConstHandle out,
                         bool print_diff) {
  bool ret = true;
  ret = get_equal_node_structure(in.get_root_node(), out.get_root_node(),
                                 print_diff) &&
        ret;
  return ret;
}

bool get_equal_current_values(FileConstHandle in, FileConstHandle out) {
  return internal::get_equal_current_values(in.shared_.get(),
                                            out.shared_.get());
}

bool get_equal_static_values(FileConstHandle in, FileConstHandle out) {
  return internal::get_equal_static_values(in.shared_.get(), out.shared_.get());
}

void add_child_alias(decorator::AliasFactory af, NodeHandle parent,
                     NodeConstHandle child) {
  internal::add_child_alias(af, parent, child);
}

void test_throw_exception() {
  RMF_THROW(Message("Test exception"), UsageException);
}

namespace {
void handle_vector(const CoordinateTransformer &tr, const Vector3 &v, float r,
                   boost::array<RMF::Vector3, 2> &bb) {
  Vector3 trv = tr.get_global_coordinates(v);
  for (unsigned int i = 0; i < 3; ++i) {
    bb[0][i] = std::min(v[i] - r, bb[0][i]);
    bb[1][i] = std::max(v[i] + r, bb[1][i]);
  }
}
void get_bounding_box_impl(NodeConstHandle root, CoordinateTransformer tr,
                           decorator::IntermediateParticleFactory ipf,
                           decorator::BallFactory bf,
                           decorator::SegmentFactory sf,
                           decorator::CylinderFactory cf,
                           decorator::GaussianParticleFactory gpf,
                           decorator::ReferenceFrameFactory rff,
                           boost::array<RMF::Vector3, 2> &bb) {
  if (rff.get_is(root)) {
    tr = CoordinateTransformer(tr, rff.get(root));
  }
  if (ipf.get_is(root)) {
    RMF::decorator::IntermediateParticleConst pc = ipf.get(root);
    double r = pc.get_radius();
    RMF::Vector3 c = pc.get_coordinates();
    handle_vector(tr, c, r, bb);
  }
  if (gpf.get_is(root)) {
    handle_vector(tr, Vector3(0, 0, 0),
                  *boost::max_element(gpf.get(root).get_variances()) * 5, bb);
  }
  if (bf.get_is(root)) {
    handle_vector(tr, bf.get(root).get_coordinates(), bf.get(root).get_radius(),
                  bb);
  }
  if (sf.get_is(root)) {
    RMF_FOREACH(const Vector3 & v, sf.get(root).get_coordinates_list()) {
      handle_vector(tr, v, cf.get_is(root) ? cf.get(root).get_radius() : 0.0f,
                    bb);
    }
  }
  RMF_FOREACH(NodeConstHandle ch, root.get_children()) {
    get_bounding_box_impl(ch, tr, ipf, bf, sf, cf, gpf, rff, bb);
  }
}
}

boost::array<RMF::Vector3, 2> get_bounding_box(NodeConstHandle root) {
  boost::array<RMF::Vector3, 2> ret;
  float v = std::numeric_limits<float>::max();
  ret[0] = RMF::Vector3(v, v, v);
  ret[1] = RMF::Vector3(-v, -v, -v);
  FileConstHandle fh = root.get_file();
  get_bounding_box_impl(
      root, CoordinateTransformer(), decorator::IntermediateParticleFactory(fh),
      decorator::BallFactory(fh), decorator::SegmentFactory(fh),
      decorator::CylinderFactory(fh), decorator::GaussianParticleFactory(fh),
      decorator::ReferenceFrameFactory(fh), ret);
  return ret;
}

float get_diameter(NodeConstHandle root) {
  boost::array<RMF::Vector3, 2> bb = get_bounding_box(root);
  float max = 0;
  for (unsigned int i = 0; i < 3; ++i) {
    max = std::max(bb[1][i] - bb[0][i], max);
  }
  return max;
}

} /* namespace RMF */

RMF_DISABLE_WARNINGS
<commit_msg>fix compilation on old boost<commit_after>/**
 *  \file RMF/Category.h
 *  \brief Handle read/write of Model data from/to files.
 *
 *  Copyright 2007-2013 IMP Inventors. All rights reserved.
 *
 */

#include "RMF/utility.h"

#include <boost/shared_ptr.hpp>
#include <algorithm>
#include <iostream>
#include <string>

#include "RMF/FileConstHandle.h"
#include "RMF/FileHandle.h"
#include "RMF/NodeConstHandle.h"
#include "RMF/NodeHandle.h"
#include "RMF/compiler_macros.h"
#include "RMF/decorator/alias.h"
#include "RMF/decorator/physics.h"
#include "RMF/decorator/shape.h"
#include "RMF/CoordinateTransformer.h"
#include "RMF/exceptions.h"
#include "RMF/infrastructure_macros.h"
#include "RMF/internal/utility.h"
#include "RMF/utility.h"
#include "internal/clone_shared_data.h"
#include "internal/shared_data_equality.h"
#include <limits>

RMF_ENABLE_WARNINGS

namespace RMF {

void clone_file_info(FileConstHandle input, FileHandle output) {
  internal::clone_file(input.shared_.get(), output.shared_.get());
}

void clone_hierarchy(FileConstHandle input, FileHandle output) {
  internal::clone_hierarchy(input.shared_.get(), output.shared_.get());
}

void clone_loaded_frame(FileConstHandle input, FileHandle output) {
  internal::clone_loaded_data(input.shared_.get(), output.shared_.get());
}

void clone_static_frame(FileConstHandle input, FileHandle output) {
  internal::clone_static_data(input.shared_.get(), output.shared_.get());
}

namespace {
bool get_equal_node_structure(NodeConstHandle in, NodeConstHandle out,
                              bool print_diff) {
  bool ret = true;
  if (in.get_type() != out.get_type()) {
    if (print_diff) {
      std::cout << "Node types differ at " << in << " vs " << out << std::endl;
    }
    ret = false;
  }
  if (in.get_name() != out.get_name()) {
    if (print_diff) {
      std::cout << "Node names differ at " << in << " vs " << out << std::endl;
    }
    ret = false;
  }
  NodeConstHandles inch = in.get_children();
  NodeConstHandles outch = out.get_children();
  if (inch.size() != outch.size()) {
    if (print_diff) {
      std::cout << "Node number of children differ at " << in << " vs " << out
                << std::endl;
    }
    ret = false;
  }
  for (unsigned int i = 0; i < std::min(inch.size(), outch.size()); ++i) {
    ret = get_equal_node_structure(inch[i], outch[i], print_diff) && ret;
  }
  return ret;
}
}

bool get_equal_structure(FileConstHandle in, FileConstHandle out,
                         bool print_diff) {
  bool ret = true;
  ret = get_equal_node_structure(in.get_root_node(), out.get_root_node(),
                                 print_diff) &&
        ret;
  return ret;
}

bool get_equal_current_values(FileConstHandle in, FileConstHandle out) {
  return internal::get_equal_current_values(in.shared_.get(),
                                            out.shared_.get());
}

bool get_equal_static_values(FileConstHandle in, FileConstHandle out) {
  return internal::get_equal_static_values(in.shared_.get(), out.shared_.get());
}

void add_child_alias(decorator::AliasFactory af, NodeHandle parent,
                     NodeConstHandle child) {
  internal::add_child_alias(af, parent, child);
}

void test_throw_exception() {
  RMF_THROW(Message("Test exception"), UsageException);
}

namespace {
void handle_vector(const CoordinateTransformer &tr, const Vector3 &v, float r,
                   boost::array<RMF::Vector3, 2> &bb) {
  Vector3 trv = tr.get_global_coordinates(v);
  for (unsigned int i = 0; i < 3; ++i) {
    bb[0][i] = std::min(trv[i] - r, bb[0][i]);
    bb[1][i] = std::max(trv[i] + r, bb[1][i]);
  }
}
void get_bounding_box_impl(NodeConstHandle root, CoordinateTransformer tr,
                           decorator::IntermediateParticleFactory ipf,
                           decorator::BallFactory bf,
                           decorator::SegmentFactory sf,
                           decorator::CylinderFactory cf,
                           decorator::GaussianParticleFactory gpf,
                           decorator::ReferenceFrameFactory rff,
                           boost::array<RMF::Vector3, 2> &bb) {
  if (rff.get_is(root)) {
    tr = CoordinateTransformer(tr, rff.get(root));
  }
  if (ipf.get_is(root)) {
    RMF::decorator::IntermediateParticleConst pc = ipf.get(root);
    double r = pc.get_radius();
    RMF::Vector3 c = pc.get_coordinates();
    handle_vector(tr, c, r, bb);
  }
  if (gpf.get_is(root)) {
    Vector3 var = gpf.get(root).get_variances();
    handle_vector(tr, Vector3(0, 0, 0),
                  *std::max_element(var.begin(), var.end()) * 5, bb);
  }
  if (bf.get_is(root)) {
    handle_vector(tr, bf.get(root).get_coordinates(), bf.get(root).get_radius(),
                  bb);
  }
  if (sf.get_is(root)) {
    RMF_FOREACH(const Vector3 & v, sf.get(root).get_coordinates_list()) {
      handle_vector(tr, v, cf.get_is(root) ? cf.get(root).get_radius() : 0.0f,
                    bb);
    }
  }
  RMF_FOREACH(NodeConstHandle ch, root.get_children()) {
    get_bounding_box_impl(ch, tr, ipf, bf, sf, cf, gpf, rff, bb);
  }
}
}

boost::array<RMF::Vector3, 2> get_bounding_box(NodeConstHandle root) {
  boost::array<RMF::Vector3, 2> ret;
  float v = std::numeric_limits<float>::max();
  ret[0] = RMF::Vector3(v, v, v);
  ret[1] = RMF::Vector3(-v, -v, -v);
  FileConstHandle fh = root.get_file();
  get_bounding_box_impl(
      root, CoordinateTransformer(), decorator::IntermediateParticleFactory(fh),
      decorator::BallFactory(fh), decorator::SegmentFactory(fh),
      decorator::CylinderFactory(fh), decorator::GaussianParticleFactory(fh),
      decorator::ReferenceFrameFactory(fh), ret);
  return ret;
}

float get_diameter(NodeConstHandle root) {
  boost::array<RMF::Vector3, 2> bb = get_bounding_box(root);
  float max = 0;
  for (unsigned int i = 0; i < 3; ++i) {
    max = std::max(bb[1][i] - bb[0][i], max);
  }
  return max;
}

} /* namespace RMF */

RMF_DISABLE_WARNINGS
<|endoftext|>


<commit_before>#include <unistd.h>
#include <cassert>
#include <boost/utility/binary.hpp>
#include <boost/shared_ptr.hpp>

#include "gen-cpp/Barista.h"
#include <thrift/transport/TSocket.h>
#include <thrift/transport/TBufferTransports.h>
#include <thrift/protocol/TBinaryProtocol.h>

/**
 * Sample Barista C++ Client
 *
 * @author anantb
 * @date 11/07/2013
 *
 */

using namespace std;
using namespace boost;
using namespace apache::thrift;
using namespace apache::thrift::protocol;
using namespace apache::thrift::transport;

using namespace barista;

int main () {
  try {
    boost::shared_ptr<TSocket> transport(new TSocket("128.52.161.243", 9000));
    shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
    BaristaClient client(protocol);

    transport->open();
    double version = client.get_version();
    cout << version << endl;

    ConnectionParams con_params = ConnectionParams();
    con_params.__set_user("postgres");
    con_params.__set_password("postgres");
    con_params.__set_database("postgres");

    Connection con;
    client.open_connection(con, con_params);
    ResultSet res;
    client.execute_sql(res, con, "SELECT 6.824 as id, 'Distributed Systems' as name", vector<string>());
    for(vector<Tuples>::iterator tuple_it = res.tuples.begin(); row_it != res.tuples.end(); ++tuple_it) {
      for(vector<BOOST_BINARY>::iterator cell_it = (*tuple_it).cells.begin(); cell_it != (*tuple_it).cells.end(); ++cell_it) {
        cout << *cell_it << "\t";
      }
      cout << "\n";
    }
    client.close_connection(con);
    transport->close();
  } catch (TException &tx) {
    cout << "ERROR: " << tx.what();
  }

  return 0;
}
<commit_msg>complete barista client<commit_after>#include <unistd.h>
#include <cassert>
#include <boost/utility/binary.hpp>
#include <boost/shared_ptr.hpp>

#include "gen-cpp/Barista.h"
#include <thrift/transport/TSocket.h>
#include <thrift/transport/TBufferTransports.h>
#include <thrift/protocol/TBinaryProtocol.h>

/**
 * Sample Barista C++ Client
 *
 * @author anantb
 * @date 11/07/2013
 *
 */

using namespace std;
using namespace boost;
using namespace apache::thrift;
using namespace apache::thrift::protocol;
using namespace apache::thrift::transport;

using namespace barista;

int main () {
  try {
    boost::shared_ptr<TSocket> transport(new TSocket("128.52.161.243", 9000));
    shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
    BaristaClient client(protocol);

    transport->open();
    double version = client.get_version();
    cout << version << endl;

    ConnectionParams con_params = ConnectionParams();
    con_params.__set_user("postgres");
    con_params.__set_password("postgres");
    con_params.__set_database("postgres");

    Connection con;
    client.open_connection(con, con_params);
    ResultSet res;
    client.execute_sql(res, con, "SELECT 6.824 as id, 'Distributed Systems' as name", vector<string>());
    for(vector<Tuple>::iterator tuple_it = res.tuples.begin(); row_it != res.tuples.end(); ++tuple_it) {
      for(vector<BOOST_BINARY>::iterator cell_it = (*tuple_it).cells.begin(); cell_it != (*tuple_it).cells.end(); ++cell_it) {
        cout << *cell_it << "\t";
      }
      cout << "\n";
    }
    client.close_connection(con);
    transport->close();
  } catch (TException &tx) {
    cout << "ERROR: " << tx.what();
  }

  return 0;
}
<|endoftext|>


<commit_before>//
// Copyright (c) 2020 Andrii Verbytskyi <andrii.verbytskyi@mpp.mpg.de> for the binder project
//
// All rights reserved. Use of this source code is governed by a
// MIT license that can be found in the LICENSE file.
/// This is a simple and portable implementation of diff utility for the binder CI
/// that should ignore certain patters.
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <vector>
#include <string.h>

/// Function that checks if the line should be skipped in the comparison.
/// It is indicated with a non-zero return code.
/// The function checks the presence of variable or semantically unimportant strings in the line.
/// These can be comments, the absolute paths of the sources and some codes that rely on the implementation of the STL.
int skip(std::string const & s1)
{
    if (s1.length()==0) return 1;
    if (s1.length()>1)
    {
        size_t comment=s1.find_first_of("//");
        if (comment==s1.find_first_not_of(" \t")&&comment!=std::string::npos) return 2; //The comments should be ignored
    }
    if (s1.find("Source list file")!=std::string::npos) return 3;       //Same as the list of source files
    if (s1.find("Modules list file")!=std::string::npos) return 4;      //Same as the list of modules
    if (s1.find("File:")!=std::string::npos) return 5;                  //Same as the full file paths.
    if (s1.find("pybind11::handle cl_type = cl;")!=std::string::npos) return 6;  //This could be optimized in binder
    if (s1.find("__cxx11")!=std::string::npos) return 7;                         //This looks like implementation dependent
    if (s1.find("assign")!=std::string::npos) return 8;                          // The assing is binded differently for some reasons
    if (s1.find("#include")!=std::string::npos) return 9;                        // Includes could differ
    if (s1.find("pybind11::gil_scoped_acquire gil;")!=std::string::npos) return 10; //This could be optimized in binder
    return 0;
}
/// This function strips the one-line C++ comments from the input and return the result.
std::string strip_comment(std::string const & s1)
{
    if (s1.empty()) return s1;
    size_t comment=s1.find_first_of("//");
    return s1.substr(0,comment);
}
/// This function compares the content of two files f1 and f2 using the
int compare_text_files(std::string const & f1,const std::string & f2)
{
    std::fstream file1(f1), file2(f2);
    std::string string1, string2;
    int j1=0,j2=0;
    if (!file1 || !file2 )
    {
            std::cout << "Cannot open one of files " << f1<<" or "<<f2<<"\n";
            return EXIT_FAILURE;
    }
    std::cout <<"Run comparison"<< "\n";
    while((!file1.eof())&&(!file2.eof()))
    {
        for (;;) {
            j1++;
            if (!std::getline(file1,string1)) break;
            if (skip(string1)==0) break;
        }
        for (;;) {
            j2++;
            if (!std::getline(file2,string2)) break;
            if (skip(string2)==0) break;
        }
        if(strip_comment(string1)!=strip_comment(string2))
        {
            std::cout << j1<<"/"<<j2 << "-th strings are not equal " << f1<<" "<<f2<<"\n";
            std::cout << "   ->" << string1 << "<-\n";
            std::cout << "   ->" << string2 << "<-\n";
            return EXIT_FAILURE;
        }
    }
    return EXIT_SUCCESS;
}
int main(int argc, char** argv)
{
    if (argc!=3&&argc!=4) {
        std::cout<<"Wrong number of arguments."<<std::endl;
        std::cout<<"Usage:        "<<argv[0]<<" <first file to compare> <second file to compare> [options]" <<std::endl;
        std::cout<<"Options:      --always-success     Optional. Perform comparison, but return 0 exit code regardless of the comparison result." <<std::endl;
        return EXIT_FAILURE;
    }
    if (argc==4)  {
        if (strcmp(argv[3],"--always-success")!=0)
        std::cout<<"Wrong option: "<<argv[3]<<std::endl;
        std::cout<<"Usage:        "<<argv[0]<<" <first file to compare> <second file to compare> [options]" <<std::endl;
        std::cout<<"Options:      --always-success     Optional. Perform comparison, but return 0 exit code regardless of the comparison result." <<std::endl;
        return EXIT_FAILURE;
    }
    int status=compare_text_files(argv[1],argv[2]);
    if (argc==4)  { if (strcmp(argv[3],"--always-success")==0)  return EXIT_SUCCESS; }
    return status;
}
<commit_msg>Fix compilation<commit_after>//
// Copyright (c) 2020 Andrii Verbytskyi <andrii.verbytskyi@mpp.mpg.de> for the binder project
//
// All rights reserved. Use of this source code is governed by a
// MIT license that can be found in the LICENSE file.
/// This is a simple and portable implementation of diff utility for the binder CI
/// that should ignore certain patters.
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <vector>
#include <string.h>

/// Function that checks if the line should be skipped in the comparison.
/// It is indicated with a non-zero return code.
/// The function checks the presence of variable or semantically unimportant strings in the line.
/// These can be comments, the absolute paths of the sources and some codes that rely on the implementation of the STL.
int skip(std::string const & s1)
{
    if (s1.length()==0) return 1;
    if (s1.length()>1)
    {
        size_t comment=s1.find_first_of("//");
        if (comment==s1.find_first_not_of(" \t")&&comment!=std::string::npos) return 2; //The comments should be ignored
    }
    if (s1.find("Source list file")!=std::string::npos) return 3;       //Same as the list of source files
    if (s1.find("Modules list file")!=std::string::npos) return 4;      //Same as the list of modules
    if (s1.find("File:")!=std::string::npos) return 5;                  //Same as the full file paths.
    if (s1.find("pybind11::handle cl_type = cl;")!=std::string::npos) return 6;  //This could be optimized in binder
    if (s1.find("__cxx11")!=std::string::npos) return 7;                         //This looks like implementation dependent
    if (s1.find("assign")!=std::string::npos) return 8;                          // The assing is binded differently for some reasons
    if (s1.find("#include")!=std::string::npos) return 9;                        // Includes could differ
    if (s1.find("pybind11::gil_scoped_acquire gil;")!=std::string::npos) return 10; //This could be optimized in binder
    return 0;
}
/// This function strips the one-line C++ comments from the input and return the result.
std::string strip_comment(std::string const & s1)
{
    if (s1.empty()) return s1;
    size_t comment=s1.find_first_of("//");
    return s1.substr(0,comment);
}
/// This function compares the content of two files f1 and f2 using the
int compare_text_files(std::string const & f1,const std::string & f2)
{
    std::fstream file1(f1), file2(f2);
    std::string string1, string2;
    int j1=0,j2=0;
    if (!file1 || !file2 )
    {
            std::cout << "Cannot open one of files " << f1<<" or "<<f2<<"\n";
            return EXIT_FAILURE;
    }
    std::cout <<"Run comparison"<< "\n";
    while((!file1.eof())&&(!file2.eof()))
    {
        for (;;) {
            j1++;
            if (!std::getline(file1,string1)) break;
            if (skip(string1)==0) break;
        }
        for (;;) {
            j2++;
            if (!std::getline(file2,string2)) break;
            if (skip(string2)==0) break;
        }
        if(strip_comment(string1)!=strip_comment(string2))
        {
            std::cout << j1<<"/"<<j2 << "-th strings are not equal " << f1<<" "<<f2<<"\n";
            std::cout << "   ->" << string1 << "<-\n";
            std::cout << "   ->" << string2 << "<-\n";
            return EXIT_FAILURE;
        }
    }
    return EXIT_SUCCESS;
}
int main(int argc, char** argv)
{
    if (argc!=3&&argc!=4) {
        std::cout<<"Wrong number of arguments."<<std::endl;
        std::cout<<"Usage:        "<<argv[0]<<" <first file to compare> <second file to compare> [options]" <<std::endl;
        std::cout<<"Options:      --always-success     Optional. Perform comparison, but return 0 exit code regardless of the comparison result." <<std::endl;
        return EXIT_FAILURE;
    }
    if (argc==4)  {
        if (strcmp(argv[3],"--always-success")!=0) {
          std::cout<<"Wrong option: "<<argv[3]<<std::endl;
          std::cout<<"Usage:        "<<argv[0]<<" <first file to compare> <second file to compare> [options]" <<std::endl;
          std::cout<<"Options:      --always-success     Optional. Perform comparison, but return 0 exit code regardless of the comparison result." <<std::endl;
          return EXIT_FAILURE;
        }
    }
    int status=compare_text_files(argv[1],argv[2]);
    if (argc==4)  { if (strcmp(argv[3],"--always-success")==0)  return EXIT_SUCCESS; }
    return status;
}
<|endoftext|>


<commit_before>/*
 * Copyright (c) 2015, Michael Feathers, James Grenning, Bas Vodde
 * and Arnd R. Strube. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of the <organization> nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include "CppUTest/TestHarness.h"
#include "CppUTestExt/IEEE754ExceptionsPlugin.h"

#ifdef CPPUTEST_HAVE_FENV

extern "C" {
    #include <fenv.h>
}

#define IEEE754_CHECK_CLEAR(test, result, flag) ieee754Check(test, result, flag, #flag)

bool IEEE754ExceptionsPlugin::inexactDisabled_ = true;

IEEE754ExceptionsPlugin::IEEE754ExceptionsPlugin(const SimpleString& name)
    : TestPlugin(name)
{
}

void IEEE754ExceptionsPlugin::preTestAction(UtestShell&, TestResult&)
{
    CHECK(!feclearexcept(FE_ALL_EXCEPT));
}

void IEEE754ExceptionsPlugin::postTestAction(UtestShell& test, TestResult& result)
{
    if(!test.hasFailed()) {
        IEEE754_CHECK_CLEAR(test, result, FE_DIVBYZERO);
        IEEE754_CHECK_CLEAR(test, result, FE_OVERFLOW);
        IEEE754_CHECK_CLEAR(test, result, FE_UNDERFLOW);
        IEEE754_CHECK_CLEAR(test, result, FE_INVALID);
        IEEE754_CHECK_CLEAR(test, result, FE_INEXACT);
    }
}

void IEEE754ExceptionsPlugin::disableInexact()
{
    inexactDisabled_ = true;
}

void IEEE754ExceptionsPlugin::enableInexact()
{
    inexactDisabled_ = false;
}

void IEEE754ExceptionsPlugin::ieee754Check(UtestShell& test, TestResult& result, int flag, const char* text)
{
    result.countCheck();
    if(inexactDisabled_) feclearexcept(FE_INEXACT);
    if(fetestexcept(flag)) {
        CHECK(!feclearexcept(FE_ALL_EXCEPT));
        CheckFailure failure(&test, __FILE__, __LINE__, "IEEE754_CHECK_CLEAR", text);
        result.addFailure(failure);
    }
}

#endif
<commit_msg>Add missing CHECK<commit_after>/*
 * Copyright (c) 2015, Michael Feathers, James Grenning, Bas Vodde
 * and Arnd R. Strube. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of the <organization> nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include "CppUTest/TestHarness.h"
#include "CppUTestExt/IEEE754ExceptionsPlugin.h"

#ifdef CPPUTEST_HAVE_FENV

extern "C" {
    #include <fenv.h>
}

#define IEEE754_CHECK_CLEAR(test, result, flag) ieee754Check(test, result, flag, #flag)

bool IEEE754ExceptionsPlugin::inexactDisabled_ = true;

IEEE754ExceptionsPlugin::IEEE754ExceptionsPlugin(const SimpleString& name)
    : TestPlugin(name)
{
}

void IEEE754ExceptionsPlugin::preTestAction(UtestShell&, TestResult&)
{
    CHECK(!feclearexcept(FE_ALL_EXCEPT));
}

void IEEE754ExceptionsPlugin::postTestAction(UtestShell& test, TestResult& result)
{
    if(!test.hasFailed()) {
        IEEE754_CHECK_CLEAR(test, result, FE_DIVBYZERO);
        IEEE754_CHECK_CLEAR(test, result, FE_OVERFLOW);
        IEEE754_CHECK_CLEAR(test, result, FE_UNDERFLOW);
        IEEE754_CHECK_CLEAR(test, result, FE_INVALID);
        IEEE754_CHECK_CLEAR(test, result, FE_INEXACT);
    }
}

void IEEE754ExceptionsPlugin::disableInexact()
{
    inexactDisabled_ = true;
}

void IEEE754ExceptionsPlugin::enableInexact()
{
    inexactDisabled_ = false;
}

void IEEE754ExceptionsPlugin::ieee754Check(UtestShell& test, TestResult& result, int flag, const char* text)
{
    result.countCheck();
    if(inexactDisabled_) CHECK(!feclearexcept(FE_INEXACT));
    if(fetestexcept(flag)) {
        CHECK(!feclearexcept(FE_ALL_EXCEPT));
        CheckFailure failure(&test, __FILE__, __LINE__, "IEEE754_CHECK_CLEAR", text);
        result.addFailure(failure);
    }
}

#endif
<|endoftext|>


<commit_before>/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

// Registers the XLA_INTERPRETER device which exposes the XLA Interpreter.

#include "tensorflow/compiler/jit/kernels/xla_launch_op.h"
#include "tensorflow/compiler/jit/xla_device.h"
#include "tensorflow/compiler/jit/xla_device_ops.h"
#include "tensorflow/compiler/tf2xla/xla_op_registry.h"

namespace tensorflow {

const char* const DEVICE_XLA_INTERPRETER = "XLA_INTERPRETER";
const char* const DEVICE_INTERPRETER_XLA_JIT = "XLA_INTERPRETER_JIT";

constexpr std::array<DataType, 6> kExecAllTypes = {
    {DT_INT32, DT_INT64, DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_BOOL}};

class XlaInterpreterDeviceFactory : public DeviceFactory {
 public:
  Status CreateDevices(const SessionOptions& options, const string& name_prefix,
                       std::vector<Device*>* devices) override;
};

Status XlaInterpreterDeviceFactory::CreateDevices(
    const SessionOptions& options, const string& name_prefix,
    std::vector<Device*>* devices) {
  static XlaDeviceOpRegistrations* registrations = RegisterXlaDeviceKernels(
      DEVICE_XLA_INTERPRETER, DEVICE_INTERPRETER_XLA_JIT);
  (void)registrations;

  XlaOpRegistry::DeviceRegistration registration;
  registration.compilation_device_name = DEVICE_INTERPRETER_XLA_JIT;
  registration.requires_compilation = true;
  registration.enable_jit_by_default = false;
  registration.compile_resource_ops = true;

  std::unique_ptr<XlaDevice> device;
  TF_RETURN_IF_ERROR(XlaDevice::Create("Interpreter", DEVICE_XLA_INTERPRETER, 0,
                                       DEVICE_INTERPRETER_XLA_JIT, options,
                                       name_prefix, registration,
                                       /*transfer_as_literal=*/false, &device));
  devices->push_back(device.release());
  return Status::OK();
}

// Set priority to be below the default priority (50), so that Interpreter is
// not selected as a high priority device over other default devices. See
// constructor comments for Registrar in
// tensorflow/core/common_runtime/device_factory.h for a list of priority for
// devices.
REGISTER_LOCAL_DEVICE_FACTORY(DEVICE_XLA_INTERPRETER,
                              XlaInterpreterDeviceFactory, 40);

// Kernel registrations
static bool OpFilter(KernelDef* kdef) { return true; }

REGISTER_XLA_LAUNCH_KERNEL(DEVICE_XLA_INTERPRETER, XlaLocalLaunchOp,
                           kExecAllTypes);
REGISTER_XLA_DEVICE_KERNELS(DEVICE_XLA_INTERPRETER, kExecAllTypes);
REGISTER_XLA_BACKEND(DEVICE_INTERPRETER_XLA_JIT, kExecAllTypes, OpFilter);

}  // namespace tensorflow
<commit_msg>[TF:XLA] Fix xla_interpreter_device build<commit_after>/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

// Registers the XLA_INTERPRETER device which exposes the XLA Interpreter.

#include "tensorflow/compiler/jit/kernels/xla_launch_op.h"
#include "tensorflow/compiler/jit/xla_device.h"
#include "tensorflow/compiler/jit/xla_device_ops.h"
#include "tensorflow/compiler/tf2xla/xla_op_registry.h"

namespace tensorflow {

const char* const DEVICE_XLA_INTERPRETER = "XLA_INTERPRETER";
const char* const DEVICE_INTERPRETER_XLA_JIT = "XLA_INTERPRETER_JIT";

constexpr std::array<DataType, 6> kExecAllTypes = {
    {DT_INT32, DT_INT64, DT_FLOAT, DT_DOUBLE, DT_COMPLEX64, DT_BOOL}};

class XlaInterpreterDeviceFactory : public DeviceFactory {
 public:
  Status CreateDevices(const SessionOptions& options, const string& name_prefix,
                       std::vector<Device*>* devices) override;
};

Status XlaInterpreterDeviceFactory::CreateDevices(
    const SessionOptions& options, const string& name_prefix,
    std::vector<Device*>* devices) {
  static XlaDeviceOpRegistrations* registrations = RegisterXlaDeviceKernels(
      DEVICE_XLA_INTERPRETER, DEVICE_INTERPRETER_XLA_JIT);
  (void)registrations;

  XlaOpRegistry::DeviceRegistration registration;
  registration.compilation_device_name = DEVICE_INTERPRETER_XLA_JIT;
  registration.requires_compilation = true;
  registration.enable_jit_by_default = false;
  registration.compile_resource_ops = true;

  std::unique_ptr<XlaDevice> device;
  TF_RETURN_IF_ERROR(XlaDevice::Create(
      "Interpreter", DEVICE_XLA_INTERPRETER, 0, DEVICE_INTERPRETER_XLA_JIT,
      options, name_prefix, registration,
      /*transfer_as_literal=*/false,
      /*shape_representation_fn=*/{}, &device));
  devices->push_back(device.release());
  return Status::OK();
}

// Set priority to be below the default priority (50), so that Interpreter is
// not selected as a high priority device over other default devices. See
// constructor comments for Registrar in
// tensorflow/core/common_runtime/device_factory.h for a list of priority for
// devices.
REGISTER_LOCAL_DEVICE_FACTORY(DEVICE_XLA_INTERPRETER,
                              XlaInterpreterDeviceFactory, 40);

// Kernel registrations
static bool OpFilter(KernelDef* kdef) { return true; }

REGISTER_XLA_LAUNCH_KERNEL(DEVICE_XLA_INTERPRETER, XlaLocalLaunchOp,
                           kExecAllTypes);
REGISTER_XLA_DEVICE_KERNELS(DEVICE_XLA_INTERPRETER, kExecAllTypes);
REGISTER_XLA_BACKEND(DEVICE_INTERPRETER_XLA_JIT, kExecAllTypes, OpFilter);

}  // namespace tensorflow
<|endoftext|>


<commit_before>/*****************************************************************************
 *
 * This file is part of Mapnik (c++ mapping toolkit)
 *
 * Copyright (C) 2006 Artem Pavlenko
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 *****************************************************************************/

//$Id: postgis.cc 44 2005-04-22 18:53:54Z pavlenko $

#include "postgis.hpp"
#include <string>
#include <algorithm>
#include <set>
#include <sstream>
#include "connection_manager.hpp"

DATASOURCE_PLUGIN(postgis_datasource)

    const std::string postgis_datasource::GEOMETRY_COLUMNS="geometry_columns";
const std::string postgis_datasource::SPATIAL_REF_SYS="spatial_ref_system";

using std::clog;
using std::clog;
using std::endl;

using boost::lexical_cast;
using boost::bad_lexical_cast;
using boost::shared_ptr;

postgis_datasource::postgis_datasource(const parameters& params)
    : datasource (params),
      table_(params.get("table")),
      type_(datasource::Vector),
      desc_(params.get("name")),
      creator_(params.get("host"),
               params.get("dbname"),
               params.get("user"),
               params.get("password"))

{
    ConnectionManager *mgr=ConnectionManager::instance();
    mgr->registerPool(creator_,10,20);

    shared_ptr<Pool<Connection,ConnectionCreator> > pool=mgr->getPool(creator_.id());
    if (pool)
    {
        const shared_ptr<Connection>& conn = pool->borrowObject();
        if (conn && conn->isOK())
        {
            PoolGuard<shared_ptr<Connection>,shared_ptr<Pool<Connection,ConnectionCreator> > > guard(conn,pool);

            std::string table_name=table_from_sql(table_);

            std::ostringstream s;
            s << "select f_geometry_column,srid,type from ";
            s << GEOMETRY_COLUMNS <<" where f_table_name='"<<table_name<<"'";

            shared_ptr<ResultSet> rs=conn->executeQuery(s.str());

            if (rs->next())
            {
                try
                {
                    srid_ = lexical_cast<int>(rs->getValue("srid"));
                    desc_.set_srid(srid_);
                }
                catch (bad_lexical_cast &ex)
                {
                    clog << ex.what() << endl;
                }
                geometryColumn_=rs->getValue("f_geometry_column");
                std::string postgisType=rs->getValue("type");
            }
            rs->close();
            s.str("");
            s << "select xmin(ext),ymin(ext),xmax(ext),ymax(ext)";
            s << " from (select estimated_extent('"<<table_name<<"','"<<geometryColumn_<<"') as ext) as tmp";

            rs=conn->executeQuery(s.str());
            if (rs->next())
            {
                try
                {
                    double lox=lexical_cast<double>(rs->getValue(0));
                    double loy=lexical_cast<double>(rs->getValue(1));
                    double hix=lexical_cast<double>(rs->getValue(2));
                    double hiy=lexical_cast<double>(rs->getValue(3));
                    extent_.init(lox,loy,hix,hiy);
                }
                catch (bad_lexical_cast &ex)
                {
                    clog << ex.what() << endl;
                }
            }
            rs->close();

            // collect attribute desc
            s.str("");
            s << "select * from "<<table_<<" limit 1";
            rs=conn->executeQuery(s.str());
            if (rs->next())
            {
                int count = rs->getNumFields();
                for (int i=0;i<count;++i)
                {
                    std::string fld_name=rs->getFieldName(i);
                    int length = rs->getFieldLength(i);

                    int type_oid = rs->getTypeOID(i);
                    switch (type_oid)
                    {
                    case 17285: // geometry
                        desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::Geometry));
                        break;
                    case 21:    // int2
                    case 23:    // int4
                        desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::Integer,false,length));
                        break;
                    case 701:  // float8
                        desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::Double,false,length));
                    case 1042:  // bpchar
                    case 1043:  // varchar
                        desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::String));
                        break;
                    default: // shouldn't get here
                        clog << "unknown type_oid="<<type_oid<<endl;
                        desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::String));
                        break;
                    }
                }
            }
        }
    }
}

std::string postgis_datasource::name_="postgis";

std::string postgis_datasource::name()
{
    return name_;
}

int postgis_datasource::type() const
{
    return type_;
}

layer_descriptor const& postgis_datasource::get_descriptor() const
{
    return desc_;
}

std::string postgis_datasource::table_from_sql(const std::string& sql)
{
    std::string table_name(sql);
    transform(table_name.begin(),table_name.end(),table_name.begin(),tolower);
    std::string::size_type idx=table_name.rfind("from");
    if (idx!=std::string::npos)
    {
        idx=table_name.find_first_not_of(" ",idx+4);
        table_name=table_name.substr(idx);
        idx=table_name.find_first_of(" )");
        return table_name.substr(0,idx);
    }
    return table_name;
}

featureset_ptr postgis_datasource::features(const query& q) const
{
    Featureset *fs=0;
    Envelope<double> const& box=q.get_bbox();
    ConnectionManager *mgr=ConnectionManager::instance();
    shared_ptr<Pool<Connection,ConnectionCreator> > pool=mgr->getPool(creator_.id());
    if (pool)
    {
        const shared_ptr<Connection>& conn = pool->borrowObject();
        if (conn && conn->isOK())
        {
            PoolGuard<shared_ptr<Connection>,shared_ptr<Pool<Connection,ConnectionCreator> > > guard(conn,pool);
            std::ostringstream s;

            s << "select asbinary("<<geometryColumn_<<") as geom";
            std::set<std::string> const& props=q.property_names();
            std::set<std::string>::const_iterator pos=props.begin();
            while (pos!=props.end())
            {
                s <<",\""<<*pos<<"\"";
                ++pos;
            }

            s << " from " << table_<<" where "<<geometryColumn_<<" && setSRID('BOX3D(";
            s << box.minx() << " " << box.miny() << ",";
            s << box.maxx() << " " << box.maxy() << ")'::box3d,"<<srid_<<")";
            clog << s.str() << endl;
            shared_ptr<ResultSet> rs=conn->executeQuery(s.str(),1);
            fs=new postgis_featureset(rs,props.size());
        }
    }
    return featureset_ptr(fs);
}

const Envelope<double>& postgis_datasource::envelope() const
{
    return extent_;
}

postgis_datasource::~postgis_datasource() {}
<commit_msg>1. use more precise coord values in SQL statements. 2. added extra parameter 'estimate_extent'. By default, exact extent will be calulated e.g :     select extent(geom) from table_name; Sometimes it is more practical (faster!) to use estimated extent     select estimated_extent('table_name','geom'); but it is somewhere around 95% accurate. Usage:      ....         params["estimate_extent"]="true";      ....<commit_after>/*****************************************************************************
 *
 * This file is part of Mapnik (c++ mapping toolkit)
 *
 * Copyright (C) 2006 Artem Pavlenko
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 *****************************************************************************/

//$Id: postgis.cc 44 2005-04-22 18:53:54Z pavlenko $

#include <string>
#include <algorithm>
#include <set>
#include <sstream>
#include <iomanip>
#include "connection_manager.hpp"
#include "postgis.hpp"

DATASOURCE_PLUGIN(postgis_datasource)

const std::string postgis_datasource::GEOMETRY_COLUMNS="geometry_columns";
const std::string postgis_datasource::SPATIAL_REF_SYS="spatial_ref_system";

using std::clog;
using std::clog;
using std::endl;

using boost::lexical_cast;
using boost::bad_lexical_cast;
using boost::shared_ptr;

postgis_datasource::postgis_datasource(const parameters& params)
    : datasource (params),
      table_(params.get("table")),
      type_(datasource::Vector),
      desc_(params.get("name")),
      creator_(params.get("host"),
               params.get("dbname"),
               params.get("user"),
               params.get("password"))

{
    ConnectionManager *mgr=ConnectionManager::instance();
    mgr->registerPool(creator_,10,20);

    shared_ptr<Pool<Connection,ConnectionCreator> > pool=mgr->getPool(creator_.id());
    if (pool)
    {
        const shared_ptr<Connection>& conn = pool->borrowObject();
        if (conn && conn->isOK())
        {
            PoolGuard<shared_ptr<Connection>,shared_ptr<Pool<Connection,ConnectionCreator> > > guard(conn,pool);

            std::string table_name=table_from_sql(table_);

            std::ostringstream s;
            s << "select f_geometry_column,srid,type from ";
            s << GEOMETRY_COLUMNS <<" where f_table_name='" << table_name<<"'";

            shared_ptr<ResultSet> rs=conn->executeQuery(s.str());

            if (rs->next())
            {
                try
                {
                    srid_ = lexical_cast<int>(rs->getValue("srid"));
                    desc_.set_srid(srid_);
                }
                catch (bad_lexical_cast &ex)
                {
                    clog << ex.what() << endl;
                }
                geometryColumn_=rs->getValue("f_geometry_column");
                std::string postgisType=rs->getValue("type");
            }
            rs->close();
            s.str("");

            if (params.get("estimate_extent") == "true")
            {
                s << "select xmin(ext),ymin(ext),xmax(ext),ymax(ext)"
                  << " from (select estimated_extent('"
                  << table_name <<"','"
                  << geometryColumn_ << "') as ext) as tmp";
            }
            else
            {
                s << "select xmin(ext),ymin(ext),xmax(ext),ymax(ext)"
                  << " from (select extent(" <<geometryColumn_<< ") as ext from "
                  << table_name << ") as tmp";
            }

            rs=conn->executeQuery(s.str());
            if (rs->next())
            {
                try
                {
                    double lox=lexical_cast<double>(rs->getValue(0));
                    double loy=lexical_cast<double>(rs->getValue(1));
                    double hix=lexical_cast<double>(rs->getValue(2));
                    double hiy=lexical_cast<double>(rs->getValue(3));
                    extent_.init(lox,loy,hix,hiy);
                }
                catch (bad_lexical_cast &ex)
                {
                    clog << ex.what() << endl;
                }
            }
            rs->close();

            // collect attribute desc
            s.str("");
            s << "select * from "<<table_<<" limit 1";
            rs=conn->executeQuery(s.str());
            if (rs->next())
            {
                int count = rs->getNumFields();
                for (int i=0;i<count;++i)
                {
                    std::string fld_name=rs->getFieldName(i);
                    int length = rs->getFieldLength(i);

                    int type_oid = rs->getTypeOID(i);
                    switch (type_oid)
                    {
                    case 17285: // geometry
                        desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::Geometry));
                        break;
                    case 21:    // int2
                    case 23:    // int4
                        desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::Integer,false,length));
                        break;
                    case 701:  // float8
                        desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::Double,false,length));
                    case 1042:  // bpchar
                    case 1043:  // varchar
                        desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::String));
                        break;
                    default: // shouldn't get here
                        clog << "unknown type_oid="<<type_oid<<endl;
                        desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::String));
                        break;
                    }
                }
            }
        }
    }
}

std::string postgis_datasource::name_="postgis";

std::string postgis_datasource::name()
{
    return name_;
}

int postgis_datasource::type() const
{
    return type_;
}

layer_descriptor const& postgis_datasource::get_descriptor() const
{
    return desc_;
}

std::string postgis_datasource::table_from_sql(const std::string& sql)
{
    std::string table_name(sql);
    transform(table_name.begin(),table_name.end(),table_name.begin(),tolower);
    std::string::size_type idx=table_name.rfind("from");
    if (idx!=std::string::npos)
    {
        idx=table_name.find_first_not_of(" ",idx+4);
        table_name=table_name.substr(idx);
        idx=table_name.find_first_of(" )");
        return table_name.substr(0,idx);
    }
    return table_name;
}

featureset_ptr postgis_datasource::features(const query& q) const
{
    Featureset *fs=0;
    Envelope<double> const& box=q.get_bbox();
    ConnectionManager *mgr=ConnectionManager::instance();
    shared_ptr<Pool<Connection,ConnectionCreator> > pool=mgr->getPool(creator_.id());
    if (pool)
    {
        const shared_ptr<Connection>& conn = pool->borrowObject();
        if (conn && conn->isOK())
        {
            PoolGuard<shared_ptr<Connection>,shared_ptr<Pool<Connection,ConnectionCreator> > > guard(conn,pool);
            std::ostringstream s;

            s << "select asbinary("<<geometryColumn_<<") as geom";
            std::set<std::string> const& props=q.property_names();
            std::set<std::string>::const_iterator pos=props.begin();
            while (pos!=props.end())
            {
                s <<",\""<<*pos<<"\"";
                ++pos;
            }

            s << " from " << table_<<" where "<<geometryColumn_<<" && setSRID('BOX3D(";
            s << std::setprecision(16);
            s << box.minx() << " " << box.miny() << ",";
            s << box.maxx() << " " << box.maxy() << ")'::box3d,"<<srid_<<")";
            clog << s.str() << endl;
            shared_ptr<ResultSet> rs=conn->executeQuery(s.str(),1);
            fs=new postgis_featureset(rs,props.size());
        }
    }
    return featureset_ptr(fs);
}

const Envelope<double>& postgis_datasource::envelope() const
{
    return extent_;
}

postgis_datasource::~postgis_datasource() {}
<|endoftext|>


<commit_before>#include <lug/Graphics/Vulkan/Swapchain.hpp>
#include <lug/System/Logger.hpp>

namespace lug {
namespace Graphics {
namespace Vulkan {

Swapchain::Swapchain(VkSwapchainKHR swapchain, const Device* device) : _swapchain(swapchain), _device(device) {}

Swapchain::Swapchain(Swapchain&& swapchain) {
    _swapchain = swapchain._swapchain;
    _device = swapchain._device;
    swapchain._swapchain = VK_NULL_HANDLE;
    swapchain._device = nullptr;
}

Swapchain& Swapchain::operator=(Swapchain&& swapchain) {
    _swapchain = swapchain._swapchain;
    _device = swapchain._device;
    swapchain._swapchain = VK_NULL_HANDLE;
    swapchain._device = nullptr;

    return *this;
}

Swapchain::~Swapchain() {
    destroy();
}

void Swapchain::destroy() {
    if (_swapchain != VK_NULL_HANDLE) {
        vkDestroySwapchainKHR(*_device, _swapchain, nullptr);
        _swapchain = VK_NULL_HANDLE;
        _device = nullptr;
    }
}

bool Swapchain::initImages(const VkSurfaceFormatKHR& swapchainFormat) {
    VkResult result;

    // Get swapchain images
    {
        uint32_t imagesCount = 0;
        result = vkGetSwapchainImagesKHR(*_device, _swapchain, &imagesCount, nullptr);
        if (result != VK_SUCCESS) {
            LUG_LOG.error("RendererVulkan: Can't enumerate swapchain images: {}", result);
            return false;
        }

        _images.resize(imagesCount);
        result = vkGetSwapchainImagesKHR(*_device, _swapchain, &imagesCount, _images.data());
        if (result != VK_SUCCESS) {
            LUG_LOG.error("RendererVulkan: Can't enumerate swapchain images: {}", result);
            return false;
        }
    }

    // Create image views
    {
        for (const VkImage& image: _images)
        {
            // Image subresource range
            VkImageSubresourceRange subresourceRange{
                subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
                subresourceRange.baseMipLevel = 0,
                subresourceRange.levelCount = 1,
                subresourceRange.baseArrayLayer = 0,
                subresourceRange.layerCount = 1
            };

            // Image view creation informations
            VkImageViewCreateInfo createInfo{
                createInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
                createInfo.pNext = nullptr,
                createInfo.flags = 0,
                createInfo.image = image,
                createInfo.viewType = VK_IMAGE_VIEW_TYPE_2D,
                createInfo.format = swapchainFormat.format,
                createInfo.components = {
                    VK_COMPONENT_SWIZZLE_R,
                    VK_COMPONENT_SWIZZLE_G,
                    VK_COMPONENT_SWIZZLE_B,
                    VK_COMPONENT_SWIZZLE_A
                },
                createInfo.subresourceRange = subresourceRange
            };

            VkImageView imageView;
            result = vkCreateImageView(*_device, &createInfo, nullptr, &imageView);
            if (result != VK_SUCCESS) {
                LUG_LOG.error("RendererVulkan: Can't create swapchain image view: {}", result);
                return false;
            }

            _imagesViews.push_back(imageView);
        }
    }

    return true;
}

} // Vulkan
} // Graphics
} // lug
<commit_msg>correctly destroy swapchain images and images views when destructing swapchain<commit_after>#include <lug/Graphics/Vulkan/Swapchain.hpp>
#include <lug/System/Logger.hpp>

namespace lug {
namespace Graphics {
namespace Vulkan {

Swapchain::Swapchain(VkSwapchainKHR swapchain, const Device* device) : _swapchain(swapchain), _device(device) {}

Swapchain::Swapchain(Swapchain&& swapchain) {
    _swapchain = swapchain._swapchain;
    _device = swapchain._device;
    swapchain._swapchain = VK_NULL_HANDLE;
    swapchain._device = nullptr;
}

Swapchain& Swapchain::operator=(Swapchain&& swapchain) {
    _swapchain = swapchain._swapchain;
    _device = swapchain._device;
    swapchain._swapchain = VK_NULL_HANDLE;
    swapchain._device = nullptr;

    return *this;
}

Swapchain::~Swapchain() {
    destroy();
}

void Swapchain::destroy() {
    // Delete swapchain images and images views
    for (VkImageView& imageView: _imagesViews) {
        vkDestroyImageView(*_device, imageView, nullptr);
    }
    _imagesViews.clear();
    _images.clear();

    // Delete swapchain
    if (_swapchain != VK_NULL_HANDLE) {
        vkDestroySwapchainKHR(*_device, _swapchain, nullptr);
        _swapchain = VK_NULL_HANDLE;
        _device = nullptr;
    }
}

bool Swapchain::initImages(const VkSurfaceFormatKHR& swapchainFormat) {
    VkResult result;

    // Get swapchain images
    {
        uint32_t imagesCount = 0;
        result = vkGetSwapchainImagesKHR(*_device, _swapchain, &imagesCount, nullptr);
        if (result != VK_SUCCESS) {
            LUG_LOG.error("RendererVulkan: Can't enumerate swapchain images: {}", result);
            return false;
        }

        _images.resize(imagesCount);
        result = vkGetSwapchainImagesKHR(*_device, _swapchain, &imagesCount, _images.data());
        if (result != VK_SUCCESS) {
            LUG_LOG.error("RendererVulkan: Can't enumerate swapchain images: {}", result);
            return false;
        }
    }

    // Create image views
    {
        for (const VkImage& image: _images) {
            // Image subresource range
            VkImageSubresourceRange subresourceRange{
                subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
                subresourceRange.baseMipLevel = 0,
                subresourceRange.levelCount = 1,
                subresourceRange.baseArrayLayer = 0,
                subresourceRange.layerCount = 1
            };

            // Image view creation informations
            VkImageViewCreateInfo createInfo{
                createInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO,
                createInfo.pNext = nullptr,
                createInfo.flags = 0,
                createInfo.image = image,
                createInfo.viewType = VK_IMAGE_VIEW_TYPE_2D,
                createInfo.format = swapchainFormat.format,
                createInfo.components = {
                    VK_COMPONENT_SWIZZLE_R,
                    VK_COMPONENT_SWIZZLE_G,
                    VK_COMPONENT_SWIZZLE_B,
                    VK_COMPONENT_SWIZZLE_A
                },
                createInfo.subresourceRange = subresourceRange
            };

            VkImageView imageView;
            result = vkCreateImageView(*_device, &createInfo, nullptr, &imageView);
            if (result != VK_SUCCESS) {
                LUG_LOG.error("RendererVulkan: Can't create swapchain image view: {}", result);
                return false;
            }

            _imagesViews.push_back(imageView);
        }
    }

    return true;
}

} // Vulkan
} // Graphics
} // lug
<|endoftext|>


<commit_before>/*=========================================================================

  Program:   Insight Segmentation & Registration Toolkit (ITK)
  Module:
  Language:  C++
  Date:
  Version:

Copyright (c) 2000 National Library of Medicine
All rights reserved.

See COPYRIGHT.txt for copyright details.

=========================================================================*/
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif

#include <iostream>
// This file has been generated by BuildHeaderTest.tcl
// Test to include each header file for Insight

#include "itkAcosImageAdaptor.h"
#include "itkAddImageAdaptor.h"
#include "itkAddPixelAccessor.h"
#include "itkAffineTransform.txx"
#include "itkArray.txx"
#include "itkArray2D.txx"
#include "itkAsinImageAdaptor.h"
#include "itkAtanImageAdaptor.h"
#include "itkAutoPointer.h"
#include "itkAzimuthElevationToCartesianTransform.txx"
#include "itkBSplineDeformableTransform.txx"
#include "itkBSplineDerivativeKernelFunction.h"
#include "itkBSplineInterpolationWeightFunction.txx"
#include "itkBSplineKernelFunction.h"
#include "itkBackwardDifferenceOperator.txx"
#include "itkBinaryBallStructuringElement.txx"
#include "itkBinaryThresholdImageFunction.txx"
#include "itkBloxBoundaryPointImage.txx"
#include "itkBloxBoundaryPointItem.txx"
#include "itkBloxBoundaryPointPixel.txx"
#include "itkBloxBoundaryProfileImage.txx"
#include "itkBloxBoundaryProfileItem.txx"
#include "itkBloxBoundaryProfilePixel.txx"
#include "itkBloxCoreAtomImage.txx"
#include "itkBloxCoreAtomItem.txx"
#include "itkBloxCoreAtomPixel.txx"
#include "itkBloxImage.txx"
#include "itkBloxItem.h"
#include "itkBloxPixel.txx"
#include "itkBluePixelAccessor.h"
#include "itkBoundingBox.txx"
#include "itkByteSwapper.txx"
#include "itkCellInterface.txx"
#include "itkCellInterfaceVisitor.h"
#include "itkCenteredAffineTransform.txx"
#include "itkCenteredRigid2DTransform.txx"
#include "itkCenteredTransformInitializer.txx"
#include "itkCentralDifferenceImageFunction.txx"
#include "itkChainCodePath.txx"
#include "itkChainCodePath2D.txx"
#include "itkColorTable.txx"
#include "itkCommand.h"
#include "itkConceptChecking.h"
#include "itkConditionalConstIterator.txx"
#include "itkConditionalIterator.txx"
#include "itkConicShellInteriorExteriorSpatialFunction.txx"
#include "itkConstNeighborhoodIterator.txx"
#include "itkConstShapedNeighborhoodIterator.txx"
#include "itkConstSliceIterator.h"
#include "itkConstantBoundaryCondition.h"
#include "itkContinuousIndex.h"
#include "itkCosImageAdaptor.h"
#include "itkCovariantVector.txx"
#include "itkCreateObjectFunction.h"
#include "itkDataObject.h"
#include "itkDecisionRuleBase.h"
#include "itkDefaultDynamicMeshTraits.h"
#include "itkDefaultImageTraits.h"
#include "itkDefaultPixelAccessor.h"
#include "itkDefaultStaticMeshTraits.h"
#include "itkDenseFiniteDifferenceImageFilter.txx"
#include "itkDerivativeOperator.txx"
#include "itkDifferenceImageFilter.txx"
#include "itkDirectory.h"
#include "itkDynamicLoader.h"
#include "itkElasticBodyReciprocalSplineKernelTransform.txx"
#include "itkElasticBodySplineKernelTransform.txx"
#include "itkEllipsoidInteriorExteriorSpatialFunction.txx"
#include "itkEquivalencyTable.h"
#include "itkEuler2DTransform.txx"
#include "itkEuler3DTransform.txx"
#include "itkEventObject.h"
#include "itkExceptionObject.h"
#include "itkExpImageAdaptor.h"
#include "itkExpNegativeImageAdaptor.h"
#include "itkFastMutexLock.h"
#include "itkFileOutputWindow.h"
#include "itkFiniteDifferenceFunction.txx"
#include "itkFiniteDifferenceImageFilter.txx"
#include "itkFixedArray.txx"
#include "itkFixedCenterOfRotationAffineTransform.txx"
#include "itkFloodFilledFunctionConditionalConstIterator.txx"
#include "itkFloodFilledFunctionConditionalIterator.txx"
#include "itkFloodFilledImageFunctionConditionalConstIterator.txx"
#include "itkFloodFilledImageFunctionConditionalIterator.txx"
#include "itkFloodFilledSpatialFunctionConditionalConstIterator.txx"
#include "itkFloodFilledSpatialFunctionConditionalIterator.txx"
#include "itkForwardDifferenceOperator.txx"
#include "itkFourierSeriesPath.txx"
#include "itkFrustumSpatialFunction.txx"
#include "itkFunctionBase.h"
#include "itkGaussianBlurImageFunction.txx"
#include "itkGaussianDerivativeImageFunction.txx"
#include "itkGaussianDerivativeSpatialFunction.txx"
#include "itkGaussianKernelFunction.h"
#include "itkGaussianOperator.txx"
#include "itkGaussianSpatialFunction.txx"
#include "itkGreenPixelAccessor.h"
#include "itkHexahedronCell.txx"
#include "itkHexahedronCellTopology.h"
#include "itkIdentityTransform.h"
#include "itkImage.txx"
#include "itkImageAdaptor.txx"
#include "itkImageBase.txx"
#include "itkImageBoundaryCondition.h"
#include "itkImageConstIterator.txx"
#include "itkImageConstIteratorWithIndex.txx"
#include "itkImageContainerInterface.h"
#include "itkImageFunction.txx"
#include "itkImageIterator.txx"
#include "itkImageIteratorWithIndex.txx"
#include "itkImageLinearConstIteratorWithIndex.txx"
#include "itkImageLinearIteratorWithIndex.txx"
#include "itkImageRandomConstIteratorWithIndex.txx"
#include "itkImageRandomIteratorWithIndex.txx"
#include "itkImageRegion.txx"
#include "itkImageRegionConstIterator.txx"
#include "itkImageRegionConstIteratorWithIndex.txx"
#include "itkImageRegionExclusionConstIteratorWithIndex.txx"
#include "itkImageRegionExclusionIteratorWithIndex.txx"
#include "itkImageRegionIterator.txx"
#include "itkImageRegionIteratorWithIndex.txx"
#include "itkImageRegionMultidimensionalSplitter.txx"
#include "itkImageRegionReverseConstIterator.txx"
#include "itkImageRegionReverseIterator.txx"
#include "itkImageRegionSplitter.txx"
#include "itkImageReverseConstIterator.txx"
#include "itkImageReverseIterator.txx"
#include "itkImageSliceConstIteratorWithIndex.txx"
#include "itkImageSliceIteratorWithIndex.txx"
#include "itkImageSource.txx"
#include "itkImageToImageFilter.txx"
#include "itkImageToImageFilterDetail.h"
#include "itkImportImageContainer.txx"
#include "itkInPlaceImageFilter.txx"
#include "itkIndent.h"
#include "itkIndex.h"
#include "itkIndexedContainerInterface.h"
#include "itkIntTypes.h"
#include "itkInteriorExteriorSpatialFunction.txx"
#include "itkInterpolateImageFunction.h"
#include "itkIterationReporter.h"
#include "itkKLMSegmentationBorder.h"
#include "itkKLMSegmentationRegion.h"
#include "itkKernelFunction.h"
#include "itkKernelTransform.txx"
#include "itkLaplacianOperator.txx"
#include "itkLevelSet.h"
#include "itkLevelSetFunction.txx"
#include "itkLightObject.h"
#include "itkLightProcessObject.h"
#include "itkLineCell.txx"
#include "itkLinearInterpolateImageFunction.txx"
#include "itkLog10ImageAdaptor.h"
#include "itkLogImageAdaptor.h"
#include "itkMacro.h"
#include "itkMapContainer.txx"
#include "itkMatrix.txx"
#include "itkMaximumDecisionRule.h"
#include "itkMaximumRatioDecisionRule.h"
#include "itkMeanImageFunction.txx"
#include "itkMedianImageFunction.txx"
#include "itkMesh.txx"
#include "itkMeshRegion.h"
#include "itkMeshSource.txx"
#include "itkMeshToMeshFilter.txx"
#include "itkMetaDataDictionary.h"
#include "itkMetaDataObject.txx"
#include "itkMetaDataObjectBase.h"
#include "itkMinimumDecisionRule.h"
#include "itkMultiThreader.h"
#include "itkMutexLock.h"
#include "itkMutexLockHolder.h"
#include "itkNearestNeighborInterpolateImageFunction.h"
#include "itkNeighborhood.txx"
#include "itkNeighborhoodAlgorithm.txx"
#include "itkNeighborhoodAllocator.h"
#include "itkNeighborhoodBinaryThresholdImageFunction.txx"
#include "itkNeighborhoodInnerProduct.txx"
#include "itkNeighborhoodIterator.txx"
#include "itkNeighborhoodOperator.txx"
#include "itkNeighborhoodOperatorImageFunction.txx"
#include "itkNthElementImageAdaptor.h"
#include "itkNthElementPixelAccessor.h"
#include "itkNumericTraits.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "itkObjectFactoryBase.h"
#include "itkObjectStore.txx"
#include "itkOctree.txx"
#include "itkOctreeNode.h"
#include "itkOffset.h"
#include "itkOneWayEquivalencyTable.h"
#include "itkOutputWindow.h"
#include "itkParametricPath.txx"
#include "itkPath.txx"
#include "itkPathConstIterator.txx"
#include "itkPathFunctions.h"
#include "itkPathIterator.txx"
#include "itkPeriodicBoundaryCondition.txx"
#include "itkPixelAccessor.h"
#include "itkPixelTraits.h"
#include "itkPoint.txx"
#include "itkPointLocator.txx"
#include "itkPointSet.txx"
#include "itkPolyLineParametricPath.txx"
#include "itkPolygonCell.txx"
#include "itkProcessObject.h"
#include "itkProgressAccumulator.h"
#include "itkProgressReporter.h"
#include "itkQuadraticEdgeCell.txx"
#include "itkQuadraticTriangleCell.txx"
#include "itkQuadraticTriangleCellTopology.h"
#include "itkQuadrilateralCell.txx"
#include "itkQuadrilateralCellTopology.h"
#include "itkQuaternionRigidTransform.txx"
#include "itkRGBAPixel.txx"
#include "itkRGBPixel.txx"
#include "itkRGBToVectorImageAdaptor.h"
#include "itkRGBToVectorPixelAccessor.h"
#include "itkRedPixelAccessor.h"
#include "itkRegion.h"
#include "itkRigid2DTransform.txx"
#include "itkRigid3DPerspectiveTransform.txx"
#include "itkRigid3DTransform.txx"
#include "itkSTLConstContainerAdaptor.h"
#include "itkSTLContainerAdaptor.h"
#include "itkScalarToRGBPixelFunctor.txx"
#include "itkScalarVector.h"
#include "itkScaleLogarithmicTransform.txx"
#include "itkScaleTransform.txx"
#include "itkSegmentationBorder.h"
#include "itkSegmentationLevelSetFunction.txx"
#include "itkSegmentationRegion.h"
#include "itkShapeSignedDistanceFunction.h"
#include "itkShapedNeighborhoodIterator.txx"
#include "itkSimilarity2DTransform.txx"
#include "itkSimpleFastMutexLock.h"
#include "itkSinImageAdaptor.h"
#include "itkSize.h"
#include "itkSliceIterator.h"
#include "itkSmartPointer.h"
#include "itkSmartPointerForwardReference.txx"
#include "itkSobelOperator.txx"
#include "itkSpatialFunction.txx"
#include "itkSphereSignedDistanceFunction.txx"
#include "itkSphereSpatialFunction.txx"
#include "itkSqrtImageAdaptor.h"
#include "itkSymmetricEllipsoidInteriorExteriorSpatialFunction.txx"
#include "itkTanImageAdaptor.h"
#include "itkTetrahedronCell.txx"
#include "itkTetrahedronCellTopology.h"
#include "itkTextOutput.h"
#include "itkThinPlateR2LogRSplineKernelTransform.txx"
#include "itkThinPlateSplineKernelTransform.txx"
#include "itkTimeProbe.h"
#include "itkTimeProbesCollectorBase.h"
#include "itkTimeStamp.h"
#include "itkTorusInteriorExteriorSpatialFunction.txx"
#include "itkTransform.txx"
#include "itkTranslationTransform.txx"
#include "itkTriangleCell.txx"
#include "itkTriangleCellTopology.h"
#include "itkValarrayImageContainer.h"
#include "itkVarianceImageFunction.txx"
#include "itkVector.txx"
#include "itkVectorContainer.txx"
#include "itkVectorInterpolateImageFunction.h"
#include "itkVectorLinearInterpolateImageFunction.txx"
#include "itkVectorNeighborhoodInnerProduct.txx"
#include "itkVectorToRGBImageAdaptor.h"
#include "itkVectorToRGBPixelAccessor.h"
#include "itkVersion.h"
#include "itkVersor.txx"
#include "itkVersorRigid3DTransform.txx"
#include "itkVersorTransform.txx"
#include "itkVertexCell.txx"
#include "itkVolumeSplineKernelTransform.txx"
#include "itkWeakPointer.h"
#include "itkXMLFileOutputWindow.h"
#include "itkZeroFluxNeumannBoundaryCondition.txx"
#include "itk_alloc.h"
#include "itk_hash_map.h"
#include "itk_hash_set.h"
#include "itk_hashtable.h"
#include "vcl_alloc.h"

int main ( int , char*  )
{

  return 0;
}

<commit_msg>ENH: Updated to latest headers<commit_after>/*=========================================================================

  Program:   Insight Segmentation & Registration Toolkit (ITK)
  Module:
  Language:  C++
  Date:
  Version:

Copyright (c) 2000 National Library of Medicine
All rights reserved.

See COPYRIGHT.txt for copyright details.

=========================================================================*/
#if defined(_MSC_VER)
#pragma warning ( disable : 4786 )
#endif

#include <iostream>
// This file has been generated by BuildHeaderTest.tcl
// Test to include each header file for Insight

#include "itkAcosImageAdaptor.h"
#include "itkAddImageAdaptor.h"
#include "itkAddPixelAccessor.h"
#include "itkAffineTransform.txx"
#include "itkArray.txx"
#include "itkArray2D.txx"
#include "itkAsinImageAdaptor.h"
#include "itkAtanImageAdaptor.h"
#include "itkAutoPointer.h"
#include "itkAzimuthElevationToCartesianTransform.txx"
#include "itkBSplineDeformableTransform.txx"
#include "itkBSplineDerivativeKernelFunction.h"
#include "itkBSplineInterpolationWeightFunction.txx"
#include "itkBSplineKernelFunction.h"
#include "itkBackwardDifferenceOperator.txx"
#include "itkBinaryBallStructuringElement.txx"
#include "itkBinaryThresholdImageFunction.txx"
#include "itkBloxBoundaryPointImage.txx"
#include "itkBloxBoundaryPointItem.txx"
#include "itkBloxBoundaryPointPixel.txx"
#include "itkBloxBoundaryProfileImage.txx"
#include "itkBloxBoundaryProfileItem.txx"
#include "itkBloxBoundaryProfilePixel.txx"
#include "itkBloxCoreAtomImage.txx"
#include "itkBloxCoreAtomItem.txx"
#include "itkBloxCoreAtomPixel.txx"
#include "itkBloxImage.txx"
#include "itkBloxItem.h"
#include "itkBloxPixel.txx"
#include "itkBluePixelAccessor.h"
#include "itkBoundingBox.txx"
#include "itkByteSwapper.txx"
#include "itkCellInterface.txx"
#include "itkCellInterfaceVisitor.h"
#include "itkCenteredAffineTransform.txx"
#include "itkCenteredRigid2DTransform.txx"
#include "itkCenteredTransformInitializer.txx"
#include "itkCentralDifferenceImageFunction.txx"
#include "itkChainCodePath.txx"
#include "itkChainCodePath2D.txx"
#include "itkColorTable.txx"
#include "itkCommand.h"
#include "itkConceptChecking.h"
#include "itkConditionalConstIterator.txx"
#include "itkConditionalIterator.txx"
#include "itkConicShellInteriorExteriorSpatialFunction.txx"
#include "itkConstNeighborhoodIterator.txx"
#include "itkConstShapedNeighborhoodIterator.txx"
#include "itkConstSliceIterator.h"
#include "itkConstantBoundaryCondition.h"
#include "itkContinuousIndex.h"
#include "itkCosImageAdaptor.h"
#include "itkCovariantVector.txx"
#include "itkCreateObjectFunction.h"
#include "itkDataObject.h"
#include "itkDecisionRuleBase.h"
#include "itkDefaultDynamicMeshTraits.h"
#include "itkDefaultImageTraits.h"
#include "itkDefaultPixelAccessor.h"
#include "itkDefaultStaticMeshTraits.h"
#include "itkDenseFiniteDifferenceImageFilter.txx"
#include "itkDerivativeOperator.txx"
#include "itkDifferenceImageFilter.txx"
#include "itkDirectory.h"
#include "itkDynamicLoader.h"
#include "itkElasticBodyReciprocalSplineKernelTransform.txx"
#include "itkElasticBodySplineKernelTransform.txx"
#include "itkEllipsoidInteriorExteriorSpatialFunction.txx"
#include "itkEquivalencyTable.h"
#include "itkEuler2DTransform.txx"
#include "itkEuler3DTransform.txx"
#include "itkEventObject.h"
#include "itkExceptionObject.h"
#include "itkExpImageAdaptor.h"
#include "itkExpNegativeImageAdaptor.h"
#include "itkFastMutexLock.h"
#include "itkFileOutputWindow.h"
#include "itkFiniteDifferenceFunction.txx"
#include "itkFiniteDifferenceImageFilter.txx"
#include "itkFixedArray.txx"
#include "itkFixedCenterOfRotationAffineTransform.txx"
#include "itkFloodFilledFunctionConditionalConstIterator.txx"
#include "itkFloodFilledFunctionConditionalIterator.txx"
#include "itkFloodFilledImageFunctionConditionalConstIterator.txx"
#include "itkFloodFilledImageFunctionConditionalIterator.txx"
#include "itkFloodFilledSpatialFunctionConditionalConstIterator.txx"
#include "itkFloodFilledSpatialFunctionConditionalIterator.txx"
#include "itkForwardDifferenceOperator.txx"
#include "itkFourierSeriesPath.txx"
#include "itkFrustumSpatialFunction.txx"
#include "itkFunctionBase.h"
#include "itkGaussianBlurImageFunction.txx"
#include "itkGaussianDerivativeImageFunction.txx"
#include "itkGaussianDerivativeSpatialFunction.txx"
#include "itkGaussianKernelFunction.h"
#include "itkGaussianOperator.txx"
#include "itkGaussianSpatialFunction.txx"
#include "itkGreenPixelAccessor.h"
#include "itkHexahedronCell.txx"
#include "itkHexahedronCellTopology.h"
#include "itkIdentityTransform.h"
#include "itkImage.txx"
#include "itkImageAdaptor.txx"
#include "itkImageBase.txx"
#include "itkImageBoundaryCondition.h"
#include "itkImageConstIterator.txx"
#include "itkImageConstIteratorWithIndex.txx"
#include "itkImageContainerInterface.h"
#include "itkImageFunction.txx"
#include "itkImageIterator.txx"
#include "itkImageIteratorWithIndex.txx"
#include "itkImageLinearConstIteratorWithIndex.txx"
#include "itkImageLinearIteratorWithIndex.txx"
#include "itkImageRandomConstIteratorWithIndex.txx"
#include "itkImageRandomIteratorWithIndex.txx"
#include "itkImageRegion.txx"
#include "itkImageRegionConstIterator.txx"
#include "itkImageRegionConstIteratorWithIndex.txx"
#include "itkImageRegionExclusionConstIteratorWithIndex.txx"
#include "itkImageRegionExclusionIteratorWithIndex.txx"
#include "itkImageRegionIterator.txx"
#include "itkImageRegionIteratorWithIndex.txx"
#include "itkImageRegionMultidimensionalSplitter.txx"
#include "itkImageRegionReverseConstIterator.txx"
#include "itkImageRegionReverseIterator.txx"
#include "itkImageRegionSplitter.txx"
#include "itkImageReverseConstIterator.txx"
#include "itkImageReverseIterator.txx"
#include "itkImageSliceConstIteratorWithIndex.txx"
#include "itkImageSliceIteratorWithIndex.txx"
#include "itkImageSource.txx"
#include "itkImageToImageFilter.txx"
#include "itkImageToImageFilterDetail.h"
#include "itkImportImageContainer.txx"
#include "itkInPlaceImageFilter.txx"
#include "itkIndent.h"
#include "itkIndex.h"
#include "itkIndexedContainerInterface.h"
#include "itkIntTypes.h"
#include "itkInteriorExteriorSpatialFunction.txx"
#include "itkInterpolateImageFunction.h"
#include "itkIterationReporter.h"
#include "itkKLMSegmentationBorder.h"
#include "itkKLMSegmentationRegion.h"
#include "itkKernelFunction.h"
#include "itkKernelTransform.txx"
#include "itkLaplacianOperator.txx"
#include "itkLevelSet.h"
#include "itkLevelSetFunction.txx"
#include "itkLevelSetFunctionBase.txx"
#include "itkLightObject.h"
#include "itkLightProcessObject.h"
#include "itkLineCell.txx"
#include "itkLinearInterpolateImageFunction.txx"
#include "itkLog10ImageAdaptor.h"
#include "itkLogImageAdaptor.h"
#include "itkMacro.h"
#include "itkMapContainer.txx"
#include "itkMatrix.txx"
#include "itkMaximumDecisionRule.h"
#include "itkMaximumRatioDecisionRule.h"
#include "itkMeanImageFunction.txx"
#include "itkMedianImageFunction.txx"
#include "itkMesh.txx"
#include "itkMeshRegion.h"
#include "itkMeshSource.txx"
#include "itkMeshToMeshFilter.txx"
#include "itkMetaDataDictionary.h"
#include "itkMetaDataObject.txx"
#include "itkMetaDataObjectBase.h"
#include "itkMinimumDecisionRule.h"
#include "itkMultiThreader.h"
#include "itkMutexLock.h"
#include "itkMutexLockHolder.h"
#include "itkNearestNeighborInterpolateImageFunction.h"
#include "itkNeighborhood.txx"
#include "itkNeighborhoodAlgorithm.txx"
#include "itkNeighborhoodAllocator.h"
#include "itkNeighborhoodBinaryThresholdImageFunction.txx"
#include "itkNeighborhoodInnerProduct.txx"
#include "itkNeighborhoodIterator.txx"
#include "itkNeighborhoodOperator.txx"
#include "itkNeighborhoodOperatorImageFunction.txx"
#include "itkNthElementImageAdaptor.h"
#include "itkNthElementPixelAccessor.h"
#include "itkNumericTraits.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "itkObjectFactoryBase.h"
#include "itkObjectStore.txx"
#include "itkOctree.txx"
#include "itkOctreeNode.h"
#include "itkOffset.h"
#include "itkOneWayEquivalencyTable.h"
#include "itkOutputWindow.h"
#include "itkParametricPath.txx"
#include "itkPath.txx"
#include "itkPathConstIterator.txx"
#include "itkPathFunctions.h"
#include "itkPathIterator.txx"
#include "itkPeriodicBoundaryCondition.txx"
#include "itkPixelAccessor.h"
#include "itkPixelTraits.h"
#include "itkPoint.txx"
#include "itkPointLocator.txx"
#include "itkPointSet.txx"
#include "itkPolyLineParametricPath.txx"
#include "itkPolygonCell.txx"
#include "itkProcessObject.h"
#include "itkProgressAccumulator.h"
#include "itkProgressReporter.h"
#include "itkQuadraticEdgeCell.txx"
#include "itkQuadraticTriangleCell.txx"
#include "itkQuadraticTriangleCellTopology.h"
#include "itkQuadrilateralCell.txx"
#include "itkQuadrilateralCellTopology.h"
#include "itkQuaternionRigidTransform.txx"
#include "itkRGBAPixel.txx"
#include "itkRGBPixel.txx"
#include "itkRGBToVectorImageAdaptor.h"
#include "itkRGBToVectorPixelAccessor.h"
#include "itkRedPixelAccessor.h"
#include "itkRegion.h"
#include "itkRigid2DTransform.txx"
#include "itkRigid3DPerspectiveTransform.txx"
#include "itkRigid3DTransform.txx"
#include "itkSTLConstContainerAdaptor.h"
#include "itkSTLContainerAdaptor.h"
#include "itkScalarToRGBPixelFunctor.txx"
#include "itkScalarVector.h"
#include "itkScaleLogarithmicTransform.txx"
#include "itkScaleTransform.txx"
#include "itkSegmentationBorder.h"
#include "itkSegmentationLevelSetFunction.txx"
#include "itkSegmentationRegion.h"
#include "itkShapeSignedDistanceFunction.h"
#include "itkShapedNeighborhoodIterator.txx"
#include "itkSimilarity2DTransform.txx"
#include "itkSimpleFastMutexLock.h"
#include "itkSinImageAdaptor.h"
#include "itkSize.h"
#include "itkSliceIterator.h"
#include "itkSmartPointer.h"
#include "itkSmartPointerForwardReference.txx"
#include "itkSobelOperator.txx"
#include "itkSpatialFunction.txx"
#include "itkSphereSignedDistanceFunction.txx"
#include "itkSphereSpatialFunction.txx"
#include "itkSqrtImageAdaptor.h"
#include "itkSymmetricEllipsoidInteriorExteriorSpatialFunction.txx"
#include "itkTanImageAdaptor.h"
#include "itkTetrahedronCell.txx"
#include "itkTetrahedronCellTopology.h"
#include "itkTextOutput.h"
#include "itkThinPlateR2LogRSplineKernelTransform.txx"
#include "itkThinPlateSplineKernelTransform.txx"
#include "itkTimeProbe.h"
#include "itkTimeProbesCollectorBase.h"
#include "itkTimeStamp.h"
#include "itkTorusInteriorExteriorSpatialFunction.txx"
#include "itkTransform.txx"
#include "itkTranslationTransform.txx"
#include "itkTriangleCell.txx"
#include "itkTriangleCellTopology.h"
#include "itkValarrayImageContainer.h"
#include "itkVarianceImageFunction.txx"
#include "itkVector.txx"
#include "itkVectorContainer.txx"
#include "itkVectorInterpolateImageFunction.h"
#include "itkVectorLinearInterpolateImageFunction.txx"
#include "itkVectorNeighborhoodInnerProduct.txx"
#include "itkVectorToRGBImageAdaptor.h"
#include "itkVectorToRGBPixelAccessor.h"
#include "itkVersion.h"
#include "itkVersor.txx"
#include "itkVersorRigid3DTransform.txx"
#include "itkVersorTransform.txx"
#include "itkVertexCell.txx"
#include "itkVolumeSplineKernelTransform.txx"
#include "itkWeakPointer.h"
#include "itkXMLFileOutputWindow.h"
#include "itkZeroFluxNeumannBoundaryCondition.txx"
#include "itk_alloc.h"
#include "itk_hash_map.h"
#include "itk_hash_set.h"
#include "itk_hashtable.h"
#include "vcl_alloc.h"

int main ( int , char*  )
{

  return 0;
}

<|endoftext|>