text:
// ----------------------------------------------------------------------------
// Copyright (C) 2002-2006 Marcin Kalicinski
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// For more information, see www.boost.org
// ----------------------------------------------------------------------------
#ifndef BOOST_PROPERTY_TREE_PROPERTIES_PARSER_HPP_INCLUDED
#define BOOST_PROPERTY_TREE_PROPERTIES_PARSER_HPP_INCLUDED

#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/detail/properties_parser_error.hpp>
//#include <boost/property_tree/detail/properties_parser_writer_settings.hpp>
#include <boost/property_tree/detail/properties_parser_read.hpp>
//#include <boost/property_tree/detail/properties_parser_write.hpp>
#include <istream>

namespace boost { namespace property_tree { namespace properties_parser
{

    /**
     * Read properties from a the given stream and translate it to a property tree.
     * @note Replaces the existing contents. Strong exception guarantee.
     * @throw properties_parser_error If the stream cannot be read, doesn't contain
     *                          valid properties, or a conversion fails.
     */
    template<class Ptree, class Ch>
    void read_properties(std::basic_istream<Ch> &stream, Ptree &pt)
    {
        Ptree local;
        read_properties_internal(stream, local, std::string(), 0);
        pt.swap(local);
    }

    /**
     * Read properties from a the given stream and translate it to a property tree.
     * @note Replaces the existing contents. Strong exception guarantee.
     * @param default_ptree If parsing fails, pt is set to a copy of this tree.
     */
    template<class Ptree, class Ch>
    void read_properties(std::basic_istream<Ch> &stream, Ptree &pt,
                   const Ptree &default_ptree)
    {
        try {
            read_properties(stream, pt);
        } catch(file_parser_error &) {
            pt = default_ptree;
        }
    }

    /**
     * Read properties from a the given file and translate it to a property tree. The
     * tree's key type must be a string type, i.e. it must have a nested
     * value_type typedef that is a valid parameter for basic_ifstream.
     * @note Replaces the existing contents. Strong exception guarantee.
     * @throw properties_parser_error If the file cannot be read, doesn't contain
     *                          valid properties, or a conversion fails.
     */
    template<class Ptree>
    void read_properties(const std::string &filename, Ptree &pt,
                   const std::locale &loc = std::locale())
    {
        std::basic_ifstream<typename Ptree::key_type::value_type>
            stream(filename.c_str());
        if (!stream) {
            BOOST_PROPERTY_TREE_THROW(properties_parser_error(
                "cannot open file for reading", filename, 0));
        }
        stream.imbue(loc);
        Ptree local;
        read_properties_internal(stream, local, filename, 0);
        pt.swap(local);
    }

    /**
     * Read properties from a the given file and translate it to a property tree. The
     * tree's key type must be a string type, i.e. it must have a nested
     * value_type typedef that is a valid parameter for basic_ifstream.
     * @note Replaces the existing contents. Strong exception guarantee.
     * @param default_ptree If parsing fails, pt is set to a copy of this tree.
     */
    template<class Ptree>
    void read_properties(const std::string &filename,
                   Ptree &pt,
                   const Ptree &default_ptree,
                   const std::locale &loc = std::locale())
    {
        try {
            read_properties(filename, pt, loc);
        } catch(file_parser_error &) {
            pt = default_ptree;
        }
    }

    /**
     * Writes a tree to the stream in properties format.
     * @throw properties_parser_error If the stream cannot be written to, or a
     *                          conversion fails.
     * @param settings The settings to use when writing the properties data.
     */
//    template<class Ptree, class Ch>
//    void write_properties(std::basic_ostream<Ch> &stream,
//                    const Ptree &pt,
//                    const info_writer_settings<Ch> &settings =
//                        info_writer_settings<Ch>())
//    {
//        write_properties_internal(stream, pt, std::string(), settings);
//    }

    /**
     * Writes a tree to the file in properties format. The tree's key type must be a
     * string type, i.e. it must have a nested value_type typedef that is a
     * valid parameter for basic_ofstream.
     * @throw properties_parser_error If the file cannot be written to, or a
     *                          conversion fails.
     * @param settings The settings to use when writing the properties data.
     */
//    template<class Ptree>
//    void write_properties(const std::string &filename,
//                    const Ptree &pt,
//                    const std::locale &loc = std::locale(),
//                    const info_writer_settings<
//                        typename Ptree::key_type::value_type
//                    > &settings =
//                        info_writer_make_settings<
//                            typename Ptree::key_type::value_type>())
//    {
//        std::basic_ofstream<typename Ptree::key_type::value_type>
//            stream(filename.c_str());
//        if (!stream) {
//            BOOST_PROPERTY_TREE_THROW(properties_parser_error(
//                "cannot open file for writing", filename, 0));
//        }
//        stream.imbue(loc);
//        write_properties_internal(stream, pt, filename, settings);
//    }

} } }

namespace boost { namespace property_tree
{
    using properties_parser::properties_parser_error;
    using properties_parser::read_properties;
    //using properties_parser::write_properties;
    //using properties_parser::info_writer_settings;
    //using properties_parser::info_writer_make_settings;
} }

#endif


text:
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 2015 Ke Yang <yangke@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

#include "main.h"

#include <Eigen/CXX11/Tensor>

using Eigen::Tensor;

template<int DataLayout>
static void test_simple_inflation()
{
  Tensor<float, 4, DataLayout> tensor(2,3,5,7);
  tensor.setRandom();
  array<ptrdiff_t, 4> strides;

  strides[0] = 1;
  strides[1] = 1;
  strides[2] = 1;
  strides[3] = 1;

  Tensor<float, 4, DataLayout> no_stride;
  no_stride = tensor.inflate(strides);

  VERIFY_IS_EQUAL(no_stride.dimension(0), 2);
  VERIFY_IS_EQUAL(no_stride.dimension(1), 3);
  VERIFY_IS_EQUAL(no_stride.dimension(2), 5);
  VERIFY_IS_EQUAL(no_stride.dimension(3), 7);

  for (int i = 0; i < 2; ++i) {
    for (int j = 0; j < 3; ++j) {
      for (int k = 0; k < 5; ++k) {
        for (int l = 0; l < 7; ++l) {
          VERIFY_IS_EQUAL(tensor(i,j,k,l), no_stride(i,j,k,l));
        }
      }
    }
  }

  strides[0] = 2;
  strides[1] = 4;
  strides[2] = 2;
  strides[3] = 3;
  Tensor<float, 4, DataLayout> inflated;
  inflated = tensor.inflate(strides);

  VERIFY_IS_EQUAL(inflated.dimension(0), 3);
  VERIFY_IS_EQUAL(inflated.dimension(1), 9);
  VERIFY_IS_EQUAL(inflated.dimension(2), 9);
  VERIFY_IS_EQUAL(inflated.dimension(3), 19);

  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 9; ++j) {
      for (int k = 0; k < 9; ++k) {
        for (int l = 0; l < 19; ++l) {
          if (i % 2 == 0 &&
              j % 4 == 0 &&
              k % 2 == 0 &&
              l % 3 == 0) {
            VERIFY_IS_EQUAL(inflated(i,j,k,l),
                            tensor(i/2, j/4, k/2, l/3));
          } else {
            VERIFY_IS_EQUAL(0, inflated(i,j,k,l));
          }
        }
      }
    }
  }
}

void test_cxx11_tensor_inflation()
{
  CALL_SUBTEST(test_simple_inflation<ColMajor>());
  CALL_SUBTEST(test_simple_inflation<RowMajor>());
}

ext: cpp


text:
//
// Created by yehuan on 2020-02-12.
//

#include "rpcgenrawtx.h"

#include "commons/base58.h"
#include "commons/json/json_spirit_utils.h"
#include "commons/json/json_spirit_value.h"
#include "commons/util/util.h"
#include "init.h"
#include "miner/miner.h"
#include "net.h"
#include "netbase.h"
#include "wallet/wallet.h"

#include "persistence/contractdb.h"
#include "rpc/core/rpccommons.h"
#include "rpc/core/rpcserver.h"
#include "vm/luavm/appaccount.h"
#include "wallet/wallet.h"
#include "wallet/walletdb.h"
#include "tx/mulsigtx.h"

#include <stdint.h>
#include <boost/assign/list_of.hpp>

using namespace std;
using namespace boost;
using namespace boost::assign;
using namespace json_spirit;

Value gensendtxraw(const Array& params, bool fHelp) {
    if (fHelp || (params.size() != 6 && params.size() != 7))
        throw runtime_error(
                "submitsendtx \"from\" \"to\" \"symbol:coin:unit\" \"symbol:fee:unit\" [\"memo\"]\n"
                "\nSend coins to a given address.\n" +
                HelpRequiringPassphrase() +
                "\nArguments:\n"
                "1.\"txAddress\":           (string, required) the address use to create signature"
                "2.\"submit_height\":       (numberic,required) height when submit"
                "3.\"from\":                (string, required) The address where coins are sent from\n"
                "4.\"to\":                  (string, required) The address where coins are received\n"
                "5.\"symbol:coin:unit\":    (symbol:amount:unit, required) transferred coins\n"
                "6.\"symbol:fee:unit\":     (symbol:amount:unit, required) fee paid to miner, default is GVC:10000:sawi\n"
                "7.\"memo\":                (string, optional)\n"
                "\nResult:\n"
                "\"txid\"                   (string) The transaction id.\n"
                "\nExamples:\n" +
                HelpExampleCli("submitsendtx",
                               "\"wLKf2NqwtHk3BfzK5wMDfbKYN1SC3weyR4\" \"wNDue1jHcgRSioSDL4o1AzXz3D72gCMkP6\" "
                               "\"GVC:1000000:sawi\" \"GVC:10000:sawi\" \"Hello, GreenVenturesChain!\"") +
                "\nAs json rpc call\n" +
                HelpExampleRpc("submitsendtx",
                               "\"wLKf2NqwtHk3BfzK5wMDfbKYN1SC3weyR4\", \"wNDue1jHcgRSioSDL4o1AzXz3D72gCMkP6\", "
                               "\"GVC:1000000:sawi\", \"GVC:10000:sawi\", \"Hello, GreenVenturesChain!\""));

    EnsureWalletIsUnlocked();

    CKeyID keyID       = CKeyID(params[0].get_str()) ;
    int32_t height     = params[1].get_int() ;
    CUserID sendUserId = RPC_PARAM::GetUserId(params[2], true);
    CUserID recvUserId = RPC_PARAM::GetUserId(params[3]);
    ComboMoney cmCoin  = RPC_PARAM::GetComboMoney(params[4], SYMB::GVC);
    ComboMoney cmFee   = RPC_PARAM::GetFee(params, 5, UCOIN_TRANSFER_TX);

    if (cmCoin.amount == 0)
        throw JSONRPCError(RPC_INVALID_PARAMETER, "Coins is zero!");
    string memo    = params.size() == 7 ? params[6].get_str() : "";

    std::shared_ptr<CCoinTransferTx> tx;

    tx = std::make_shared<CCoinTransferTx>(sendUserId, recvUserId, height, cmCoin.symbol,
                                                cmCoin.GetSawiAmount(), cmFee.symbol, cmFee.GetSawiAmount(), memo);

    if (!pWalletMain->Sign(keyID, tx->GetHash(), tx->signature)) {
        throw JSONRPCError(RPC_INVALID_PARAMETER,  "Sign failed");
    }

    CDataStream ds(SER_DISK, CLIENT_VERSION);
    ds << tx;
    Object obj;
    obj.push_back(Pair("rawtx", HexStr(ds.begin(), ds.end())));
    return obj;
}

max_stars_repo_name: GreenVentures/GreenVenturesChain

max_issues_repo_name: GreenVentures/GreenVenturesChain

max_forks_repo_name: GreenVentures/GreenVenturesChain


text:
#ifndef CV_TO_EIGEN_HPP
#define CV_TO_EIGEN_HPP

#include <opencv2/core.hpp>

#include <Eigen/Dense>

/*! \file cv_to_eigen.hpp
    \brief collect some tools to transform cv::Mat to\n
    Eigen matrix
*/

/*!
 *  \addtogroup ocv
 *  @{
 */
namespace ocv{

/*!
 *  \addtogroup eigen
 *  @{
 */
namespace eigen{

template<typename T>
using MatRowMajor =
Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic,
Eigen::RowMajor>;

template<typename T>
void cv2eigen_cpy(cv::Mat const &input, MatRowMajor<T> &output){
    output.resize(input.rows, input.cols);
    cv::Mat dst(input.rows, input.cols, cv::DataType<T>::type,
                static_cast<void*>(output.data()),
                static_cast<size_t>(output.stride()*sizeof(T)));
    input.convertTo(dst, dst.type());
}

template<typename T>
void eigen2cv_cpy(MatRowMajor<T> const &input, cv::Mat &output)
{
    cv::Mat src(static_cast<int>(input.rows()),
                static_cast<int>(input.cols()),
                cv::DataType<T>::type,
                (void*)input.data(),
                static_cast<size_t>(input.stride()*sizeof(T)));
    src.copyTo(output);
}

template<typename T>
cv::Mat eigen2cv_ref(MatRowMajor<T> const &input)
{
    return cv::Mat(static_cast<int>(input.rows()),
                   static_cast<int>(input.cols()),
                   cv::DataType<T>::type,
                   (void*)input.data(),
                   static_cast<size_t>(input.stride()*sizeof(T)));
}

/**
 *@brief create memory align cv::Mat
 */
template<typename T>
class align_cv_mat
{
    static_assert(std::is_arithmetic<T>::value,
                  "T should be arithmetic type");
public:
    align_cv_mat() : buffer_{nullptr}{}
    ~align_cv_mat()
    {
        destroy();
    }

    align_cv_mat(align_cv_mat const&) = delete;
    align_cv_mat(align_cv_mat &&) = delete;
    align_cv_mat& operator=(align_cv_mat const&) = delete;
    align_cv_mat& operator=(align_cv_mat &&) = delete;

    /**
     * @brief create the memory align cv::Mat which meet\n
     * the memory alignment requirement of Eigen
     * @param rows the rows of the matrix
     * @param cols the cols of the matrix
     * @return memory align cv::Mat
     * @warning 1 : Do not release the memory of cv::Mat\n
     * by yourself, leave the resource management to align_mat.\n
     * This cv::Mat only borrow the buffer allocated by the\n
     * Eigen::aligned_allocator<T>.\n
     * 2 : Every time you create a new Mat, the older buffer\n
     * of the Mat will be released
     */
    cv::Mat create(int rows, int cols)
    {
        destroy();
        buffer_ = alloc_.allocate(rows*cols);
        return cv::Mat(rows, cols,
                       cv::DataType<T>::type,
                       static_cast<void*>(buffer_),
                       static_cast<size_t>(cols * sizeof(T)));
    }

    /**
     * @brief destroy the buffer
     */
    void destroy()
    {
        if(buffer_ != nullptr){
            alloc_.deallocate(reinterpret_cast<T*>(buffer_),
                              0);
            buffer_ = nullptr;
        }
    }

private:
    Eigen::aligned_allocator<T> alloc_;
    T *buffer_;
};

} /*! @} End of Doxygen Groups*/

} /*! @} End of Doxygen Groups*/

#endif // CV_TO_EIGEN_HPP

ext: hpp


text:
/*
 * GridTools
 *
 * Copyright (c) 2014-2020, ETH Zurich
 * All rights reserved.
 *
 * Please, refer to the LICENSE file in the root directory.
 * SPDX-License-Identifier: BSD-3-Clause
 *
 */
#ifndef INCLUDED_GHEX_TL_CALLBACK_UTILS_HPP
#define INCLUDED_GHEX_TL_CALLBACK_UTILS_HPP

#include <boost/callable_traits.hpp>
#include <functional>
#include <memory>

/** @brief checks the arguments of callback function object */
#define GHEX_CHECK_CALLBACK_F(MESSAGE_TYPE, RANK_TYPE, TAG_TYPE)                              \
    using args_t = boost::callable_traits::args_t<CallBack>;                                  \
    using arg0_t = std::tuple_element_t<0, args_t>;                                           \
    using arg1_t = std::tuple_element_t<1, args_t>;                                           \
    using arg2_t = std::tuple_element_t<2, args_t>;                                           \
    static_assert(std::tuple_size<args_t>::value==3,                                          \
        "callback must have 3 arguments");                                                    \
    static_assert(std::is_same<arg1_t,RANK_TYPE>::value,                                      \
        "rank_type is not convertible to second callback argument type");                     \
    static_assert(std::is_same<arg2_t,TAG_TYPE>::value,                                       \
        "tag_type is not convertible to third callback argument type");                       \
    static_assert(std::is_same<arg0_t,MESSAGE_TYPE>::value,                                   \
        "first callback argument type is not a message_type");

namespace gridtools {
    namespace ghex {
        namespace tl {
            namespace cb {

                /** @brief shared request state for completion handlers returned by callback based sends/recvs. */
                struct request_state {
                    // volatile is needed to prevent the compiler
                    // from optimizing away the check of this member
                    volatile bool m_ready = false;
                    unsigned int m_index = 0;
                    request_state() = default;
                    request_state(bool r) noexcept : m_ready{r} {}
                    request_state(bool r, unsigned int i) noexcept : m_ready{r}, m_index{i} {}
                    bool is_ready() const noexcept { return m_ready; }
                    int queue_index() const noexcept { return m_index; }
                };

                /** @brief simple request with shared state as member returned by callback based send/recvs. */
                struct request
                {
                    std::shared_ptr<request_state> m_request_state;
                    bool is_ready() const noexcept { return m_request_state->is_ready(); }
                    void reset() { m_request_state.reset(); }
                    int queue_index() const noexcept { return m_request_state->queue_index(); }
                };

                /** @brief simple wrapper around an l-value reference message (stores pointer and size)
                  * @tparam T value type of the messages content */
                template<typename T>
                struct ref_message
                {
                    using value_type = T;
                    T* m_data;
                    std::size_t m_size;
                    T* data() noexcept { return m_data; }
                    const T* data() const noexcept { return m_data; }
                    std::size_t size() const noexcept { return m_size; }
                };

                /** @brief type erased message capable of holding any message. Uses optimized initialization for
                  * ref_messages and std::shared_ptr pointing to messages. */
                struct any_message
                {
                    using value_type = unsigned char;

                    // common interface to a message
                    struct iface
                    {
                        virtual unsigned char* data() noexcept = 0;
                        virtual const unsigned char* data() const noexcept = 0;
                        virtual std::size_t size() const noexcept = 0;
                        virtual ~iface() {}
                    };

                    // struct which holds the actual message and provides access through the interface iface
                    template<class Message>
                    struct holder final : public iface
                    {
                        using value_type = typename Message::value_type;
                        Message m_message;
                        holder(Message&& m): m_message{std::move(m)} {}

                        unsigned char* data() noexcept override { return reinterpret_cast<unsigned char*>(m_message.data()); }
                        const unsigned char* data() const noexcept override { return reinterpret_cast<const unsigned char*>(m_message.data()); }
                        std::size_t size() const noexcept override { return sizeof(value_type)*m_message.size(); }
                    };

                    unsigned char* __restrict m_data = nullptr;
                    std::size_t m_size;
                    std::unique_ptr<iface> m_ptr;
                    std::shared_ptr<char> m_ptr2;

                    /** @brief Construct from an r-value: moves the message inside the type-erased structure.
                      * Requires the message not to reallocate during the move. Note, that this operation will allocate
                      * storage on the heap for the holder structure of the message.
                      * @tparam Message a message type
                      * @param m a message */
                    template<class Message>
                    any_message(Message&& m)
                    : m_data{reinterpret_cast<unsigned char*>(m.data())}
                    , m_size{m.size()*sizeof(typename Message::value_type)}
                    , m_ptr{std::make_unique<holder<Message>>(std::move(m))}
                    {}

                    /** @brief Construct from a reference: copies the pointer to the data and size of the data.
                      * Note, that this operation will not allocate storage on the heap.
                      * @tparam T a message type
                      * @param m a ref_message to a message. */
                    template<typename T>
                    any_message(ref_message<T>&& m)
                    : m_data{reinterpret_cast<unsigned char*>(m.data())}
                    , m_size{m.size()*sizeof(T)}
                    {}

                    /** @brief Construct from a shared pointer: will share ownership with the shared pointer (aliasing)
                      * and keeps the message wrapped by the shared pointer alive. Note, that this operation may
                      * allocate on the heap, but does not allocate storage for the holder structure.
                      * @tparam Message a message type
                      * @param sm a shared pointer to a message*/
                    template<typename Message>
                    any_message(std::shared_ptr<Message>& sm)
                    : m_data{reinterpret_cast<unsigned char*>(sm->data())}
                    , m_size{sm->size()*sizeof(typename Message::value_type)}
                    , m_ptr2(sm,reinterpret_cast<char*>(sm.get()))
                    {}

                    any_message(any_message&&) = default;
                    any_message& operator=(any_message&&) = default;

                    unsigned char* data() noexcept { return m_data;}
                    const unsigned char* data() const noexcept { return m_data; }
                    std::size_t size() const noexcept { return m_size; }
                };

                /** @brief A container for storing callbacks and progressing them.
                  * @tparam FutureType a future type
                  * @tparam RankType the rank type (integer)
                  * @tparam TagType the tag type (integer) */
                template<class FutureType, typename RankType = int, typename TagType = int>
                class callback_queue{
                  public: // member types
                    using message_type = any_message;
                    using future_type = FutureType;
                    using rank_type = RankType;
                    using tag_type = TagType;
                    using cb_type = std::function<void(message_type, rank_type, tag_type)>;

                    // internal element which is stored in the queue
                    struct element_type {
                        message_type m_msg;
                        rank_type m_rank;
                        tag_type m_tag;
                        cb_type m_cb;
                        future_type m_future;
                        request m_request;
                    };

                    using queue_type = std::vector<element_type>;

                  private: // members
                    queue_type m_queue;

                  public:
                    int m_progressed_cancels = 0;

                  public: // ctors
                    callback_queue() { m_queue.reserve(256); }

                  public: // member functions
                    /** @brief Add a callback to the queue and receive a completion handle (request).
                      * @tparam Callback callback type
                      * @param msg the message (data)
                      * @param rank the destination/source rank
                      * @param tag the message tag
                      * @param fut the send/recv operation's return value
                      * @param cb the callback
                      * @return returns a completion handle */
                    template<typename Callback>
                    request enqueue(message_type&& msg, rank_type rank, tag_type tag, future_type&& fut, Callback&& cb) {
                        request m_req{std::make_shared<request_state>(false,m_queue.size())};
                        m_queue.push_back(element_type{std::move(msg), rank, tag, std::forward<Callback>(cb), std::move(fut),
                                             m_req});
                        return m_req;
                    }

                    auto size() const noexcept { return m_queue.size(); }

                    /** @brief progress the queue and call the callbacks if the futures are ready. Note, that the order
                      * of progression is not defined.
                      * @return number of progressed elements */
                    int progress() {
                        int completed = 0;
                        while (true) {
                            auto it = future_type::test_any(m_queue.begin(), m_queue.end(),
                                [](auto& x) -> future_type& { return x.m_future; });
                            if (it != m_queue.end()) {
                                auto& element = *it;
                                const std::size_t i = it-m_queue.begin();
                                element.m_cb(std::move(element.m_msg), element.m_rank, element.m_tag);
                                ++completed;
                                element.m_request.m_request_state->m_ready = true;
                                if (i + 1 < m_queue.size()) {
                                    element = std::move(m_queue.back());
                                    element.m_request.m_request_state->m_index = i;
                                }
                                m_queue.pop_back();
                            }
                            else
                                break;
                        }
                        return completed;
                    }

                    /** @brief Cancel a callback
                      * @param index the queue index - access to this index is given through the request returned when
                      * enqueing.
                      * @return true if cancelling was successful */
                    bool cancel(unsigned int index)
                    {
                        auto& element = m_queue[index];
                        auto res = element.m_future.cancel();
                        if (!res) return false;
                        if (m_queue.size() > index+1)
                        {
                            element = std::move(m_queue.back());
                            element.m_request.m_request_state->m_index = index;
                        }
                        m_queue.pop_back();
                        ++m_progressed_cancels;
                        return true;
                    }
                };

                /** @brief a class to return the number of progressed callbacks */
                struct progress_status {
                    int m_num_sends = 0;
                    int m_num_recvs = 0;
                    int m_num_cancels = 0;

                    int num() const noexcept { return m_num_sends+m_num_recvs+m_num_cancels; }
                    int num_sends() const noexcept { return m_num_sends; }
                    int num_recvs() const noexcept { return m_num_recvs; }
                    int num_cancels() const noexcept { return m_num_cancels; }

                    progress_status& operator+=(const progress_status& other) noexcept {
                        m_num_sends += other.m_num_sends;
                        m_num_recvs += other.m_num_recvs;
                        m_num_cancels += other.m_num_cancels;
                        return *this;
                    }
                };

            } // cb
        } // tl
    } // ghex
} // gridtools

#endif /* INCLUDED_GHEX_TL_CALLBACK_UTILS_HPP */

max_stars_repo_name: tehrengruber/GHEX

max_issues_repo_name: tehrengruber/GHEX

max_forks_repo_name: tehrengruber/GHEX


text:
/***********************************************************************************************************************
*  OpenStudio(R), Copyright (c) 2008-2019, Alliance for Sustainable Energy, LLC, and other contributors. All rights reserved.
*
*  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
*  following conditions are met:
*
*  (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following
*  disclaimer.
*
*  (2) 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.
*
*  (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote products
*  derived from this software without specific prior written permission from the respective party.
*
*  (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative works
*  may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without specific prior
*  written permission from Alliance for Sustainable Energy, LLC.
*
*  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND ANY CONTRIBUTORS "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 THE COPYRIGHT HOLDER(S), ANY CONTRIBUTORS, THE UNITED STATES GOVERNMENT, OR THE UNITED
*  STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR EMPLOYEES, 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 "AirflowNetworkSimulationControl.hpp"
#include "AirflowNetworkSimulationControl_Impl.hpp"

#include "Model.hpp"
#include "ConvergenceLimits.hpp"
#include "ConvergenceLimits_Impl.hpp"
#include "HeatBalanceAlgorithm.hpp"
#include "HeatBalanceAlgorithm_Impl.hpp"
#include "InsideSurfaceConvectionAlgorithm.hpp"
#include "InsideSurfaceConvectionAlgorithm_Impl.hpp"
#include "OutsideSurfaceConvectionAlgorithm.hpp"
#include "OutsideSurfaceConvectionAlgorithm_Impl.hpp"
#include "RunPeriod.hpp"
#include "RunPeriod_Impl.hpp"
#include "ShadowCalculation.hpp"
#include "ShadowCalculation_Impl.hpp"
#include "SizingPeriod.hpp"
#include "SizingPeriod_Impl.hpp"
#include "SizingParameters.hpp"
#include "SizingParameters_Impl.hpp"
#include "Timestep.hpp"
#include "Timestep_Impl.hpp"
#include "WeatherFile.hpp"
#include "WeatherFile_Impl.hpp"
#include "ZoneAirContaminantBalance.hpp"
#include "ZoneAirContaminantBalance_Impl.hpp"
#include "ZoneAirHeatBalanceAlgorithm.hpp"
#include "ZoneAirHeatBalanceAlgorithm_Impl.hpp"
#include "ZoneCapacitanceMultiplierResearchSpecial.hpp"
#include "ZoneCapacitanceMultiplierResearchSpecial_Impl.hpp"

#include <utilities/idd/IddFactory.hxx>
#include <utilities/idd/OS_AirflowNetworkSimulationControl_FieldEnums.hxx>

#include "../utilities/sql/SqlFile.hpp"
#include "../utilities/core/Assert.hpp"
#include "../utilities/core/Compare.hpp"
#include "../utilities/units/Unit.hpp"

#include <boost/bind.hpp>

namespace openstudio{
namespace model{

namespace detail{

AirflowNetworkSimulationControl_Impl::AirflowNetworkSimulationControl_Impl(const IdfObject& idfObject, Model_Impl* model, bool keepHandle)
: ParentObject_Impl(idfObject, model, keepHandle)
{
  OS_ASSERT(idfObject.iddObject().type() == AirflowNetworkSimulationControl::iddObjectType());
}

AirflowNetworkSimulationControl_Impl::AirflowNetworkSimulationControl_Impl(
  const openstudio::detail::WorkspaceObject_Impl& other,Model_Impl* model,bool keepHandle)
  : ParentObject_Impl(other,model,keepHandle)
{
  OS_ASSERT(other.iddObject().type() == AirflowNetworkSimulationControl::iddObjectType());
}

AirflowNetworkSimulationControl_Impl::AirflowNetworkSimulationControl_Impl(const AirflowNetworkSimulationControl_Impl& other,
                                                                           Model_Impl* model,
                                                                           bool keepHandle)
                                                                           : ParentObject_Impl(other,model,keepHandle)
{
}

AirflowNetworkSimulationControl_Impl::~AirflowNetworkSimulationControl_Impl()
{}

// return the parent object in the hierarchy
boost::optional<ParentObject> AirflowNetworkSimulationControl_Impl::parent() const
{
  // Simulation is highest level, there is no parent
  return boost::optional<ParentObject>();
}

// return any children objects in the hierarchy
std::vector<ModelObject> AirflowNetworkSimulationControl_Impl::children() const
{
  std::vector<ModelObject> result;

  /*
  OptionalConvergenceLimits ocl = convergenceLimits();
  if (ocl) { result.push_back(*ocl); }

  //OptionalDaylightSavingsTime odst = daylightSavingsTime();
  //if (odst) { result.push_back(*odst); }

  OptionalHeatBalanceAlgorithm ohba = heatBalanceAlgorithm();
  if (ohba) { result.push_back(*ohba); }

  OptionalInsideSurfaceConvectionAlgorithm oisca = insideSurfaceConvectionAlgorithm();
  if (oisca) { result.push_back(*oisca); }

  OptionalOutsideSurfaceConvectionAlgorithm oosca = outsideSurfaceConvectionAlgorithm();
  if (oosca) { result.push_back(*oosca); }

  RunPeriodVector rps = runPeriods();
  result.insert(result.end(),rps.begin(),rps.end());

  OptionalShadowCalculation osc = shadowCalculation();
  if (osc) { result.push_back(*osc); }

  //SpecialDaysVector sds = specialDays();
  //result.insert(result.end(),sds.begin(),sds.end());

  OptionalSizingParameters osp = sizingParameters();
  if (osp) { result.push_back(*osp); }

  OptionalTimestep ot = timestep();
  if (ot) { result.push_back(*ot); }

  OptionalZoneAirContaminantBalance ozacb = zoneAirContaminantBalance();
  if (ozacb) { result.push_back(*ozacb); }

  OptionalZoneAirHeatBalanceAlgorithm ozahba = zoneAirHeatBalanceAlgorithm();
  if (ozahba) { result.push_back(*ozahba); }

  OptionalZoneCapacitanceMultiplierResearchSpecial ozcmrs;
  ozcmrs = zoneCapacitanceMultiplierResearchSpecial();
  if (ozcmrs) { result.push_back(*ozcmrs); }
  */

  return result;
}

std::vector<IddObjectType> AirflowNetworkSimulationControl_Impl::allowableChildTypes() const {
  IddObjectTypeVector result;
  /*
  result.push_back(ConvergenceLimits::iddObjectType());
  result.push_back(HeatBalanceAlgorithm::iddObjectType());
  result.push_back(InsideSurfaceConvectionAlgorithm::iddObjectType());
  result.push_back(OutsideSurfaceConvectionAlgorithm::iddObjectType());
  result.push_back(RunPeriod::iddObjectType());
  result.push_back(ShadowCalculation::iddObjectType());
  result.push_back(SizingParameters::iddObjectType());
  result.push_back(Timestep::iddObjectType());
  result.push_back(ZoneAirContaminantBalance::iddObjectType());
  result.push_back(ZoneAirHeatBalanceAlgorithm::iddObjectType());
  result.push_back(ZoneCapacitanceMultiplierResearchSpecial::iddObjectType());
  */
  return result;
}

const std::vector<std::string>& AirflowNetworkSimulationControl_Impl::outputVariableNames() const
{
  static std::vector<std::string> result;
  return result;
}

IddObjectType AirflowNetworkSimulationControl_Impl::iddObjectType() const {
  return AirflowNetworkSimulationControl::iddObjectType();
}

boost::optional<std::string> AirflowNetworkSimulationControl_Impl::airflowNetworkControl() const
{
  return getString(OS_AirflowNetworkSimulationControlFields::AirflowNetworkControl,true);
}

bool AirflowNetworkSimulationControl_Impl::isAirflowNetworkControlDefaulted() const {
  return isEmpty(OS_AirflowNetworkSimulationControlFields::AirflowNetworkControl);
}

bool AirflowNetworkSimulationControl_Impl::setAirflowNetworkControl(std::string control)
{
  return setString(OS_AirflowNetworkSimulationControlFields::AirflowNetworkControl, control);
}

void AirflowNetworkSimulationControl_Impl::resetAirflowNetworkControl() {
  bool result = setString(OS_AirflowNetworkSimulationControlFields::AirflowNetworkControl, "");
  OS_ASSERT(result);
}

boost::optional<std::string> AirflowNetworkSimulationControl_Impl::windPressureCoefficientType() const
{
  return getString(OS_AirflowNetworkSimulationControlFields::WindPressureCoefficientType,true);
}

bool AirflowNetworkSimulationControl_Impl::isWindPressureCoefficientTypeDefaulted() const {
  return isEmpty(OS_AirflowNetworkSimulationControlFields::WindPressureCoefficientType);
}

bool AirflowNetworkSimulationControl_Impl::setWindPressureCoefficientType(std::string type)
{
  return setString(OS_AirflowNetworkSimulationControlFields::WindPressureCoefficientType, type);
}

void AirflowNetworkSimulationControl_Impl::resetWindPressureCoefficientType() {
  bool result = setString(OS_AirflowNetworkSimulationControlFields::WindPressureCoefficientType, "");
  OS_ASSERT(result);
}

boost::optional<std::string> AirflowNetworkSimulationControl_Impl::heightSelectionforLocalWindPressureCalculation() const
{
  return getString(OS_AirflowNetworkSimulationControlFields::HeightSelectionforLocalWindPressureCalculation, true);
}

bool AirflowNetworkSimulationControl_Impl::isHeightSelectionforLocalWindPressureCalculationDefaulted() const
{
  return isEmpty(OS_AirflowNetworkSimulationControlFields::HeightSelectionforLocalWindPressureCalculation);
}

bool AirflowNetworkSimulationControl_Impl::setHeightSelectionforLocalWindPressureCalculation(std::string type)
{
  return setString(OS_AirflowNetworkSimulationControlFields::HeightSelectionforLocalWindPressureCalculation, type);
}

void AirflowNetworkSimulationControl_Impl::resetHeightSelectionforLocalWindPressureCalculation() {
  bool result = setString(OS_AirflowNetworkSimulationControlFields::HeightSelectionforLocalWindPressureCalculation, "");
  OS_ASSERT(result);
}

boost::optional<std::string> AirflowNetworkSimulationControl_Impl::buildingType() const
{
  return getString(OS_AirflowNetworkSimulationControlFields::BuildingType,true);
}

bool AirflowNetworkSimulationControl_Impl::isBuildingTypeDefaulted() const {
  return isEmpty(OS_AirflowNetworkSimulationControlFields::BuildingType);
}

bool AirflowNetworkSimulationControl_Impl::setBuildingType(std::string type)
{
  return setString(OS_AirflowNetworkSimulationControlFields::BuildingType, type);
}

void AirflowNetworkSimulationControl_Impl::resetBuildingType() {
  bool result = setString(OS_AirflowNetworkSimulationControlFields::BuildingType, "");
  OS_ASSERT(result);
}

boost::optional<int> AirflowNetworkSimulationControl_Impl::maximumNumberofIterations() const
{
  return getInt(OS_AirflowNetworkSimulationControlFields::MaximumNumberofIterations,true);
}

bool AirflowNetworkSimulationControl_Impl::isMaximumNumberofIterationsDefaulted() const {
  return isEmpty(OS_AirflowNetworkSimulationControlFields::MaximumNumberofIterations);
}

bool AirflowNetworkSimulationControl_Impl::setMaximumNumberofIterations(int number)
{
  return setInt(OS_AirflowNetworkSimulationControlFields::MaximumNumberofIterations, number);
}

void AirflowNetworkSimulationControl_Impl::resetMaximumNumberofIterations() {
  bool result = setString(OS_AirflowNetworkSimulationControlFields::MaximumNumberofIterations, "");
  OS_ASSERT(result);
}

boost::optional<std::string> AirflowNetworkSimulationControl_Impl::initializationType() const
{
  return getString(OS_AirflowNetworkSimulationControlFields::InitializationType,true);
}

bool AirflowNetworkSimulationControl_Impl::isInitializationTypeDefaulted() const {
  return isEmpty(OS_AirflowNetworkSimulationControlFields::InitializationType);
}

bool AirflowNetworkSimulationControl_Impl::setInitializationType(std::string type)
{
  return setString(OS_AirflowNetworkSimulationControlFields::InitializationType, type);
}

void AirflowNetworkSimulationControl_Impl::resetInitializationType() {
  bool result = setString(OS_AirflowNetworkSimulationControlFields::InitializationType, "");
  OS_ASSERT(result);
}

boost::optional<double> AirflowNetworkSimulationControl_Impl::relativeAirflowConvergenceTolerance() const
{
  return getDouble(OS_AirflowNetworkSimulationControlFields::RelativeAirflowConvergenceTolerance,true);
}

bool AirflowNetworkSimulationControl_Impl::isRelativeAirflowConvergenceToleranceDefaulted() const {
  return isEmpty(OS_AirflowNetworkSimulationControlFields::RelativeAirflowConvergenceTolerance);
}

bool AirflowNetworkSimulationControl_Impl::setRelativeAirflowConvergenceTolerance(double tolerance)
{
  return setDouble(OS_AirflowNetworkSimulationControlFields::RelativeAirflowConvergenceTolerance, tolerance);
}

void AirflowNetworkSimulationControl_Impl::resetRelativeAirflowConvergenceTolerance() {
  bool result = setString(OS_AirflowNetworkSimulationControlFields::RelativeAirflowConvergenceTolerance, "");
  OS_ASSERT(result);
}

boost::optional<double> AirflowNetworkSimulationControl_Impl::absoluteAirflowConvergenceTolerance() const
{
  return getDouble(OS_AirflowNetworkSimulationControlFields::AbsoluteAirflowConvergenceTolerance,true);
}

bool AirflowNetworkSimulationControl_Impl::isAbsoluteAirflowConvergenceToleranceDefaulted() const {
  return isEmpty(OS_AirflowNetworkSimulationControlFields::AbsoluteAirflowConvergenceTolerance);
}

bool AirflowNetworkSimulationControl_Impl::setAbsoluteAirflowConvergenceTolerance(double tolerance)
{
  return setDouble(OS_AirflowNetworkSimulationControlFields::AbsoluteAirflowConvergenceTolerance, tolerance);
}

void AirflowNetworkSimulationControl_Impl::resetAbsoluteAirflowConvergenceTolerance() {
  bool result = setString(OS_AirflowNetworkSimulationControlFields::AbsoluteAirflowConvergenceTolerance, "");
  OS_ASSERT(result);
}

boost::optional<double> AirflowNetworkSimulationControl_Impl::convergenceAccelerationLimit() const
{
  return getDouble(OS_AirflowNetworkSimulationControlFields::ConvergenceAccelerationLimit,true);
}

bool AirflowNetworkSimulationControl_Impl::isConvergenceAccelerationLimitDefaulted() const {
  return isEmpty(OS_AirflowNetworkSimulationControlFields::ConvergenceAccelerationLimit);
}

bool AirflowNetworkSimulationControl_Impl::setConvergenceAccelerationLimit(double limit)
{
  return setDouble(OS_AirflowNetworkSimulationControlFields::ConvergenceAccelerationLimit, limit);
}

void AirflowNetworkSimulationControl_Impl::resetConvergenceAccelerationLimit() {
  bool result = setString(OS_AirflowNetworkSimulationControlFields::ConvergenceAccelerationLimit, "");
  OS_ASSERT(result);
}

boost::optional<double> AirflowNetworkSimulationControl_Impl::azimuthAngleofLongAxisofBuilding() const
{
  return getDouble(OS_AirflowNetworkSimulationControlFields::AzimuthAngleofLongAxisofBuilding,true);
}

bool AirflowNetworkSimulationControl_Impl::isAzimuthAngleofLongAxisofBuildingDefaulted() const {
  return isEmpty(OS_AirflowNetworkSimulationControlFields::AzimuthAngleofLongAxisofBuilding);
}

bool AirflowNetworkSimulationControl_Impl::setAzimuthAngleofLongAxisofBuilding(double angle)
{
  return setDouble(OS_AirflowNetworkSimulationControlFields::AzimuthAngleofLongAxisofBuilding, angle);
}

void AirflowNetworkSimulationControl_Impl::resetAzimuthAngleofLongAxisofBuilding() {
  bool result = setString(OS_AirflowNetworkSimulationControlFields::AzimuthAngleofLongAxisofBuilding, "");
  OS_ASSERT(result);
}

boost::optional<double> AirflowNetworkSimulationControl_Impl::buildingAspectRatio() const
{
  return getDouble(OS_AirflowNetworkSimulationControlFields::RatioofBuildingWidthAlongShortAxistoWidthAlongLongAxis,true);
}

bool AirflowNetworkSimulationControl_Impl::isBuildingAspectRatioDefaulted() const {
  return isEmpty(OS_AirflowNetworkSimulationControlFields::RatioofBuildingWidthAlongShortAxistoWidthAlongLongAxis);
}

bool AirflowNetworkSimulationControl_Impl::setBuildingAspectRatio(double ratio)
{
  return setDouble(OS_AirflowNetworkSimulationControlFields::RatioofBuildingWidthAlongShortAxistoWidthAlongLongAxis, ratio);
}

void AirflowNetworkSimulationControl_Impl::resetBuildingAspectRatio() {
  bool result = setString(OS_AirflowNetworkSimulationControlFields::RatioofBuildingWidthAlongShortAxistoWidthAlongLongAxis, "");
  OS_ASSERT(result);
}

bool AirflowNetworkSimulationControl_Impl::heightDependenceofExternalNodeTemperature() const
{
  boost::optional<std::string> opt = getString(OS_AirflowNetworkSimulationControlFields::HeightDependenceofExternalNodeTemperature, true);
  if (opt) {
    return openstudio::istringEqual(opt.get(), "Yes");
  }
  return false; // Default is "No"
}

bool AirflowNetworkSimulationControl_Impl::isHeightDependenceofExternalNodeTemperatureDefaulted() const {
  return isEmpty(OS_AirflowNetworkSimulationControlFields::HeightDependenceofExternalNodeTemperature);
}

bool AirflowNetworkSimulationControl_Impl::setHeightDependenceofExternalNodeTemperature(bool tf)
{
  if (tf) {
    return setString(OS_AirflowNetworkSimulationControlFields::HeightDependenceofExternalNodeTemperature, "Yes");
  }
  return setString(OS_AirflowNetworkSimulationControlFields::HeightDependenceofExternalNodeTemperature, "No");
}

void AirflowNetworkSimulationControl_Impl::resetHeightDependenceofExternalNodeTemperature() {
  bool result = setString(OS_AirflowNetworkSimulationControlFields::HeightDependenceofExternalNodeTemperature, "");
  OS_ASSERT(result);
}

} // detail

AirflowNetworkSimulationControl::AirflowNetworkSimulationControl( const Model& model ):
ParentObject(iddObjectType(),model)
{
  OS_ASSERT(getImpl<detail::AirflowNetworkSimulationControl_Impl>());
}

AirflowNetworkSimulationControl::AirflowNetworkSimulationControl(std::shared_ptr<detail::AirflowNetworkSimulationControl_Impl> impl)
: ParentObject(impl)
{}

IddObjectType AirflowNetworkSimulationControl::iddObjectType()
{
  return IddObjectType(IddObjectType::OS_AirflowNetworkSimulationControl);
}

boost::optional<std::string> AirflowNetworkSimulationControl::airflowNetworkControl() const
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->airflowNetworkControl();
}

bool AirflowNetworkSimulationControl::isAirflowNetworkControlDefaulted() const {
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->isAirflowNetworkControlDefaulted();
}

boost::optional<std::string> AirflowNetworkSimulationControl::windPressureCoefficientType() const
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->windPressureCoefficientType();
}

bool AirflowNetworkSimulationControl::isWindPressureCoefficientTypeDefaulted() const {
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->isWindPressureCoefficientTypeDefaulted();
}

boost::optional<std::string> AirflowNetworkSimulationControl::heightSelectionforLocalWindPressureCalculation() const
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->heightSelectionforLocalWindPressureCalculation();
}

bool AirflowNetworkSimulationControl::isHeightSelectionforLocalWindPressureCalculationDefaulted() const {
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->isHeightSelectionforLocalWindPressureCalculationDefaulted();
}

boost::optional<std::string> AirflowNetworkSimulationControl::buildingType() const
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->buildingType();
}

bool AirflowNetworkSimulationControl::isBuildingTypeDefaulted() const {
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->isBuildingTypeDefaulted();
}

boost::optional<int> AirflowNetworkSimulationControl::maximumNumberofIterations() const
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->maximumNumberofIterations();
}

bool AirflowNetworkSimulationControl::isMaximumNumberofIterationsDefaulted() const {
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->isMaximumNumberofIterationsDefaulted();
}

boost::optional<std::string> AirflowNetworkSimulationControl::initializationType() const
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->initializationType();
}

bool AirflowNetworkSimulationControl::isInitializationTypeDefaulted() const {
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->isInitializationTypeDefaulted();
}

boost::optional<double> AirflowNetworkSimulationControl::relativeAirflowConvergenceTolerance() const
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->relativeAirflowConvergenceTolerance();
}

bool AirflowNetworkSimulationControl::isRelativeAirflowConvergenceToleranceDefaulted() const {
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->isRelativeAirflowConvergenceToleranceDefaulted();
}

boost::optional<double> AirflowNetworkSimulationControl::absoluteAirflowConvergenceTolerance() const
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->absoluteAirflowConvergenceTolerance();
}

bool AirflowNetworkSimulationControl::isAbsoluteAirflowConvergenceToleranceDefaulted() const {
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->isAbsoluteAirflowConvergenceToleranceDefaulted();
}

boost::optional<double> AirflowNetworkSimulationControl::convergenceAccelerationLimit() const
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->convergenceAccelerationLimit();
}

bool AirflowNetworkSimulationControl::isConvergenceAccelerationLimitDefaulted() const {
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->isConvergenceAccelerationLimitDefaulted();
}

boost::optional<double> AirflowNetworkSimulationControl::azimuthAngleofLongAxisofBuilding() const
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->azimuthAngleofLongAxisofBuilding();
}

bool AirflowNetworkSimulationControl::isAzimuthAngleofLongAxisofBuildingDefaulted() const {
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->isAzimuthAngleofLongAxisofBuildingDefaulted();
}

boost::optional<double> AirflowNetworkSimulationControl::buildingAspectRatio() const
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->buildingAspectRatio();
}

bool AirflowNetworkSimulationControl::isBuildingAspectRatioDefaulted() const
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->isBuildingAspectRatioDefaulted();
}

bool AirflowNetworkSimulationControl::heightDependenceofExternalNodeTemperature() const
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->heightDependenceofExternalNodeTemperature();
}

bool AirflowNetworkSimulationControl::isHeightDependenceofExternalNodeTemperatureDefaulted() const
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->isHeightDependenceofExternalNodeTemperatureDefaulted();
}

bool AirflowNetworkSimulationControl::setAirflowNetworkControl(std::string airflowNetworkControl)
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->setAirflowNetworkControl(airflowNetworkControl);
}

void AirflowNetworkSimulationControl::resetAirflowNetworkControl()
{
  getImpl<detail::AirflowNetworkSimulationControl_Impl>()->resetAirflowNetworkControl();
}

bool AirflowNetworkSimulationControl::setWindPressureCoefficientType(std::string type)
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->setWindPressureCoefficientType(type);
}

void AirflowNetworkSimulationControl::resetWindPressureCoefficientType()
{
  getImpl<detail::AirflowNetworkSimulationControl_Impl>()->resetWindPressureCoefficientType();
}

bool AirflowNetworkSimulationControl::setHeightSelectionforLocalWindPressureCalculation(std::string height)
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->setHeightSelectionforLocalWindPressureCalculation(height);
}

void AirflowNetworkSimulationControl::resetHeightSelectionforLocalWindPressureCalculation()
{
  getImpl<detail::AirflowNetworkSimulationControl_Impl>()->resetHeightSelectionforLocalWindPressureCalculation();
}

bool AirflowNetworkSimulationControl::setBuildingType(std::string type)
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->setBuildingType(type);
}

void AirflowNetworkSimulationControl::resetBuildingType()
{
  getImpl<detail::AirflowNetworkSimulationControl_Impl>()->resetBuildingType();
}

bool AirflowNetworkSimulationControl::setMaximumNumberofIterations(int number)
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->setMaximumNumberofIterations(number);
}

void AirflowNetworkSimulationControl::resetMaximumNumberofIterations()
{
  getImpl<detail::AirflowNetworkSimulationControl_Impl>()->resetMaximumNumberofIterations();
}

bool AirflowNetworkSimulationControl::setInitializationType(std::string type)
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->setInitializationType(type);
}

void AirflowNetworkSimulationControl::resetInitializationType()
{
  getImpl<detail::AirflowNetworkSimulationControl_Impl>()->resetInitializationType();
}

bool AirflowNetworkSimulationControl::setRelativeAirflowConvergenceTolerance(double tolerance)
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->setRelativeAirflowConvergenceTolerance(tolerance);
}

void AirflowNetworkSimulationControl::resetRelativeAirflowConvergenceTolerance()
{
  getImpl<detail::AirflowNetworkSimulationControl_Impl>()->resetRelativeAirflowConvergenceTolerance();
}

bool AirflowNetworkSimulationControl::setAbsoluteAirflowConvergenceTolerance(double tolerance)
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->setAbsoluteAirflowConvergenceTolerance(tolerance);
}

void AirflowNetworkSimulationControl::resetAbsoluteAirflowConvergenceTolerance()
{
  getImpl<detail::AirflowNetworkSimulationControl_Impl>()->resetAbsoluteAirflowConvergenceTolerance();
}

bool AirflowNetworkSimulationControl::setConvergenceAccelerationLimit(double limit)
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->setConvergenceAccelerationLimit(limit);
}

void AirflowNetworkSimulationControl::resetConvergenceAccelerationLimit()
{
  getImpl<detail::AirflowNetworkSimulationControl_Impl>()->resetConvergenceAccelerationLimit();
}

bool AirflowNetworkSimulationControl::setAzimuthAngleofLongAxisofBuilding(double angle)
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->setAzimuthAngleofLongAxisofBuilding(angle);
}

void AirflowNetworkSimulationControl::resetAzimuthAngleofLongAxisofBuilding()
{
  getImpl<detail::AirflowNetworkSimulationControl_Impl>()->resetAzimuthAngleofLongAxisofBuilding();
}

bool AirflowNetworkSimulationControl::setBuildingAspectRatio(double ratio)
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->setBuildingAspectRatio(ratio);
}

void AirflowNetworkSimulationControl::resetBuildingAspectRatio()
{
  getImpl<detail::AirflowNetworkSimulationControl_Impl>()->resetBuildingAspectRatio();
}

bool AirflowNetworkSimulationControl::setHeightDependenceofExternalNodeTemperature(bool tf)
{
  return getImpl<detail::AirflowNetworkSimulationControl_Impl>()->setHeightDependenceofExternalNodeTemperature(tf);
}

void AirflowNetworkSimulationControl::resetHeightDependenceofExternalNodeTemperature()
{
  getImpl<detail::AirflowNetworkSimulationControl_Impl>()->resetHeightDependenceofExternalNodeTemperature();
}

} // model
} // openstudio

max_stars_repo_name: hellok-coder/OS-Testing

max_issues_repo_name: hellok-coder/OS-Testing

max_forks_repo_name: hellok-coder/OS-Testing


text:
/* Copyright (C) 5/23/18 Julian Stobbe - All Rights Reserved
 * You may use, distribute and modify this code under the
 * terms of the MIT license.
 *
 * partly taken from: https://stackoverflow.com/questions/18382457/eigen-and-boostserialize
 *
 * You should have received a copy of the MIT license with
 * this file.
 */

#ifndef VALUATION_IOHELPER_HPP
#define VALUATION_IOHELPER_HPP

#include <boost/filesystem/fstream.hpp>
#include <boost/serialization/vector.hpp>
#include <boost/archive/binary_iarchive.hpp>
#include <boost/archive/binary_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>
#include <boost/archive/xml_oarchive.hpp>
#include <boost/serialization/nvp.hpp>
#include <boost/serialization/version.hpp>
#include <iostream>

#include "Config.hpp"
#include "StatAcc.hpp"
#include "EigenDenseBaseAddons.hpp"

namespace MCUtil {

    template <typename T>
    bool write_to_binary(const T& data, const std::string& filename) {
        std::ofstream ofs(filename.c_str(), std::ios::out);
        if (!ofs.is_open())
            return false;
        {
            boost::archive::binary_oarchive oa(ofs);
            oa << data;
        }
        ofs.close();
        return true;
    }

    template <typename T>
    bool write_to_text(const T& data, const std::string& filename) {
        std::ofstream ofs(filename.c_str(), std::ios::out);
        if (!ofs.is_open())
            return false;
        {
            boost::archive::text_oarchive oa(ofs);
            oa << data;
        }
        ofs.close();
        return true;
    }

    template <typename T>
    bool read_from_binary(T& data, const std::string& filename) {
        std::ifstream ifs(filename.c_str(), std::ios::in);
        if (!ifs.is_open())
            return false;
        {
            boost::archive::binary_iarchive ia(ifs);
            ia >> data;
        }
        ifs.close();
        return true;
    }

    template <typename T>
    bool read_from_text(T& data, const std::string& filename) {
        std::ifstream ifs(filename.c_str(), std::ios::in);
        if (!ifs.is_open())
            return false;
        {
            boost::archive::text_iarchive ia(ifs);
            ia >> data;
        }
        ifs.close();
        return true;
    }

    /*
    template <typename T>
    bool write_to_xml(const T& data, const std::string& filename, const std::string& data_name) {
        std::ofstream ofs(filename.c_str(), std::ios::out);
        if (!ofs.is_open())
            return false;
        {
            boost::archive::xml_oarchive oa(ofs);
            oa << boost::serialization::make_nvp(data_name.c_str(),data);
        }
        ofs.close();
        return true;
    }

    template <typename T>
    bool read_from_xml(T& data, const std::string& filename, const std::string& data_name) {
        std::ifstream ifs(filename.c_str(), std::ios::in);
        if (!ifs.is_open())
            return false;
        {
            boost::archive::xml_iarchive ia(ifs);
            ia >> boost::serialization::make_nvp(data_name.c_str(),data);
        }
        ifs.close();
        return true;
    }
    */

}

#endif //VALUATION_IOHELPER_HPP


text:
/*

Copyright (c) 2003-2013, Arvid Norberg, Daniel Wallin
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 author 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 COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT OWNER OR CONTRIBUTORS 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.

*/

#ifndef TORRENT_ALERT_HPP_INCLUDED
#define TORRENT_ALERT_HPP_INCLUDED

#include <memory>
#include <deque>
#include <string>

#ifdef _MSC_VER
#pragma warning(push, 1)
#endif

#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
#include <boost/preprocessor/repetition/enum.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp>
#include <boost/preprocessor/repetition/enum_shifted_params.hpp>
#include <boost/preprocessor/repetition/enum_shifted_binary_params.hpp>

#ifdef _MSC_VER
#pragma warning(pop)
#endif

#include "libtorrent/ptime.hpp"
#include "libtorrent/config.hpp"

#ifndef BOOST_NO_TYPEID
#include <typeinfo>
#endif

#ifndef TORRENT_MAX_ALERT_TYPES
#define TORRENT_MAX_ALERT_TYPES 15
#endif

namespace libtorrent {

	class TORRENT_EXPORT alert
	{
	public:

#ifndef TORRENT_NO_DEPRECATE
		// only here for backwards compatibility
		enum severity_t { debug, info, warning, critical, fatal, none };
#endif

		enum category_t
		{
			error_notification = 0x1,
			peer_notification = 0x2,
			port_mapping_notification = 0x4,
			storage_notification = 0x8,
			tracker_notification = 0x10,
			debug_notification = 0x20,
			status_notification = 0x40,
			progress_notification = 0x80,
			ip_block_notification = 0x100,
			performance_warning = 0x200,
			dht_notification = 0x400,
			stats_notification = 0x800,
			rss_notification = 0x1000,

			// since the enum is signed, make sure this isn't
			// interpreted as -1. For instance, boost.python
			// does that and fails when assigning it to an
			// unsigned parameter.
			all_categories = 0x7fffffff
		};

		alert();
		virtual ~alert();

		// a timestamp is automatically created in the constructor
		ptime timestamp() const;

		virtual int type() const = 0;
		virtual char const* what() const = 0;
		virtual std::string message() const = 0;
		virtual int category() const = 0;
		virtual bool discardable() const { return true; }

#ifndef TORRENT_NO_DEPRECATE
		TORRENT_DEPRECATED_PREFIX
		severity_t severity() const TORRENT_DEPRECATED { return warning; }
#endif

		virtual std::auto_ptr<alert> clone() const = 0;

	private:
		ptime m_timestamp;
	};

	struct TORRENT_EXPORT unhandled_alert : std::exception
	{
		unhandled_alert() {}
	};

#ifndef BOOST_NO_TYPEID

	namespace detail {

		struct void_;

		template<class Handler
			, BOOST_PP_ENUM_PARAMS(TORRENT_MAX_ALERT_TYPES, class T)>
		void handle_alert_dispatch(
			const std::auto_ptr<alert>& alert_, const Handler& handler
			, const std::type_info& typeid_
			, T0*, BOOST_PP_ENUM_SHIFTED_BINARY_PARAMS(TORRENT_MAX_ALERT_TYPES, T, *p))
		{
			if (typeid_ == typeid(T0))
				handler(*static_cast<T0*>(alert_.get()));
			else
				handle_alert_dispatch(alert_, handler, typeid_
					, BOOST_PP_ENUM_SHIFTED_PARAMS(
					TORRENT_MAX_ALERT_TYPES, p), (void_*)0);
		}

		template<class Handler>
		void handle_alert_dispatch(
			const std::auto_ptr<alert>&
			, const Handler&
			, const std::type_info&
			, BOOST_PP_ENUM_PARAMS(TORRENT_MAX_ALERT_TYPES, void_* BOOST_PP_INTERCEPT))
		{
			throw unhandled_alert();
		}

	} // namespace detail

	template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
		TORRENT_MAX_ALERT_TYPES, class T, detail::void_)>
	struct TORRENT_EXPORT handle_alert
	{
		template<class Handler>
		handle_alert(const std::auto_ptr<alert>& alert_
			, const Handler& handler)
		{
			#define ALERT_POINTER_TYPE(z, n, text) (BOOST_PP_CAT(T, n)*)0

			detail::handle_alert_dispatch(alert_, handler, typeid(*alert_)
				, BOOST_PP_ENUM(TORRENT_MAX_ALERT_TYPES, ALERT_POINTER_TYPE, _));

			#undef ALERT_POINTER_TYPE
		}
	};

#endif // BOOST_NO_TYPEID

template <class T>
T* alert_cast(alert* a)
{
	if (a == 0) return 0;
	if (a->type() == T::alert_type) return static_cast<T*>(a);
	return 0;
}

template <class T>
T const* alert_cast(alert const* a)
{
	if (a == 0) return 0;
	if (a->type() == T::alert_type) return static_cast<T const*>(a);
	return 0;
}

} // namespace libtorrent

#endif // TORRENT_ALERT_HPP_INCLUDED

max_stars_repo_name: majestrate/twister-core

max_issues_repo_name: majestrate/twister-core

max_forks_repo_name: twisterarmy/twister-core


text:
/**************************************************************
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you 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.
 *
 *************************************************************/

#ifndef SD_FRAMEWORK_RESOURCE_ID_HXX
#define SD_FRAMEWORK_RESOURCE_ID_HXX

#include <com/sun/star/drawing/framework/XResourceId.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/util/XURLTransformer.hpp>
#include <cppuhelper/compbase2.hxx>
#include <boost/scoped_ptr.hpp>

namespace css = ::com::sun::star;

namespace {

typedef ::cppu::WeakImplHelper2 <
    css::drawing::framework::XResourceId,
    css::lang::XInitialization
    > ResourceIdInterfaceBase;

} // end of anonymous namespace.

namespace sd { namespace framework {

/** Implementation of the css::drawing::framework::ResourceId
    service and the css::drawing::framework::XResourceId
    interface.
*/
class ResourceId
    : public ResourceIdInterfaceBase
{
public:
    /** Create a new, empty resource id.
    */
    ResourceId (void);

    /** Create a new resource id that is described by the given URLs.
        @param rsResourceURLs
            The first URL specifies the type of resource.  The other URLs
            describe its anchor.
            The set of URLs may be empty.  The result is then the same as
            returned by ResourceId() default constructor.
    */
    ResourceId (const ::std::vector<rtl::OUString>& rsResourceURLs);

    /** Create a new resource id that has an empty anchor.
        @param rsResourceURL
            When this resource URL is empty then the resulting ResourceId
            object is identical to when the ResourceId() default constructor
            had been called.
    */
    ResourceId (
        const ::rtl::OUString& rsResourceURL);

    /** Create a new resource id for the given resource type and an anchor
        that is specified by a single URL.  This constructor can be used for
        example for views that are bound to panes.
        @param rsResourceURL
            The URL of the actual resource.
        @param rsAnchorURL
            The single URL of the anchor.
    */
    ResourceId (
        const ::rtl::OUString& rsResourceURL,
        const ::rtl::OUString& rsAnchorURL);

    /** Create a new resource id for the specified resource type and the
        given list of anchor URLs.
        @param rsResourceURL
            The URL of the actual resource.
        @param rsAnchorURLs
            The possibly empty list of anchor URLs.
    */
    ResourceId (
        const ::rtl::OUString& rsResourceURL,
        const ::std::vector<rtl::OUString>& rAnchorURLs);

    /** Create a new resource id with an anchor that consists of a sequence
        of URLs that is extended by a further URL.
        @param rsResourceURL
            The URL of the actual resource.
        @param rsFirstAnchorURL
            This URL extends the anchor given by rAnchorURLs.
        @param rAnchorURLs
            An anchor as it is returned by XResourceId::getAnchorURLs().
    */
    ResourceId (
        const ::rtl::OUString& rsResourceURL,
        const ::rtl::OUString& rsFirstAnchorURL,
        const css::uno::Sequence<rtl::OUString>& rAnchorURLs);

    virtual ~ResourceId (void);

    /** Return the list of URLs of both the resource URL and the anchor
        URLs.
    */
    const ::std::vector<rtl::OUString>& GetResourceURLs (void) const;

    //===== XResourceId =======================================================

    virtual ::rtl::OUString SAL_CALL
        getResourceURL (void)
        throw(css::uno::RuntimeException);

    virtual css::util::URL SAL_CALL
        getFullResourceURL (void)
        throw(css::uno::RuntimeException);

    virtual sal_Bool SAL_CALL
        hasAnchor (void)
        throw (css::uno::RuntimeException);

    virtual css::uno::Reference<
        css::drawing::framework::XResourceId> SAL_CALL
        getAnchor (void)
        throw (css::uno::RuntimeException);

    virtual css::uno::Sequence<rtl::OUString> SAL_CALL
        getAnchorURLs (void)
        throw (css::uno::RuntimeException);

    virtual ::rtl::OUString SAL_CALL
        getResourceTypePrefix (void)
        throw (css::uno::RuntimeException);

    virtual sal_Int16 SAL_CALL
        compareTo (const css::uno::Reference<
            css::drawing::framework::XResourceId>& rxResourceId)
        throw (css::uno::RuntimeException);

    virtual sal_Bool SAL_CALL
        isBoundTo (
            const css::uno::Reference<
                css::drawing::framework::XResourceId>& rxResourceId,
            css::drawing::framework::AnchorBindingMode eMode)
        throw(css::uno::RuntimeException);

    virtual sal_Bool SAL_CALL
        isBoundToURL (
            const ::rtl::OUString& rsAnchorURL,
            css::drawing::framework::AnchorBindingMode eMode)
        throw (css::uno::RuntimeException);

    virtual css::uno::Reference<
        css::drawing::framework::XResourceId> SAL_CALL
        clone (void)
        throw(css::uno::RuntimeException);

    //===== XInitialization ===================================================

    void SAL_CALL initialize (
        const css::uno::Sequence<css::uno::Any>& aArguments)
        throw (css::uno::RuntimeException);

private:
    /** The set of URLs that consist of the resource URL at index 0 and the
        anchor URLs and indices 1 and above.
    */
    ::std::vector<rtl::OUString> maResourceURLs;

    ::boost::scoped_ptr<css::util::URL> mpURL;

    static css::uno::WeakReference<css::util::XURLTransformer> mxURLTransformerWeak;

    /** Compare the called ResourceId object to the given ResourceId object.
        This uses the implementation of both objects to speed up the
        comparison.
    */
    sal_Int16 CompareToLocalImplementation (const ResourceId& rId) const;

    /** Compare the called ResourceId object to the given XResourceId object
        reference.  The comparison is done via the UNO interface.  Namely,
        it uses the getResourceURL() and the getAnchorURLs() methods to get
        access to the URLs of the given objec.
    */
    sal_Int16 CompareToExternalImplementation (const css::uno::Reference<
        css::drawing::framework::XResourceId>& rxId) const;

    /** Return whether the called ResourceId object is bound to the anchor
        consisting of the URLs given by psFirstAnchorURL and paAnchorURLs.
        @param psFirstAnchorURL
            Optional first URL of the anchor. This can be missing or present
            independently of paAnchorURLs.
        @param paAnchorURLs
            Optional set of additional anchor URLs.  This can be missing or
            present independently of psFirstAnchorURL.
        @param eMode
            This specifies whether the called resource has to be directly
            bound to the given anchor in order to return <TRUE/> or whether
            it can be bound indirectly, too.
    */
    bool IsBoundToAnchor (
        const rtl::OUString* psFirstAnchorURL,
        const css::uno::Sequence<rtl::OUString>* paAnchorURLs,
        css::drawing::framework::AnchorBindingMode eMode) const;

    /** Return whether the called ResourceId object is bound to the anchor
        consisting of the URLs in rResourceURLs.
        @param rResourceURLs
            A possibly empty list of anchor URLs.
        @param eMode
            This specifies whether the called resource has to be directly
            bound to the given anchor in order to return <TRUE/> or whether
            it can be bound indirectly, too.
    */
    bool IsBoundToAnchor (
        const ::std::vector<rtl::OUString>& rResourceURLs,
        css::drawing::framework::AnchorBindingMode eMode) const;

    void ParseResourceURL (void);
};

} } // end of namespace sd::framework

#endif

ext: hxx

max_stars_repo_name: Grosskopf/openoffice

max_issues_repo_name: Grosskopf/openoffice

max_forks_repo_name: Grosskopf/openoffice


text:
/***********************************************************************************************************************
 *  OpenStudio(R), Copyright (c) 2008-2018, Alliance for Sustainable Energy, LLC. All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
 *  following conditions are met:
 *
 *  (1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following
 *  disclaimer.
 *
 *  (2) 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.
 *
 *  (3) Neither the name of the copyright holder nor the names of any contributors may be used to endorse or promote
 *  products derived from this software without specific prior written permission from the respective party.
 *
 *  (4) Other than as required in clauses (1) and (2), distributions in any form of modifications or other derivative
 *  works may not use the "OpenStudio" trademark, "OS", "os", or any other confusingly similar designation without
 *  specific prior written permission from Alliance for Sustainable Energy, LLC.
 *
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 THE COPYRIGHT HOLDER, THE UNITED STATES GOVERNMENT, OR ANY CONTRIBUTORS 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.
 **********************************************************************************************************************/

#ifndef SHAREDGUICOMPONENTS_FIELDMETHODTYPEDEFS_HPP
#define SHAREDGUICOMPONENTS_FIELDMETHODTYPEDEFS_HPP

#include "../model/Model.hpp"
#include "../model/Model_Impl.hpp"
#include "../model/ModelObject.hpp"
#include "../model/ModelObject_Impl.hpp"

#include <boost/optional.hpp>

#include <vector>

namespace openstudio {

typedef std::function<bool ()> BoolGetter;
typedef std::function<double ()> DoubleGetter;
typedef std::function<int ()> IntGetter;
typedef std::function<std::string ()> StringGetter;
typedef std::function<unsigned ()> UnsignedGetter;
typedef std::function<model::ModelObject ()> ModelObjectGetter;

typedef std::function<boost::optional<double> ()> OptionalDoubleGetter;
typedef std::function<boost::optional<int> ()> OptionalIntGetter;
typedef std::function<boost::optional<std::string> ()> OptionalStringGetter;
typedef std::function<boost::optional<std::string> (bool)> OptionalStringGetterBoolArg;
typedef std::function<boost::optional<unsigned> ()> OptionalUnsignedGetter;
typedef std::function<boost::optional<model::ModelObject> ()> OptionalModelObjectGetter;

typedef std::function<void(bool)> BoolSetter;
typedef std::function<bool(bool)> BoolSetterBoolReturn;
typedef std::function<bool(double)> DoubleSetter;
typedef std::function<void (double)> DoubleSetterVoidReturn;
typedef std::function<bool (int)> IntSetter;
typedef std::function<bool(std::string)> StringSetter;
typedef std::function<void(std::string)> StringSetterVoidReturn;
typedef std::function<boost::optional<std::string>(const std::string &)> StringSetterOptionalStringReturn;
typedef std::function<bool (unsigned)> UnsignedSetter;
typedef std::function<bool (const model::ModelObject &)> ModelObjectSetter;

typedef std::function<void ()> NoFailAction;
typedef std::function<bool ()> BasicQuery;

}

#endif // SHAREDGUICOMPONENTS_FIELDMETHODTYPEDEFS_HPP

max_stars_repo_name: hongyuanjia/OpenStudio

max_issues_repo_name: hongyuanjia/OpenStudio

max_forks_repo_name: hongyuanjia/OpenStudio